MCPSharp
MCPSharp is a .NET library that helps you build Model Context Protocol (MCP) servers and clients - the standardized API protocol used by AI assistants and models.
Overview
MCPSharp is a .NET library designed to help developers build Model Context Protocol (MCP) servers, which are standardized API protocols used by AI assistants and models.
To use MCPSharp, install the library via NuGet and define your tools and functions using specific attributes. Start the server to expose your .NET methods as MCP endpoints.
- Easy-to-use attribute-based API for defining tools and functions. - Built-in JSON-RPC support for automatic request/response handling. - Automatic parameter validation and type conversion. - Rich documentation support through XML comments. - Zero configuration required for basic usage.
- Creating tools for AI assistants like Anthropic's Claude Desktop.
- Building MCP-compliant APIs without dealing with protocol complexities.
- Exposing existing .NET code as MCP endpoints.
- Adding AI capabilities to applications through standardized interfaces.
Add to your AI client
Use these steps to connect MCPSharp in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"mcpsharp-afrise": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcpsharp-afrise"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"mcpsharp-afrise": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcpsharp-afrise"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"mcpsharp-afrise": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcpsharp-afrise"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"mcpsharp-afrise": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcpsharp-afrise"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mcpsharp-afrise": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcpsharp-afrise"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"mcpsharp-afrise": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcpsharp-afrise"
]
}
}
}FAQ
What is the minimum .NET version required?
.NET Framework 4.6 or higher is required.
How do I install MCPSharp?
You can install it using the command: `dotnet add package MCPSharp`.
Can I contribute to MCPSharp?
Yes! Contributions are welcome, and you can submit a Pull Request.