Lightweight, fast, NativeAOT compatible MCP (Model Context Protocol) framework for .NET
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"mcptoolkit": {
"command": "<see-readme>",
"args": []
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
Lightweight, fast, NativeAOT compatible MCP (Model Context Protocol) framework for .NET
No automated test available for this server. Check the GitHub README for setup instructions.
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
No package registry to scan.
Be the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in developer-tools
Manage Supabase projects — databases, auth, storage, and edge functions
XcodeBuildMCP provides tools for Xcode project management, simulator management, and app utilities.
A Model Context Protocol (MCP) server and CLI that provides tools for agent use when working on iOS and macOS projects.
Asynchronous coordination layer for AI coding agents: identities, inboxes, searchable threads, and advisory file leases over FastMCP + Git + SQLite
MCP Security Weekly
Get CVE alerts and security updates for McpToolkit and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
Lightweight, fast, NativeAOT compatible MCP (Model Context Protocol) framework for .NET

English | 日本語
MCP Toolkit for .NET is a framework for building MCP (Model Context Protocol) servers/clients in .NET. By leveraging Source Generators, it enables the creation of MCP servers/clients with minimal C# code.
using McpToolkit;
using McpToolkit.Server;
await using var server = new McpServer();
server.Tools.Add("add", "Add two numbers together.", (double lhs, double rhs) =>
{
return lhs + rhs;
});
await server.ConnectAsync(new StdioServerTransport());
await Task.Delay(Timeout.Infinite);
[!CAUTION] MCP Toolkit for .NET is currently in alpha and may introduce breaking changes without notice. Additionally, the following features are under development and not yet supported:
- Streamable HTTP Transport
- Authorization
- Cancellation
- Progress
An official C# SDK for the Model Context Protocol already exists. So why use MCP Toolkit?
MCP Toolkit fully utilizes Source Generators to provide an intuitive and user-friendly API. Below is a comparison of implementing the same MCP server using the C# SDK and MCP Toolkit.
// C# SDK
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using ModelContextProtocol.Server;
using System.ComponentModel;
var builder = Host.CreateApplicationBuilder(args);
builder.Services
.AddMcpServer()
.WithStdioServerTransport()
.WithToolsFromAssembly();
await builder.Build().RunAsync();
[McpServerToolType]
public static class EchoTool
{
[McpServerTool, Description("Echoes the message back to the client.")]
public static string Echo(string message) => $"hello {message}";
}
// MCP Toolkit for .NET
using McpToolkit;
using McpToolkit.Server;
await using var server = new McpServer();
server.Tools.Add("echo",
"Echoes the message back to the client.",
(string message) => $"hello {message}");
await server.ConnectAsync(new StdioServerTransport());
await Task.Delay(Timeout.Infinite);
MCP Toolkit analyzes the lambda expressions passed to server.Tools.Add() and generates the necessary source code. It also supports adding tools at the class level, similar to the C# SDK.
Unlike the C# SDK, which depends on Microsoft.Extensions.AI and Microsoft.Extensions.Hosting, MCP Toolkit has no external dependencies.
While MCP is a protocol for integrating LLMs with applications, MCP itself is a simple JSON-RPC and does not inherently include LLM-related features. Therefore, the functionality provided by Microsoft.Extensions.AI is unnecessary for implementing a basic MCP server.
Integration with Microsoft.Extensions.Hosting is optional in MCP Toolkit and is provided as an extension package. Microsoft.Extensions.Hosting is a large package, and its dependency can significantly increase binary size, especially in Native AOT scenarios. While Generic Host is powerful for web application implementations, it is not essential for implementing local MCP servers/clients.
MCP Toolkit does not perform any dynamic code generation, making it fully compatible with Native AOT. This allows for reduced binary size and startup time through AOT compilation.
MCP Toolkit requires .NET 8 or later. All necessary packages are available on NuGet.
To implement an MCP server, you need the McpToolkit.Server package.