MCPify 0.0.7
See the version list below for details.
dotnet add package MCPify --version 0.0.7
NuGet\Install-Package MCPify -Version 0.0.7
<PackageReference Include="MCPify" Version="0.0.7" />
<PackageVersion Include="MCPify" Version="0.0.7" />
<PackageReference Include="MCPify" />
paket add MCPify --version 0.0.7
#r "nuget: MCPify, 0.0.7"
#:package MCPify@0.0.7
#addin nuget:?package=MCPify&version=0.0.7
#tool nuget:?package=MCPify&version=0.0.7
MCPify
MCPify is a .NET library that bridges the gap between your existing ASP.NET Core APIs (or external OpenAPI/Swagger specs) and the Model Context Protocol (MCP). It allows you to expose API operations as MCP tools that can be consumed by AI assistants like Claude Desktop, ensuring seamless integration with your existing services.
Features
- Automatic Tool Generation: Dynamically converts OpenAPI (Swagger) v2/v3 definitions into MCP tools.
- Hybrid Support: Expose your local ASP.NET Core endpoints and external public APIs simultaneously.
- Seamless Authentication: Built-in support for OAuth 2.0 Authorization Code Flow with PKCE.
- Includes a
login_auth_code_pkcetool that handles the browser-based login flow automatically. - Securely stores tokens per session using encrypted local storage.
- Automatically refreshes tokens when they expire.
- Includes a
- Dual Transport: Supports both
Stdio(for local desktop apps like Claude) andHttp(SSE) transports. - Production Ready: Robust logging, error handling, and configurable options.
Quick Start
1. Installation
Install the package into your ASP.NET Core project:
dotnet add package MCPify
2. Configuration
Add MCPify to your Program.cs:
using MCPify.Hosting;
var builder = WebApplication.CreateBuilder(args);
// ... Add other services ...
// 1. Add MCPify services
builder.Services.AddMcpify(options =>
{
// Choose Transport (Stdio for local tools, Http for remote)
options.Transport = McpTransportType.Stdio;
// Option A: Expose Local Endpoints
options.LocalEndpoints = new LocalEndpointsOptions
{
Enabled = true,
ToolPrefix = "myapp_",
// Optional: Filter which endpoints to expose
Filter = op => op.Route.StartsWith("/api")
};
// Option B: Expose External APIs via Swagger
options.ExternalApis.Add(new ExternalApiOptions
{
ApiBaseUrl = "https://petstore.swagger.io/v2",
OpenApiUrl = "https://petstore.swagger.io/v2/swagger.json",
ToolPrefix = "petstore_"
});
});
var app = builder.Build();
// 2. Add Middleware
app.UseMcpifyContext();
app.UseMcpifyOAuth(); // If using Authentication
// ... Map your endpoints ...
// 3. Map the MCP endpoint (required for Http transport, optional for Stdio)
app.MapMcpifyEndpoint();
app.Run();
3. Usage with Claude Desktop
To use your MCPify app with Claude Desktop, edit your config file (%APPDATA%\Claude\claude_desktop_config.json on Windows or ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"my-app": {
"command": "dotnet",
"args": [
"run",
"--project",
"/absolute/path/to/YourProject.csproj",
"--",
"--Mcpify:Transport=Stdio"
]
}
}
}
Note: When using
dotnet run, ensure your application does not print build logs to stdout, as this corrupts the MCP JSON-RPC protocol. You can suppress logs or publish your app as a single-file executable for a cleaner setup.
Authentication
MCPify provides a first-class experience for APIs secured with OAuth 2.0.
Enabling OAuth
Register the authentication provider in your Program.cs:
services.AddScoped<OAuthAuthorizationCodeAuthentication>(sp => {
return new OAuthAuthorizationCodeAuthentication(
clientId: "your-client-id",
authorizationEndpoint: "https://auth.example.com/authorize",
tokenEndpoint: "https://auth.example.com/token",
scope: "api_access",
secureTokenStore: sp.GetRequiredService<ISecureTokenStore>(),
mcpContextAccessor: sp.GetRequiredService<IMcpContextAccessor>(),
redirectUri: "http://localhost:5000/auth/callback" // Your app must handle this
);
});
// Register the Login Tool
services.AddLoginTool(sp => new LoginTool());
The Login Flow
- The user asks Claude: "Please login" or uses a tool that requires auth.
- Claude calls the
login_auth_code_pkcetool. - MCPify automatically opens the system browser to the login page.
- The user logs in and approves the request.
- The browser redirects back to your application (e.g.,
/auth/callback). - Your app saves the token and displays a success message.
- The
login_auth_code_pkcetool detects the successful login and reports back to Claude. - Claude can now invoke authenticated tools!
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
MIT
| 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 was computed. 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. |
-
net9.0
- Microsoft.OpenApi.Readers (>= 1.6.28)
- ModelContextProtocol (>= 0.5.0-preview.1)
- ModelContextProtocol.AspNetCore (>= 0.5.0-preview.1)
- System.Security.Cryptography.ProtectedData (>= 8.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.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.8-preview | 0 | 12/26/2025 |
| 0.0.7 | 66 | 12/23/2025 |
| 0.0.7-preview | 70 | 12/20/2025 |
| 0.0.6-preview | 109 | 12/13/2025 |
| 0.0.5-preview | 156 | 12/7/2025 |
| 0.0.4 | 621 | 12/3/2025 |
| 0.0.4-preview | 608 | 12/2/2025 |
| 0.0.3 | 613 | 12/3/2025 |
| 0.0.3-preview | 129 | 11/24/2025 |
| 0.0.2 | 614 | 12/2/2025 |
| 0.0.2-preview | 106 | 11/23/2025 |
| 0.0.1 | 112 | 11/23/2025 |
| 0.0.1-preview | 100 | 11/23/2025 |