Version-Based Tool Registration for MCP Server
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- csharp
- Lĩnh vực
- api, backend-api-design
Hướng nghiên cứu
Bắt đầu bằng cách đọc các API WithTools() hiện có và các API đăng ký công cụ trên toàn assembly, sau đó kiểm tra MapMcp và các tùy chọn truyền tải HTTP của nó. Issue đề xuất cơ chế discovery dựa trên namespace và các ràng buộc endpoint theo phiên bản, nhưng vẫn cần quyết định hình dạng API được hỗ trợ và phạm vi triển khai; công việc chỉ được xem là hoàn tất khi có một thiết kế đã được thống nhất, cho phép đăng ký công cụ có chọn lọc và theo phiên bản mà không lặp lại cấu hình server.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is your feature request related to a problem? Please describe.
When building MCP servers in .NET, especially HTTP-based servers with versioned endpoints, there is currently no first-class support for tool versioning and selective tool registration.
All tools are typically registered globally (e.g. via WithTools() or assembly-wide scanning), which makes it difficult to:
- Expose multiple API versions (/v1, /v2, …) in parallel
- Maintain backward compatibility while evolving tools
- Avoid duplicating MCP server registrations per version
- Keep tool discovery explicit and predictable in larger codebases
This becomes especially painful in real-world services where:
- Tools are organized by namespace (e.g. MyNamespace.Mcp.v1, MyNamespace.Mcp.v2)
- Different MCP endpoints should only expose a subset of tools
- Versioning logic must be reimplemented manually outside the SDK
Describe the solution you'd like
I propose adding official support for namespace- and version-based tool registration, enabling clean MCP API versioning.
- Namespace-based tool discovery helper
A built-in extension similar to the following:
public static class McpVersioningExtensions
{
public static IMcpServerBuilder WithToolsFromNamespaces(
this IMcpServerBuilder builder,
Assembly assembly,
params string[] namespaceNames)
{
IEnumerable<Type> toolTypes =
from t in assembly.GetTypes()
where t.GetCustomAttribute<McpServerToolTypeAttribute>() is not null
where t.Namespace != null
&& namespaceNames.Any(ns =>
t.Namespace.StartsWith(ns, StringComparison.Ordinal))
select t;
return builder.WithTools(toolTypes);
}
}
Usage:
builder.Services.AddMcpServer(options =>
{
options.ServerInfo.Version = "1.0.0";
})
.WithHttpTransport()
.WithToolsFromNamespaces(
typeof(Program).Assembly,
"MyNamespace.Mcp.v1");
This allows:
- Clear separation of tools by namespace
- Explicit control over which tools belong to which API version
- No reflection boilerplate in application code
- Version-aware endpoint mapping
Combine tool versioning with HTTP endpoint constraints:
app.MapMcp("/v1", options =>
{
options.RequiredServerVersion = "1.0.0";
});
app.MapMcp("/v2", options =>
{
options.RequiredServerVersion = "2.0.0";
});
This enables:
- Parallel MCP versions in the same service
- Clean routing and contract enforcement
- Safe evolution of tools without breaking clients
Describe alternatives you've considered
- Multiple MCP servers per version
→ Leads to duplicated configuration, duplicated transports, and higher maintenance cost. - Manual reflection and filtering outside the SDK
→ Works, but reimplements logic that many users will need and reduces consistency across projects. - Tool-level version attributes only
→ Still requires custom registration logic and does not integrate naturally with HTTP endpoint versioning.
Additional context
This feature would be particularly valuable for:
- Enterprise services with long-lived clients
- Public MCP endpoints with semantic versioning
- Teams migrating from REST/gRPC APIs to MCP while preserving version contracts
Providing an official abstraction for namespace- or version-based tool registration would:
- Reduce boilerplate
- Encourage best practices
- Make the SDK significantly more production-ready for real-world API versioning scenarios
- Ngôn ngữ chính
- C#
- Star
- 4.5k
- Fork
- 814
- Merge trung bình
- 9 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/csharp-sdk
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
modelcontextprotocol/csharp-sdk#1867 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
modelcontextprotocol/csharp-sdk#1836 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement needs confirmation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
modelcontextprotocol/csharp-sdk#678 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement needs confirmation P3 ready for work
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
modelcontextprotocol/csharp-sdk#515 · 6 bình luận · 3 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của modelcontextprotocol/csharp-sdk
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
AvaloniaUI/Avalonia#22323 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
microsoft/onnxruntime-genai#2633 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
FluentDataGrid: pinned column offsets leak into the grid of an open RowDetails (master-detail)Đang mởNot reproducible
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/fluentui-blazor#5350 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
microsoft/semantic-kernel#14491 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area:jobads-cv FE mvp P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
klasolsson81/jobbliggaren#1878 ·
Maintainer thường phản hồi trong vòng 1 ngày