SwaggerMcp 1.1.1
Package name changed. Alternate package ZeroMCP, is the same product with upgrades.
dotnet add package SwaggerMcp --version 1.1.1
NuGet\Install-Package SwaggerMcp -Version 1.1.1
<PackageReference Include="SwaggerMcp" Version="1.1.1" />
<PackageVersion Include="SwaggerMcp" Version="1.1.1" />
<PackageReference Include="SwaggerMcp" />
paket add SwaggerMcp --version 1.1.1
#r "nuget: SwaggerMcp, 1.1.1"
#:package SwaggerMcp@1.1.1
#addin nuget:?package=SwaggerMcp&version=1.1.1
#tool nuget:?package=SwaggerMcp&version=1.1.1
SwaggerMcp
Expose your ASP.NET Core API as an MCP (Model Context Protocol) server. Tag controller actions with [McpTool] or minimal APIs with .WithMcpTool(...); SwaggerMcp discovers them, builds JSON Schema for inputs, and exposes a single POST /mcp endpoint that speaks the MCP Streamable HTTP transport. Tool 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="SwaggerMcp" Version="1.0.2" />
Quick Start
1. Register and map
// Program.cs
builder.Services.AddSwaggerMcp(options =>
{
options.ServerName = "My API";
options.ServerVersion = "1.0.0";
});
// After UseRouting(), UseAuthorization()
app.MapSwaggerMcp(); // GET and POST /mcp
2. Tag controller actions
[HttpGet("{id}")]
[McpTool("get_order", Description = "Retrieves a single order by ID.")]
public ActionResult<Order> GetOrder(int id) { ... }
[HttpPost]
[McpTool("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" }))
.WithMcpTool("health_check", "Returns API health status.");
If you use both controllers and minimal APIs, add builder.Services.AddEndpointsApiExplorer(); and app.MapControllers(); so controller tools 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 |
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 |
Governance: Use [McpTool(..., Roles = new[] { "Admin" }, Policy = "RequireEditor")] or .WithMcpTool(..., roles: ..., policy: ...) to restrict which tools appear in tools/list per user.
Metrics: Implement IMcpMetricsSink and register it after AddSwaggerMcp() 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 | 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)
-
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.