Model Context Protocol Net
MCP server for modelcontextprotocol net
What is Model Context Protocol Net?
Model Context Protocol Net is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp server for modelcontextprotocol net
MCP server for modelcontextprotocol net
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- MCP server for modelcontextprotocol net
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx modelcontextprotocol-netConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Model Context Protocol Net
ModelContextProtocol.NET is a C# SDK that lets .NET developers build MCP servers natively, without Node.js or Python. It provides a strongly-typed tool integration framework with stdio transport, native AOT compatibility, and optional ASP.NET Core hosting — enabling teams that work in C# to expose custom tools, resources, and prompts to Claude and other MCP-compatible AI clients using idiomatic .NET patterns.
Prerequisites
- .NET 8 SDK or later installed (dotnet CLI available)
- A .NET project in which to add the MCP server (console app or ASP.NET Core app)
- NuGet access to install the ModelContextProtocol.NET packages (currently prerelease)
- An MCP-compatible client such as Claude Desktop to test the server
Create a new .NET console project
Create a new console application that will host your MCP server. You can skip this step if adding to an existing project.
dotnet new console -n MyMcpServer
cd MyMcpServerInstall the ModelContextProtocol.NET NuGet packages
Add the core server package. If you want ASP.NET Core generic host integration (dependency injection, configuration, logging), also add the Hosting package.
dotnet add package ModelContextProtocol.NET.Server --prerelease
dotnet add package ModelContextProtocol.NET.Server.Hosting --prereleaseDefine your MCP server and tools
In Program.cs, create the server builder, configure stdio transport, and register your tool handlers. Note: when using stdio transport, do not log to the console — configure a file or provider-based logger instead.
using ModelContextProtocol.NET.Server;
var serverInfo = new Implementation { Name = "My MCP Server", Version = "1.0.0" };
var builder = new McpServerBuilder(serverInfo)
.AddStdioTransport()
.AddTool<MyToolHandler>();
var server = builder.Build();
await server.StartAsync();Implement a tool handler
Create a handler class that implements your tool logic. Each handler declares the tool name, description, and input schema. Parameters need JsonTypeInfo for Native AOT compatibility.
public class MyToolHandler : IToolHandler
{
public string Name => "my_tool";
public string Description => "Does something useful";
public Task<CallToolResult> HandleAsync(JsonElement arguments, CancellationToken ct)
{
var input = arguments.GetProperty("input").GetString();
return Task.FromResult(new CallToolResult("Result: " + input));
}
}Build and configure your MCP client
Build the project with 'dotnet build' and publish it. Then add the compiled binary to your MCP client configuration pointing to the executable path.
dotnet build -c Release
# Output binary path: bin/Release/net8.0/MyMcpServerAdd the server to your MCP client config
Register the compiled .NET executable in claude_desktop_config.json. The server communicates over stdio so no port configuration is needed.
{
"mcpServers": {
"my-dotnet-server": {
"command": "/absolute/path/to/bin/Release/net8.0/MyMcpServer",
"args": []
}
}
}Model Context Protocol Net Examples
Client configuration
Example claude_desktop_config.json for a compiled ModelContextProtocol.NET server binary running over stdio transport.
{
"mcpServers": {
"my-dotnet-mcp": {
"command": "/Users/you/MyMcpServer/bin/Release/net8.0/MyMcpServer",
"args": []
}
}
}Prompts to try
Once your custom tools are registered, test them with prompts that match the tools you exposed.
- "Use my_tool with input 'hello world' and show me the result"
- "List all available tools in the connected MCP server"
- "Call the calculator tool to compute 142 * 37"Troubleshooting Model Context Protocol Net
Server crashes silently when logs are written to stdout
MCP stdio transport uses stdout for protocol messages. Any Console.Write/WriteLine calls will corrupt the protocol stream. Configure logging to use a file, Serilog file sink, or NLog file target instead of the console.
Native AOT build fails with JSON serialization errors
Native AOT requires explicit JsonTypeInfo for all parameter types. Use System.Text.Json source generation by adding [JsonSerializable] attributes to your type context and passing the generated JsonTypeInfo when registering tool parameter schemas.
Package not found — prerelease version unavailable
Run 'dotnet add package ModelContextProtocol.NET.Server --prerelease' explicitly. If nuget.org access is blocked, add 'https://api.nuget.org/v3/index.json' to your NuGet.Config sources. Check the GitHub releases page for the latest prerelease version tag.
Frequently Asked Questions about Model Context Protocol Net
What is Model Context Protocol Net?
Model Context Protocol Net is a Model Context Protocol (MCP) server that mcp server for modelcontextprotocol net It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Model Context Protocol Net?
Follow the installation instructions on the Model Context Protocol Net GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Model Context Protocol Net?
Model Context Protocol Net works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Model Context Protocol Net free to use?
Yes, Model Context Protocol Net is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Model Context Protocol Net Alternatives — Similar Developer Tools Servers
Looking for alternatives to Model Context Protocol Net? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Model Context Protocol Net in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Model Context Protocol Net?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.