MCP .NET Implementation

v1.0.0โ€ขAPIsโ€ขstable

A fully featured C# implementation of Anthropic's Model Context Protocol (MCP)

agentsai-toolsanthropiccsharpdotnet
Share:
38
Stars
0
Downloads
0
Weekly
0/5

What is MCP .NET Implementation?

MCP .NET Implementation is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to fully featured c# implementation of anthropic's model context protocol (mcp)

A fully featured C# implementation of Anthropic's Model Context Protocol (MCP)

This server falls under the APIs category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A fully featured C# implementation of Anthropic's Model Cont

Use Cases

C# MCP protocol support
.NET agent tools
SamFold

Maintainer

LicenseMIT
Languagec#
Versionv1.0.0
UpdatedApr 20, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-net

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use MCP .NET Implementation

Mcp.Net is a fully featured C#/.NET implementation of Anthropic's Model Context Protocol, providing a complete SDK for building both MCP servers and clients in the .NET ecosystem. It supports dual transports (stdio for CLI tools and SSE for web applications), exposes a clean builder pattern API for registering tools, resources, and prompts, and ships with a working LLM demo that connects to OpenAI or Anthropic models. .NET developers use it to embed MCP server capabilities into existing C# applications or to build standalone MCP servers that integrate with Claude Desktop and other MCP clients.

Prerequisites

  • .NET 8 SDK or higher installed
  • An Anthropic or OpenAI API key (required only for the LLM interactive demo)
  • Visual Studio 2022, VS Code with C# extension, or JetBrains Rider
  • An MCP-compatible client such as Claude Desktop for testing servers
1

Add the Mcp.Net NuGet packages

Add the server and/or client packages to your .NET project. The Server package is needed to build an MCP server; the Client package is needed to connect to one.

dotnet add package Mcp.Net.Server
dotnet add package Mcp.Net.Client
2

Build a minimal MCP server

Use the McpServerBuilder to register tools and select a transport. The following creates a stdio server with a single calculator tool suitable for Claude Desktop integration.

var builder = new McpServerBuilder()
    .WithName("MyServer")
    .UseStdioTransport();

builder.AddTool("multiply", "Multiplies two numbers",
    (double a, double b) => a * b);

await builder.Build().RunAsync();
3

Run the example server

Clone the repository and run the included SimpleServer example to verify your environment works before writing custom code.

git clone https://github.com/SamFold/Mcp.Net.git
cd Mcp.Net
dotnet run --project Mcp.Net.Examples.SimpleServer/Mcp.Net.Examples.SimpleServer.csproj
4

Configure optional server settings

For SSE/HTTP transport, configure host, port, and scheme either via appsettings.json or environment variables. These are only needed if you are not using stdio.

{
  "Server": {
    "Port": 8080,
    "Hostname": "0.0.0.0",
    "Scheme": "http"
  }
}
5

Connect Claude Desktop to your server

Add the compiled .NET server binary to claude_desktop_config.json. Build your project first with `dotnet publish`, then reference the output executable.

{
  "mcpServers": {
    "mcp-net-example": {
      "command": "/path/to/publish/MyMcpServer",
      "args": []
    }
  }
}

MCP .NET Implementation Examples

Client configuration

Example claude_desktop_config.json using a published .NET MCP server binary via stdio transport.

{
  "mcpServers": {
    "mcp-net-example": {
      "command": "/usr/local/bin/MyMcpServer",
      "args": [],
      "env": {}
    }
  }
}

Prompts to try

Example prompts once a .NET MCP server built with Mcp.Net is connected to your AI client.

- "Multiply 47 by 83 using the calculator tool"
- "List all available resources on the connected MCP server"
- "Run the weather lookup tool for New York City"
- "Show me the available prompt templates from the MCP server"

Troubleshooting MCP .NET Implementation

Server exits immediately when launched from Claude Desktop

Ensure you are using stdio transport (UseStdioTransport()) and that the published binary is a self-contained executable. Run the binary directly from a terminal first to see any startup errors.

SSE transport not reachable from MCP client

Verify MCP_SERVER_PORT and MCP_SERVER_HOSTNAME environment variables are set correctly, or configure them in appsettings.json. Ensure no firewall blocks the configured port.

Tool registration causes duplicate name exceptions

Each tool name must be unique within a server. If you are composing multiple modules, prefix tool names with a module identifier (e.g., "weather_lookup" vs "db_lookup") to avoid collisions.

Frequently Asked Questions about MCP .NET Implementation

What is MCP .NET Implementation?

MCP .NET Implementation is a Model Context Protocol (MCP) server that fully featured c# implementation of anthropic's model context protocol (mcp) It connects AI assistants to external tools and data sources through a standardized interface.

How do I install MCP .NET Implementation?

Follow the installation instructions on the MCP .NET Implementation GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with MCP .NET Implementation?

MCP .NET Implementation works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is MCP .NET Implementation free to use?

Yes, MCP .NET Implementation is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More APIs MCP Servers

Explore all apis servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "mcp-net": { "command": "npx", "args": ["-y", "mcp-net"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide โ†’

Ready to use MCP .NET Implementation?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides