McpNet.Gateway.Standalone 1.0.6

dotnet add package McpNet.Gateway.Standalone --version 1.0.6
                    
NuGet\Install-Package McpNet.Gateway.Standalone -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.Standalone" 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.Standalone" Version="1.0.6" />
                    
Directory.Packages.props
<PackageReference Include="McpNet.Gateway.Standalone" />
                    
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.Standalone --version 1.0.6
                    
#r "nuget: McpNet.Gateway.Standalone, 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.Standalone@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.Standalone&version=1.0.6
                    
Install as a Cake Addin
#tool nuget:?package=McpNet.Gateway.Standalone&version=1.0.6
                    
Install as a Cake Tool

McpNet.Gateway.Standalone

A self-contained MCP Gateway that can be embedded in any .NET 8 application with no ASP.NET Core dependency.

Uses System.Net.HttpListener - Kestrel and Microsoft.AspNetCore are not required.


Installation

<PackageReference Include="McpNet.Gateway.Standalone" Version="1.0.3" />

Quick Start

var gateway = McpGatewayBuilder.Create()
    .ListenOn(5050)
    .Build();

await gateway.StartAsync();

// ... your application runs ...

await gateway.StopAsync();
await gateway.DisposeAsync();

Configuration

Method Description Default
.ListenOn(port) TCP port to bind 5050
.WithPrefix(prefix) Full HttpListener prefix http://localhost:5050/
.WithDataDirectory(dir) Directory for JSON data files and encryption keys mcp-data
.WithMode(GatewayMode.Dev) Dev = no auth, Enterprise = token required Dev
.WithAdminToken(token) Admin token for the management API (Enterprise mode) (empty)
.WithMetaTools() Expose gateway management as MCP tools false

Binding all interfaces (Windows)

McpGatewayBuilder.Create()
    .WithPrefix("http://*:5050/")
    .Build();

On Windows, http://* requires: netsh http add urlacl url=http://*:5050/ user=Everyone On Linux, run as root or grant NET_BIND_SERVICE capability.

Enterprise mode

McpGatewayBuilder.Create()
    .ListenOn(5050)
    .WithMode(GatewayMode.Enterprise)
    .WithAdminToken("your-secret-token")
    .Build();

In Enterprise mode all /api/* requests require an X-Admin-Token header.


Endpoints

Endpoint Description
GET /health Health check ({"status":"ok"})
GET /dashboard Web management UI
GET /dashboard.js / .css Dashboard static assets
GET /catalog.json MCP server catalog
/mcp MCP protocol (Streamable HTTP / SSE)
GET /api/servers List registered servers
POST /api/servers Register a new server
GET /api/tools List all aggregated tools
POST /api/tools/refresh Refresh tools from all servers
GET /api/groups Tool groups
GET /api/clients Clients (Enterprise)
GET /api/audit Audit log
GET /api/export Export configuration
POST /api/import Import configuration
GET /api/catalog Merged catalog (built-in + custom entries)

Usage Scenarios

Embed in a WinForms / WPF app

// Form1.cs
private McpGatewayServer? _gateway;

protected override async void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    _gateway = McpGatewayBuilder.Create()
        .ListenOn(5050)
        .WithDataDirectory(Path.Combine(
            Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
            "MyApp", "mcp-data"))
        .Build();
    await _gateway.StartAsync();
}

protected override async void OnFormClosed(FormClosedEventArgs e)
{
    if (_gateway != null) await _gateway.DisposeAsync();
    base.OnFormClosed(e);
}

Console application

using var gateway = McpGatewayBuilder.Create()
    .ListenOn(5050)
    .Build();

await gateway.StartAsync();
Console.WriteLine("MCP Gateway ready -> http://localhost:5050/dashboard");

await Task.Delay(Timeout.Infinite, cancellationToken);

Graceful shutdown with CancellationToken

using var cts = new CancellationTokenSource();
Console.CancelKeyPress += (_, e) => { e.Cancel = true; cts.Cancel(); };

var gateway = McpGatewayBuilder.Create().ListenOn(5050).Build();
await gateway.StartAsync();

await Task.Delay(Timeout.Infinite, cts.Token).ContinueWith(_ => { });

await gateway.StopAsync();
await gateway.DisposeAsync();

Architecture

McpNet.Gateway.Standalone
|
+-- McpGatewayBuilder     -> Fluent configuration and DI setup
+-- McpGatewayServer      -> HttpListener accept loop, request dispatch
+-- McpGatewayOptions     -> Configuration values
|
+-- Dashboard/
|   +-- DashboardHandler  -> Serves /dashboard and static files
|
+-- Management/
|   +-- ManagementHandler -> Handles all /api/* management endpoints
|
+-- Security/
    +-- AesGcmSecretProtector -> AES-256-GCM secret encryption

Dependencies:
  McpNet.Gateway           -> Business logic, persistence, wwwroot resources
  McpNet.Transport.Http    -> MCP protocol over HttpListener
  Microsoft.Extensions.DependencyInjection 8.0.0

Data Files

All data is stored under DataDirectory (default: mcp-data/):

mcp-data/
  servers.json          <- Registered MCP servers
  groups.json           <- Tool groups
  clients.json          <- Clients (Enterprise)
  audit.json            <- Audit log entries
  custom-catalog.json   <- User-added catalog entries
  dp-keys/
    aes.key             <- AES-256 encryption key (auto-generated)

Comparison with McpNet.Host

McpNet.Host McpNet.Gateway.Standalone
HTTP engine Kestrel (ASP.NET Core) HttpListener (.NET built-in)
ASP.NET Core dependency Yes No
Deployment Server / Docker / IIS Desktop / embedded / NuGet package
HTTPS Via Kestrel Via HttpListener
Dashboard Yes Yes
MCP protocol Yes Yes

Both use the same business logic (McpNet.Gateway) and the same dashboard assets.

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

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
1.0.6 134 7/6/2026
1.0.5 118 6/26/2026
1.0.4 119 6/26/2026
1.0.3 115 6/22/2026
1.0.2 124 6/22/2026
1.0.1 116 6/22/2026
1.0.0 120 6/18/2026