ModelContextProtocol.AspNetCore 0.2.0-preview.1
ASP.NET Core extensions for the MCP C# SDK
The official C# SDK for the Model Context Protocol, enabling .NET applications, services, and libraries to implement and interact with MCP clients and servers. Please visit our API documentation for more details on available functionality.
[!NOTE] This project is in preview; breaking changes can be introduced without prior notice.
About MCP
The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). It enables secure integration between LLMs and various data sources and tools.
For more information about MCP:
Installation
To get started, install the package from NuGet
dotnet new web
dotnet add package ModelContextProtocol.AspNetCore --prerelease
Getting Started
// Program.cs
using ModelContextProtocol.Server;
using System.ComponentModel;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMcpServer()
.WithHttpTransport()
.WithToolsFromAssembly();
var app = builder.Build();
app.MapMcp();
app.Run("http://localhost:3001");
[McpServerToolType]
public static class EchoTool
{
[McpServerTool, Description("Echoes the message back to the client.")]
public static string Echo(string message) => $"hello {message}";
}
No packages depend on ModelContextProtocol.AspNetCore.
.NET 8.0
- ModelContextProtocol (>= 0.2.0-preview.1)
.NET 9.0
- ModelContextProtocol (>= 0.2.0-preview.1)
Version | Downloads | Last updated |
---|---|---|
0.2.0-preview.1 | 4 | 05/18/2025 |
0.1.0-preview.14 | 4 | 05/19/2025 |
0.1.0-preview.13 | 4 | 05/11/2025 |
0.1.0-preview.12 | 5 | 05/08/2025 |
0.1.0-preview.11 | 4 | 05/12/2025 |
0.1.0-preview.10 | 4 | 05/12/2025 |
0.1.0-preview.9 | 4 | 05/12/2025 |
0.1.0-preview.8 | 4 | 05/12/2025 |
0.1.0-preview.7 | 4 | 05/12/2025 |
0.1.0-preview.6 | 4 | 05/12/2025 |
0.1.0-preview.5 | 4 | 05/12/2025 |
0.1.0-preview.4 | 4 | 05/12/2025 |