ZeroMCP 1.5.0
dotnet add package ZeroMCP --version 1.5.0
NuGet\Install-Package ZeroMCP -Version 1.5.0
<PackageReference Include="ZeroMCP" Version="1.5.0" />
<PackageVersion Include="ZeroMCP" Version="1.5.0" />
<PackageReference Include="ZeroMCP" />
paket add ZeroMCP --version 1.5.0
#r "nuget: ZeroMCP, 1.5.0"
#:package ZeroMCP@1.5.0
#addin nuget:?package=ZeroMCP&version=1.5.0
#tool nuget:?package=ZeroMCP&version=1.5.0
ZeroMCP
Expose your ASP.NET Core API as an MCP (Model Context Protocol) server. Tag controller actions with [Mcp], [McpResource], [McpTemplate], or [McpPrompt] — or use the minimal API equivalents .AsMcp(...), .AsResource(...), .AsTemplate(...), .AsPrompt(...). ZeroMCP discovers them, builds JSON Schema for inputs, and exposes a single /mcp endpoint that speaks the MCP Streamable HTTP transport. Calls are dispatched in-process through your real pipeline (filters, validation, authorization run as normal).
Full documentation (configuration, governance, observability, minimal APIs, limitations): repository README or your GitLab repo root README.md.
Install
<PackageReference Include="ZeroMCP" Version="1.*" />
Quick Start
1. Register and map
// Program.cs
builder.Services.AddZeroMCP(options =>
{
options.ServerName = "My API";
options.ServerVersion = "1.0.0";
});
// After UseRouting(), UseAuthorization()
app.MapZeroMCP(); // GET and POST /mcp; GET /mcp/tools and GET /mcp/ui when inspector/UI are enabled
2. Tag controller actions
[HttpGet("{id}")]
[Mcp("get_order", Description = "Retrieves a single order by ID.")]
public ActionResult<Order> GetOrder(int id) { ... }
[HttpPost]
[Mcp("create_order", Description = "Creates a new order.")]
public ActionResult<Order> CreateOrder([FromBody] CreateOrderRequest request) { ... }
3. Optional: minimal APIs
app.MapGet("/api/health", () => Results.Ok(new { status = "ok" }))
.AsMcp("health_check", "Returns API health status.");
4. Optional: resources, templates, and prompts
// Controller attributes
[McpResource("system://status", "system_status", Description = "System status.")]
[McpTemplate("catalog://products/{id}", "product_resource", Description = "Product by ID.")]
[McpPrompt("search_products", Description = "Search products by keyword.")]
// Minimal API equivalents
app.MapGet("/api/status", () => ...).AsResource("system://status", "system_status", "System status.");
app.MapGet("/api/products/{id}", (int id) => ...).AsTemplate("catalog://products/{id}", "product_resource", "Product by ID.");
app.MapGet("/api/prompts/search", (string keyword) => ...).AsPrompt("search_products", "Search products.");
If you use both controllers and minimal APIs, add builder.Services.AddEndpointsApiExplorer(); and app.MapControllers(); so controller items are discovered.
Point any MCP client (e.g. Claude Desktop) at your app's /mcp URL.
Configuration (summary)
| Option | Default | Description |
|---|---|---|
RoutePrefix |
"/mcp" |
Endpoint path |
ServerName / ServerVersion |
— | Shown in MCP handshake |
IncludeInputSchemas |
true |
Include JSON Schema in tools/list |
EnableXMLDocAnalysis |
true |
Use XML doc summary as tool description when [Mcp] Description is blank |
ForwardHeaders |
["Authorization"] |
Headers copied to tool dispatch |
ToolFilter |
null |
Discovery-time filter by tool name |
ToolVisibilityFilter |
null |
Per-request filter (name, ctx) => bool |
CorrelationIdHeader |
"X-Correlation-ID" |
Request/response correlation ID |
EnableOpenTelemetryEnrichment |
false |
Tag Activity.Current with MCP tool details |
EnableResultEnrichment |
false |
tools/call result includes metadata, optional hints |
EnableSuggestedFollowUps |
false |
Include suggestedNextActions when provider is set |
EnableStreamingToolResults |
false |
Return content as chunks (chunkIndex, isFinal) |
StreamingChunkSize |
4096 |
Chunk size when streaming enabled |
EnableToolInspector |
true |
GET {RoutePrefix}/tools returns full tool list as JSON |
EnableToolInspectorUI |
true |
GET {RoutePrefix}/ui serves Swagger-like test invocation UI |
EnableResources |
true |
Enable resources/list, resources/read, resources/templates/list |
EnablePrompts |
true |
Enable prompts/list, prompts/get |
EnableLegacySseTransport |
false |
Add GET /mcp/sse and POST /mcp/messages for MCP spec 2024-11-05 clients |
MaxFormFileSizeBytes |
10485760 (10 MB) |
Max size for base64-decoded form files; enforced before decode |
EnableListChangedNotifications |
false |
Advertise listChanged: true and enable SSE push for list changes |
EnableResourceSubscriptions |
false |
Advertise subscribe: true in resources; handle resources/subscribe / resources/unsubscribe |
Set EnableToolInspector or EnableToolInspectorUI to false to disable the JSON endpoint or the UI (e.g. in production if the list is sensitive). The sample app uses builder.Environment.IsDevelopment() to enable them only in Development.
Governance: Use [Mcp(..., Roles = new[] { "Admin" }, Policy = "RequireEditor")] or .AsMcp(..., roles: ..., policy: ...) to restrict which tools appear in tools/list per user.
Metrics: Implement IMcpMetricsSink and register it after AddZeroMCP() to record tool invocations (name, status code, duration, success/failure).
Versioning
We follow Semantic Versioning. Breaking changes are documented in the repository (e.g. VERSIONING.md).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- NJsonSchema (>= 11.0.0)
-
net8.0
- NJsonSchema (>= 11.0.0)
-
net9.0
- NJsonSchema (>= 11.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.