MCP.Extensions
0.0.1
dotnet add package MCP.Extensions --version 0.0.1
NuGet\Install-Package MCP.Extensions -Version 0.0.1
<PackageReference Include="MCP.Extensions" Version="0.0.1" />
<PackageVersion Include="MCP.Extensions" Version="0.0.1" />
<PackageReference Include="MCP.Extensions" />
paket add MCP.Extensions --version 0.0.1
#r "nuget: MCP.Extensions, 0.0.1"
#addin nuget:?package=MCP.Extensions&version=0.0.1
#tool nuget:?package=MCP.Extensions&version=0.0.1
MCP.Extensions
Extensions and middleware for ModelContextProtocol in ASP.NET Core.
Overview
This package provides useful middleware and extension methods for working with the ModelContextProtocol in ASP.NET Core applications. It is designed to help with request/response logging, audience filtering, and other common tasks when using ModelContextProtocol.
Features
- Middleware for logging HTTP headers, request bodies, and response bodies
- Middleware for filtering tools in responses and streams
- Attribute-based audience targeting
- Service abstractions for tool audience management
Installation
Install via NuGet Package Manager:
dotnet add package MCP.Extensions
Or via the NuGet UI in Visual Studio.
Usage
Add the desired middleware to your ASP.NET Core pipeline in Startup.cs
or Program.cs
:
// Debugging and logging middleware
app.UseMiddleware<HeaderLoggingMiddleware>();
app.UseMiddleware<RequestBodyLoggingMiddleware>();
app.UseMiddleware<ResponseBodyLoggingMiddleware>();
app.UseMiddleware<ResponseToolFilteringMiddleware>();
//Practical use case for filtering tools in streams
app.UseMiddleware<StreamToolFilteringMiddleware>();
Use the [McpAudience]
attribute to restrict the tools listing to specific audiences:
[McpAudience("admin")]
public IActionResult AdminOnlyAction() {
// ...
}
Requirements
- .NET 9.0 or later
- ModelContextProtocol
- ModelContextProtocol.AspNetCore
License
MIT
Repository
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
- ModelContextProtocol (>= 0.2.0-preview.3)
- ModelContextProtocol.AspNetCore (>= 0.2.0-preview.3)
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.1 | 66 | 6/20/2025 |
0.0.1-preview.15807198442 | 12 | 6/22/2025 |
0.0.1-preview.15779540861 | 62 | 6/20/2025 |
0.0.1-preview.15778048273 | 68 | 6/20/2025 |
0.0.1-preview.15777820444 | 66 | 6/20/2025 |