.NET library for Model Context Protocol (MCP) server/client creation
Top 88.0% on sourcepulse
MCPSharp is a .NET library for building Model Context Protocol (MCP) servers and clients, enabling seamless integration between AI models and .NET applications. It simplifies exposing .NET methods as AI-discoverable tools and connecting to existing MCP services, targeting developers who want to add AI capabilities to their applications or create MCP-compliant tools.
How It Works
MCPSharp leverages a .NET attribute-based system ([McpTool]
, [McpParameter]
) to define and expose methods as MCP endpoints. It handles the underlying JSON-RPC communication and parameter validation automatically. The library also supports dynamic tool registration and integrates with Microsoft.Extensions.AI and Semantic Kernel, allowing for flexible tool management and interoperability.
Quick Start & Requirements
dotnet add package MCPSharp
Highlighted Details
KernelFunctionAttribute
.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
The README indicates that [McpFunction]
is deprecated in favor of [McpTool]
, and MCPServer.RegisterTool<T>()
is deprecated in favor of MCPServer.Register<T>()
. While the old methods still work, migration is recommended for consistency.
2 weeks ago
1 day