MCPSharp  by afrise

.NET library for Model Context Protocol (MCP) server/client creation

created 5 months ago
309 stars

Top 88.0% on sourcepulse

GitHubView on GitHub
Project Summary

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

Highlighted Details

  • Integrates with Microsoft.Extensions.AI for AIFunctions and Semantic Kernel for KernelFunctionAttribute.
  • Supports dynamic tool registration with custom implementation logic.
  • Provides tool change notifications to clients when tools are added or updated.
  • Handles complex object parameters and offers improved error handling with detailed stack traces.
  • Automatically extracts tool descriptions from XML comments.

Maintenance & Community

  • The project welcomes contributions via Pull Requests.
  • No specific community channels (Discord/Slack) or roadmap links are provided in the README.

Licensing & Compatibility

  • Licensed under the MIT License.
  • Permissive license suitable for commercial use and integration with closed-source applications.

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.

Health Check
Last commit

2 weeks ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
0
Star History
39 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Travis Fischer Travis Fischer(Founder of Agentic), and
1 more.

fastmcp by punkpeye

3.7%
2k
TypeScript framework for building MCP servers handling client sessions
created 7 months ago
updated 2 days ago
Starred by Didier Lopes Didier Lopes(Founder of OpenBB), Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), and
2 more.

fastmcp by jlowin

2.1%
15k
Pythonic SDK for building Model Context Protocol (MCP) servers/clients
created 8 months ago
updated 1 day ago
Feedback? Help us improve.