
A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

MCPSharp is a .NET library that helps developers create MCP-compliant servers and clients, exposing .NET methods as MCP tools and resources with attribute-based annotations and minimal configuration.
MCPSharp .NET library for building MCP servers and clients is cataloged as an MCP server attributed to afrise. MCPSharp is a .NET library that helps developers create MCP-compliant servers and clients, exposing .NET methods as MCP tools and resources with attribute-based annotations and minimal configuration. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.
能力定义尚未审核。未核验的采集内容不会作为可信接口展示。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for MCPSharp .NET library for building MCP servers and clients are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
Basic usage requires near zero configuration; annotated methods are automatically discovered when the server starts.
Yes, tools retrieved as AIFunctions can be plugged into ChatOptions.Tools for an IChatClient.
README.md · a4cfca01c9d2 · 采集于 2026-11-13 09:36:47 UTC
保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。
当前显示最后一次成功采集的文档快照,请以来源页面为准。
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. With MCPSharp, you can:
Use MCPSharp when you want to:
[McpTool], [McpResource])dotnet add package MCPSharp
Create a class and mark your method(s) with the [McpTool] attribute:
using MCPSharp;
public class Calculator
{
[McpTool("add", "Adds two numbers")] // Note: [McpFunction] is deprecated, use [McpTool] instead
public static int Add([McpParameter(true)] int a, [McpParameter(true)] int b)
{
return a + b;
}
}
await MCPServer.StartAsync("CalculatorServer", "1.0.0");
The StartAsync() method will automatically find any methods in the base assembly that are marked with the McpTool attribute. In order to add any methods that are in a referenced library, you can manually register them by calling MCPServer.Register<T>(); with T being the class containing the desired methods. If your methods are marked with Semantic Kernel attributes, this will work as well. If the client supports list changed notifications, it will be notified when additional tools are registered.
Register tools dynamically with custom implementation:
MCPServer.AddToolHandler(new Tool()
{
Name = "dynamicTool",
Description = "A dynamic tool",
InputSchema = new InputSchema {
Type = "object",
Required = ["input"],
Properties = new Dictionary<string, ParameterSchema>{
{"input", new ParameterSchema{Type="string", Description="Input value"}}
}
}
}, (string input) => { return $"You provided: {input}"; });
// Client-side integration
MCPClient client = new("AIClient", "1.0", "path/to/mcp/server");
IList<AIFunction> functions = await client.GetFunctionsAsync();
This list can be plugged into the ChatOptions.Tools property for an IChatClient, Allowing MCP servers to be used seamlessly with Any IChatClient Implementation.
using Microsoft.SemanticKernel;
public class MySkillClass
{
[KernelFunction("MyFunction")]
[Description("Description of my function")]
public string MyFunction(string input) => $"Processed: {input}";
}
// Register with MCPServer
MCPServer.Register<MySkillClass>();
Currently, This is the only way to make a Semantic kernel method registerable with the MCP server. If you have a use case that is not covered here, please reach out!
[McpTool] - Marks a class or method as an MCP tool
Name - The tool name (default: class/method name)Description - Description of the tool[McpParameter] - Provides metadata for function parameters
Description - Parameter descriptionRequired - Whether the parameter is required (default: false)[McpResource] - Marks a property or method as an MCP resource
Name - Resource nameUri - Resource URI (can include templates)MimeType - MIME type of the resourceDescription - Resource descriptionMCPServer.StartAsync(string serverName, string version) - Starts the MCP serverMCPServer.Register<T>() - Registers a class containing tools or resourcesMCPServer.AddToolHandler(Tool tool, Delegate func) - Registers a dynamic toolnew MCPClient(string name, string version, string server, string args = null, IDictionary<string, string> env = null) - Create a client instanceclient.GetToolsAsync() - Get available toolsclient.CallToolAsync(string name, Dictionary<string, object> parameters) - Call a toolclient.GetResourcesAsync() - Get available resourcesclient.GetFunctionsAsync() - Get tools as AIFunctionsMCPSharp automatically extracts documentation from XML comments:
/// <summary>
/// Provides mathematical operations
/// </summary>
public class Calculator
{
/// <summary>
/// Adds two numbers together
/// </summary>
/// <param name="a">The first number to add</param>
/// <param name="b">The second number to add</param>
/// <returns>The sum of the two numbers</returns>
[McpTool]
public static int Add(
[McpParameter(true)] int a,
[McpParameter(true)] int b)
{
return a + b;
}
}
Enable XML documentation in your project file:
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
This allows you to be able to quickly change the names and descriptions of your MCP tools without having to recompile. For example, if you find the model is having trouble understanding how to use it correctly.
[McpFunction] is deprecated and replaced with [McpTool] for better alignment with MCP standardsMCPServer.Register<T>() instead of MCPServer.RegisterTool<T>() for consistency (old method still works but is deprecated)We welcome contributions! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for MCPSharp .NET library for building MCP servers and clients from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/mcpsharp)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。
尚无已审核的包 / 镜像标识,暂不展示下载统计。
Alternative and complementary servers in the same category

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.