About MCP.Extensions
MCP.Extensions is an MCP server in the AI category: extensions and middleware for ModelContextProtocol in ASP.NET Core. It has been installed 0 times through Conduid.
Install
git clone https://github.com/echapmanFromBunnings/mcp.extensionsThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about MCP.Extensions
Powered by Claude · Grounded in docs
Security checks
- ·README presentNot checked yet.
- ·License declaredNot checked yet.
- ·Tests presentNot checked yet.
- ·Dependencies pinnedNot checked yet.
- ·No dynamic code executionNot checked yet.
- ·Scoped permissionsNot checked yet.
README
mcp.extensions
A collection of reusable .NET middleware, attributes, and services to extend and enhance ASP.NET Core applications working with the Model Context Protocol.
Built against ModelContextProtocol SDK v0.4.0-preview.3.
Features
-
Audience-Based Segmentation 🎯
McpAudienceAttribute: Declarative attribute for audience-based access control on MCP tools, resources, and prompts- Streaming Middleware: Real-time filtering of MCP responses based on client audience credentials
StreamingToolFilteringMiddleware: Filters tools in real-time based on audienceStreamingResourceFilteringMiddleware: Filters resources in real-time based on audienceStreamingPromptFilteringMiddleware: Filters prompts in real-time based on audience
IAudienceFilterService: Unified service for managing audience-to-resource mappings- 📖 Complete Guide: Comprehensive documentation on audience segmentation and streaming implementation
-
Logging Middleware
HeaderLoggingMiddleware: Logs HTTP request headers for diagnostics and auditingRequestBodyLoggingMiddleware: Logs incoming HTTP request bodies for debugging and traceabilityResponseBodyLoggingMiddleware: Logs outgoing HTTP response bodies for monitoring and troubleshooting
-
Legacy Services (Deprecated)
IToolAudienceService: Legacy interface for tool audience management (useIAudienceFilterServiceinstead)
Getting Started
Quick Start: Audience-Based Segmentation
The easiest way to enable audience-based filtering for your MCP server:
// 1. Register services and scan your assembly for MCP attributes
builder.Services.AddMcpAudienceFiltering(Assembly.GetExecutingAssembly());
// 2. Apply all filtering middlewares
app.UseMcpAudienceFiltering();
// 3. Decorate your MCP tools, resources, and prompts with audience restrictions
public class MyMcpTools
{
[McpServerTool("admin_tool")]
[McpAudience("ADMIN")]
public async Task<Result> AdminOnlyTool() { }
[McpServerTool("public_tool")]
[McpAudience("PUBLIC", "ADMIN")]
public async Task<Result> PublicTool() { }
}
Clients send their audience type via the X-AGENT-MODE header:
GET /mcp/tools
X-AGENT-MODE: ADMIN
📖 For a complete guide with examples, best practices, and technical details, see the McpAudienceAttribute and Streaming Implementation Guide
Advanced Usage
Logging Middleware:
app.UseMiddleware<HeaderLoggingMiddleware>();
app.UseMiddleware<RequestBodyLoggingMiddleware>();
app.UseMiddleware<ResponseBodyLoggingMiddleware>();
Contributing
Contributions are welcome! Please open issues or submit pull requests for new features, bug fixes, or improvements.
License
README mirrored from the source repository 4 months ago. The original is authoritative.