MCPSharp  by afrise

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

Created 1 year ago
357 stars

Top 78.7% 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

4 months ago

Responsiveness

1 day

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

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Kent Dodds Kent Dodds(Cofounder of Remix), and
10 more.

agentic by transitive-bullshit

0.0%
18k
AI agent stdlib for LLM-based TypeScript tooling
Created 3 years ago
Updated 2 weeks ago
Feedback? Help us improve.