McpNet.Gateway 1.0.6

dotnet add package McpNet.Gateway --version 1.0.6
                    
NuGet\Install-Package McpNet.Gateway -Version 1.0.6
                    
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="McpNet.Gateway" Version="1.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="McpNet.Gateway" Version="1.0.6" />
                    
Directory.Packages.props
<PackageReference Include="McpNet.Gateway" />
                    
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 McpNet.Gateway --version 1.0.6
                    
#r "nuget: McpNet.Gateway, 1.0.6"
                    
#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.
#:package McpNet.Gateway@1.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=McpNet.Gateway&version=1.0.6
                    
Install as a Cake Addin
#tool nuget:?package=McpNet.Gateway&version=1.0.6
                    
Install as a Cake Tool

McpNet.Gateway

Core business logic library for the MCP Gateway. Contains all domain services, persistence abstractions, authentication, tool aggregation, and upstream client management.

No HTTP dependency - usable from any host (ASP.NET Core, HttpListener, desktop apps).


Responsibilities

Area Classes
Upstream connections McpUpstreamClient, ServerRegistry, StdioCommandHelper, OAuthTokenProvider
Tool aggregation ToolAggregator, ToolGroupManager
Request routing GatewayRequestRouter
Authentication GatewayAuthenticator, GatewaySessionManager
Persistence abstractions IServerRepository, IToolGroupRepository, IClientRepository, IAuditLogRepository
JSON persistence JsonPersistenceExtensions, JsonRepositories
Dashboard resources GatewayDashboardResources, GatewayCatalogService
Security ISecretProtector, NullSecretProtector
Telemetry McpTelemetry
Models RegisteredServer, McpClient, ToolGroup, AuditLog, OAuthConfig

Dashboard Resources

Static files (dashboard.html, dashboard.css, dashboard.js, catalog.json) are embedded in this assembly. Any host can serve them without carrying its own copy:

// Read a file as bytes
byte[]? bytes = await GatewayDashboardResources.GetAsync("dashboard.html", ct);

// Read as text
string? text = await GatewayDashboardResources.GetTextAsync("catalog.json", ct);

// List all embedded files
IEnumerable<string> files = GatewayDashboardResources.ListFiles();

Catalog Service

var catalog = new GatewayCatalogService(dataDirectory);

// Get merged list (built-in curated + user custom entries)
List<object> entries = await catalog.GetMergedAsync(ct);

// Add a custom entry
await catalog.AddCustomAsync(myEntry, ct);

// Remove by name
await catalog.RemoveCustomAsync("custom-abc123", ct);

Custom entries are persisted to {dataDirectory}/custom-catalog.json.


Service Registration

// Register all gateway core services
builder.Services.AddMcpGateway(o =>
{
    o.AuthOptions.Mode       = GatewayMode.Dev;        // or Enterprise
    o.AuthOptions.AdminToken = "your-secret-token";
});

// Register JSON file persistence (zero-dependency)
builder.Services.AddMcpJsonPersistence(dataDirectory);

// Register catalog service
builder.Services.AddSingleton(new GatewayCatalogService(dataDirectory));

Authentication Modes

Mode Behavior
GatewayMode.Dev No authentication - all requests are accepted
GatewayMode.Enterprise /api/* requires X-Admin-Token header; MCP requires Authorization: Bearer <token>

Secret Protection

ISecretProtector is used to encrypt bearer tokens and env var values at rest:

public interface ISecretProtector
{
    string Protect(string plaintext);
    string Unprotect(string ciphertext);
}
  • NullSecretProtector - stores values in plain text (Dev mode)
  • AesGcmSecretProtector - AES-256-GCM (Standalone)
  • DataProtectionSecretProtector - ASP.NET Core Data Protection (Host)

Dependency Graph

McpNet.Gateway  (net8.0)
  └── McpNet.Core
  └── Microsoft.Extensions.DependencyInjection.Abstractions 8.0.2
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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 (2)

Showing the top 2 NuGet packages that depend on McpNet.Gateway:

Package Downloads
McpNet.Transport.Http

StreamableHTTP and SSE upstream transport for McpNet.Gateway. Provides HttpListenerMcpTransport for embedding the gateway without ASP.NET Core.

McpNet.Gateway.Standalone

Self-contained MCP Gateway using System.Net.HttpListener. No ASP.NET Core dependency - embed in any .NET 8 application. Call McpGatewayBuilder.Create().ListenOn(5050).Build() to start.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.6 187 7/6/2026
1.0.5 153 6/26/2026
1.0.4 149 6/26/2026
1.0.3 152 6/22/2026
1.0.2 164 6/22/2026
1.0.1 159 6/22/2026
1.0.0 155 6/18/2026