AI Skill Hub 推荐使用:.NET MCP桥接工具 是一款优质的MCP工具。AI 综合评分 7.2 分,在同类工具中表现稳健。如果你正在寻找可靠的MCP工具解决方案,这是一个值得深入了解的选择。
将.NET应用方法和数据暴露为MCP工具、提示词和资源的开源桥接方案。支持HTTP协议,帮助.NET开发者快速集成LLM功能,适合需要构建智能应用的C#开发团队。
.NET MCP桥接工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
将.NET应用方法和数据暴露为MCP工具、提示词和资源的开源桥接方案。支持HTTP协议,帮助.NET开发者快速集成LLM功能,适合需要构建智能应用的C#开发团队。
.NET MCP桥接工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/IvanMurzak/MCP-Plugin-dotnet
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"-net-mcp----": {
"command": "npx",
"args": ["-y", "mcp-plugin-dotnet"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 .NET MCP桥接工具 执行以下任务... Claude: [自动调用 .NET MCP桥接工具 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"_net_mcp____": {
"command": "npx",
"args": ["-y", "mcp-plugin-dotnet"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
MCP Plugin for .NET is a comprehensive solution for integrating .NET applications with the Model Context Protocol (MCP). It allows you to easily expose methods and data from your .NET applications as Tools, Prompts, and Resources to AI assistants (like Claude) and other MCP clients.
[McpPluginTool], [McpPluginPrompt], and [McpPluginResource] attributes.stdio (for local AI agents like Claude Desktop) and http (for remote connections).Microsoft.Extensions.DependencyInjection.You can run the bridge server in a Docker container:
docker build -t mcp-bridge -f McpPlugin.Server/Dockerfile .
docker run -p 8080:8080 mcp-bridge port=8080 client-transport=http
The server acts as a hub. You can run the provided DemoWebApp or host it in your own ASP.NET Core application.
Running the Demo Server:
cd DemoWebApp
dotnet run port=11111 client-transport=stdio
Note: Use client-transport=stdio if connecting from Claude Desktop, or client-transport=http for HTTP-based clients.
Hosting in your own Web App:
// Program.cs
using com.IvanMurzak.McpPlugin.Common;
using com.IvanMurzak.McpPlugin.Common.Utils;
using com.IvanMurzak.McpPlugin.Server;
var builder = WebApplication.CreateBuilder(args);
// 1. Prepare arguments (or load from config)
var dataArguments = new DataArguments(args);
// 2. Register MCP Server services
builder.Services
.WithMcpServer(dataArguments) // Configures transport based on dataArguments.ClientTransport
.WithMcpPluginServer(dataArguments);
// 3. Configure Kestrel with separate IPv4/IPv6 bindings (avoids dual-stack issues on macOS)
builder.WebHost.UseKestrelForMcpPlugin(dataArguments.Port);
var app = builder.Build();
// 4. Use MCP Server middleware
app.UseMcpPluginServer(dataArguments);
app.Run();
Add the com.IvanMurzak.McpPlugin package to your .NET application.
Defining Tools, Prompts, and Resources:
using com.IvanMurzak.McpPlugin;
using System.ComponentModel;
[McpPluginToolType]
public static class MyMcpComponents
{
// --- Tools ---
[McpPluginTool("calculate-sum", "Adds two numbers")]
[Description("Adds two numbers")]
public static int Add(int a, int b) => a + b;
// --- Prompts ---
[McpPluginPrompt("explain-code", "Explains a piece of code")]
public static string ExplainCode(string code) => $"The following code: {code} does X, Y, and Z.";
// --- Resources ---
[McpPluginResource("system-logs", "Returns the latest system logs", "logs://system")]
public static string GetLogs() => "Log entry 1: System started...";
}
Connecting to the Server:
using com.IvanMurzak.McpPlugin;
using com.IvanMurzak.ReflectorNet;
// 1. Initialize Reflector (The core engine)
var reflector = new Reflector();
// 2. Configure and build the plugin
var version = new com.IvanMurzak.McpPlugin.Common.Version
{
Api = "1.0.0",
Plugin = "1.0.0"
};
var plugin = new McpPluginBuilder(version)
.WithConfig(config => {
config.Host = "http://localhost:11111"; // Match your server port
})
// Option A: Scan assemblies for [McpPluginTool], [McpPluginPrompt], [McpPluginResource]
.WithToolsFromAssembly(typeof(MyMcpComponents).Assembly)
.WithPromptsFromAssembly(typeof(MyMcpComponents).Assembly)
.WithResourcesFromAssembly(typeof(MyMcpComponents).Assembly)
.Build(reflector);
// 3. Connect to the MCP server
await plugin.Connect();
Command-line arguments take priority over environment variables.
| Argument | Env Var | Description | Default |
|---|---|---|---|
port | MCP_PLUGIN_PORT | The port the SignalR hub listens on. | 8080 |
client-transport | MCP_PLUGIN_CLIENT_TRANSPORT | Transport method: stdio or streamableHttp. | streamableHttp |
plugin-timeout | MCP_PLUGIN_CLIENT_TIMEOUT | Timeout for plugin operations (ms). | 10000 |
idle-timeout-seconds | MCP_PLUGIN_IDLE_TIMEOUT_SECONDS | streamableHttp only: idle window before an MCP session is evicted from the in-memory tracker. Longer values reduce reconnect 404s / session-migration rehydrates at the cost of higher in-memory footprint (bounded by MaxIdleSessionCount). The SDK's own default is 7200 (2 h). | 600 |
token | MCP_PLUGIN_TOKEN | Bearer token required from connecting plugins. | *(none)* |
authorization | MCP_AUTHORIZATION | Authorization mode: none or required. | none |
McpPlugin.Server can emit fire-and-forget HTTP POST notifications to external endpoints for observability and analytics. Each event category has an independent URL, so you can route tool, prompt, resource, and connection events to different systems.
| Argument | Env Var | Description | Default |
|---|---|---|---|
webhook-tool-url | MCP_PLUGIN_WEBHOOK_TOOL_URL | Endpoint to receive tool call events. | *(none)* |
webhook-prompt-url | MCP_PLUGIN_WEBHOOK_PROMPT_URL | Endpoint to receive prompt retrieval events. | *(none)* |
webhook-resource-url | MCP_PLUGIN_WEBHOOK_RESOURCE_URL | Endpoint to receive resource access events. | *(none)* |
webhook-connection-url | MCP_PLUGIN_WEBHOOK_CONNECTION_URL | Endpoint to receive client connect/disconnect events. | *(none)* |
webhook-token | MCP_PLUGIN_WEBHOOK_TOKEN | Security token sent in each webhook request header. | *(none)* |
webhook-header | MCP_PLUGIN_WEBHOOK_HEADER | Header name for the security token. | X-Webhook-Token |
webhook-timeout | MCP_PLUGIN_WEBHOOK_TIMEOUT | HTTP delivery timeout in milliseconds. | 10000 |
Example — enable tool and connection analytics:
dotnet run \
client-transport=stdio \
webhook-tool-url=https://analytics.example.com/hooks/tools \
webhook-connection-url=https://analytics.example.com/hooks/connections \
webhook-token=my-secret-token
Event payload structure (all events follow this envelope):
{
"schemaVersion": "1.0",
"eventType": "tool.call.completed",
"timestamp": "2026-03-01T12:34:56.789Z",
"data": {
"toolName": "add",
"requestSizeBytes": 42,
"responseSizeBytes": 18,
"status": "success",
"durationMs": 150
}
}
Supported event types:
| Event Type | Trigger |
|---|---|
tool.call.completed | Every MCP tool call (success or failure) |
prompt.retrieved | Every MCP prompt retrieval |
resource.accessed | Every MCP resource access |
connection.ai-agent.connected | AI agent (MCP client) connects |
connection.ai-agent.disconnected | AI agent (MCP client) disconnects |
connection.plugin.connected | McpPlugin (.NET client) connects via SignalR |
connection.plugin.disconnected | McpPlugin (.NET client) disconnects |
Notes:
McpPlugin.Server can be configured with a synchronous authorization webhook that gates connections from both MCP clients (AI agents via HTTP) and McpPlugin clients (.NET apps via SignalR). Unlike the fire-and-forget analytics webhooks above, authorization webhooks block the connection until your endpoint responds.
| Argument | Env Var | Description | Default |
|---|---|---|---|
webhook-authorization-url | MCP_PLUGIN_WEBHOOK_AUTHORIZATION_URL | Endpoint that authorizes/denies connections. | *(none)* |
webhook-authorization-fail-open | MCP_PLUGIN_WEBHOOK_AUTHORIZATION_FAIL_OPEN | When true, allow connections if webhook times out or errors. When false, deny on failure. | false |
Example — enable connection authorization with fail-closed behavior:
dotnet run \
client-transport=stdio \
webhook-authorization-url=https://auth.example.com/authorize \
webhook-token=my-secret-token \
webhook-authorization-fail-open=false
Request format (POST from server to your webhook):
For AI agent connections (authorization.ai-agent):
{
"schemaVersion": "1.0",
"eventType": "authorization.ai-agent",
"timestamp": "2025-03-04T22:45:30.1234567Z",
"connectionId": "trace-id-or-connection-id",
"clientType": "ai-agent",
"bearerToken": "<token-from-client>",
"remoteIpAddress": "192.168.1.100",
"userAgent": "claude-ai/1.0",
"requestPath": "/mcp",
"clientName": null,
"clientVersion": null,
"hmacSignature": "sha256=abc123..."
}
For plugin connections (authorization.plugin):
{
"schemaVersion": "1.0",
"eventType": "authorization.plugin",
"timestamp": "2025-03-04T22:45:30.1234567Z",
"connectionId": "trace-id-or-connection-id",
"clientType": "plugin",
"bearerToken": "<token-from-plugin>",
"remoteIpAddress": null,
"userAgent": null,
"requestPath": null,
"clientName": "my-unity-plugin",
"clientVersion": "1.2.0",
"hmacSignature": "sha256=def456..."
}
Note: ThehmacSignaturefield is only present whenwebhook-tokenis configured. It contains an HMAC-SHA256 signature of the request body (before the signature field is added), computed using the webhook token as the secret key.
Expected response format (from your webhook to server):
{ "allowed": true }
or
{ "allowed": false, "reason": "IP not in allowlist" }
Behavior:
allowed: true → Connection proceedsallowed: false → Connection denied (reason logged as warning)fail-open=true)Security:
webhook-header (default: X-Webhook-Token)Notes:
webhook-authorization-url is not configured, authorization is disabled (all connections allowed)Command-line arguments and environment variables are parsed automatically via ConnectionConfig.BuildFromArgsOrEnv(). They can also be overridden programmatically via McpPluginBuilder.WithConfig(...).
| Argument | Env Var | Property | Description | Default |
|---|---|---|---|---|
mcp-server-endpoint | MCP_SERVER_ENDPOINT | Host | The URL of the bridge server. | http://localhost:8080 |
mcp-server-timeout | MCP_SERVER_TIMEOUT | TimeoutMs | Operation timeout (ms). | 10000 |
mcp-plugin-token | MCP_PLUGIN_TOKEN | Token | Bearer token sent to the server for authentication. | *(none)* |
mcp-skills-folder | MCP_SKILLS_FOLDER | SkillsPath | Path for generated skill markdown files. | SKILLS |
Programmatic-only properties (set via WithConfig(...)):
| Property | Description | Default |
|---|---|---|
KeepConnected | Automatically reconnect if the connection is lost. | true |
GenerateSkillFiles | Auto-generate skill markdown files for each registered tool. | true |
填补.NET与MCP生态的空白,设计思路清晰。但项目初期热度不足,需社区推动和文档完善才能成为主流方案。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。
总体来看,.NET MCP桥接工具 是一款质量良好的MCP工具,在同类工具中具备一定竞争力。AI Skill Hub 将持续追踪其更新动态,建议收藏备用,结合自身场景选择合适时机引入使用。
| 原始名称 | MCP-Plugin-dotnet |
| 原始描述 | 开源MCP工具:.NET MCP bridge: expose app methods/data as MCP tools, prompts, and resources vi。⭐13 · C# |
| Topics | MCP协议.NET集成LLM工具HTTP桥接C# |
| GitHub | https://github.com/IvanMurzak/MCP-Plugin-dotnet |
| License | Apache-2.0 |
| 语言 | C# |
收录时间:2026-05-21 · 更新时间:2026-05-22 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端