MCP.Extensions 0.0.1

dotnet add package MCP.Extensions --version 0.0.1
                    
NuGet\Install-Package MCP.Extensions -Version 0.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MCP.Extensions" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MCP.Extensions" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MCP.Extensions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MCP.Extensions --version 0.0.1
                    
#r "nuget: MCP.Extensions, 0.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=MCP.Extensions&version=0.0.1
                    
Install MCP.Extensions as a Cake Addin
#tool nuget:?package=MCP.Extensions&version=0.0.1
                    
Install MCP.Extensions as a Cake Tool

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

License

MIT

Repository

https://github.com/echapmanFromBunnings/mcp.extensions

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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