This guide details the features of the MCP Router.
The MCP Router supports four methods to manage backend Model Context Protocol (MCP) servers:
Manage servers dynamically without restarting the gateway:
- Open the router dashboard in a browser.
- Click + Add Server (top right).
- Complete the Add MCP Server modal:
- Display Name: User-friendly label (e.g.,
Home Assistant). - URL: Backend SSE endpoint or HTTP server (e.g.,
http://ha-mcp:8086/mcp). - Transport Type: Select
sse(stateful) orhttp(stateless). - Category: Classify the server (e.g.,
homecontrol,infrastructure,development). - API Token/Key: Downstream credentials.
- Secret Provider: Secret retrieval method (
None,Vault,WindowsRegistry, orEnvironment). See Pluggable Secret Retrievers.
- Display Name: User-friendly label (e.g.,
- Click Save Server. The router registers the server and initializes connections.
For declarative configurations:
- Create
custom_servers.jsonin the/app/data/directory. - Use this structure:
[ { "id": "my-mcp-server", "displayName": "My Custom Server", "url": "http://10.0.0.15:3000/sse", "type": "sse", "category": "infrastructure", "enabled": true, "hidden": false, "apiKey": "optional-bearer-or-api-key", "headersJson": "{\"Custom-Header-Name\": \"Header-Value\"}" } ] - The gateway processes matching entries in the database during startup.
The gateway auto-seeds common services on first run if environment variables exist (e.g., HOMEASSISTANT_TOKEN, PLEX_TOKEN, SEERR_API_KEY). Refer to Program.cs.
If the router accesses the Docker daemon (/var/run/docker.sock), it dynamically registers backend containers labeled mcp.enabled=true.
services:
my-service-mcp:
image: ghcr.io/org/my-service-mcp:latest
container_name: my-service-mcp
restart: unless-stopped
networks:
- net_mcp
labels:
- mcp.enabled=true
- mcp.id=myservice
- mcp.displayName=My Custom Service
- mcp.port=8080
- mcp.type=sse
- mcp.path=/sse
- mcp.categories=infrastructure,custom| Label | Required | Default | Description |
|---|---|---|---|
mcp.enabled |
Yes | false |
Enables router auto-discovery. Must be "true". |
mcp.id |
Yes | — | Unique server identifier (e.g., /myservice). |
mcp.port |
Yes | — | Internal container port (e.g., 8080, 3000). |
mcp.displayName |
No | Value of mcp.id |
Friendly name for dashboard and tools. |
mcp.type |
No | sse |
Transport type (sse, http, or stdio). |
mcp.path |
No | /sse (or /mcp) |
Message dispatch path. |
mcp.categories |
No | general |
Comma-separated categories for RBAC. |
mcp.authType |
No | none |
Authentication header format (bearer, x-api-key, custom-header). |
mcp.secretProvider |
No | none |
Secret retriever backend (vault, env, none). |
mcp.secretKey |
No | — | Vault path or environment variable for the API key. |
Connect clients via these SSE endpoints:
| Route Path | Mode | Description |
|---|---|---|
/sse or /sse?meta=true |
Meta-Mode (Default) | Hides backend tools during bootstrap; exposes only search_tools and execute_tool. Conserves context window. |
/sse?meta=false |
Full-List Mode | Exposes all underlying tools from all connected servers. |
/{targetServerId} |
Target-Specific Proxying | Proxies connections directly to the specified target server (e.g., /docker or /ha). |
/admin or /router-admin |
Admin MCP Server | Virtual in-process control plane providing 10 consolidated entity tools for autonomous agents to manage router state. |
For transport protocol comparisons (
sse,http,stdio), concurrency, security policies, and error recovery, see Transport Capability & Configuration Guide.
{
"mcpServers": {
"mcp-router-meta": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/client-sse", "http://localhost:8026/sse"]
}
}
}{
"mcpServers": {
"mcp-router": {
"url": "http://localhost:8026/sse",
"type": "sse",
"trust": true,
"serverUrl": "http://localhost:8026/sse"
}
}
}The Admin MCP Server (/admin, /admin/sse, /router-admin) is an in-process virtual MCP server exposing 10 consolidated tools enabling autonomous AI agents (Claude Desktop, Cursor, Cline, Windsurf, Antigravity) to configure and administer the entire gateway programmatically.
| Tool Name | Actions | Description | Key Parameters |
|---|---|---|---|
manage_servers |
list, get, create, update, delete, toggle, reconnect, reconnect_all |
Manage backend MCP server registrations, URLs, transports, categories, and secret providers. | action, id, name, url, type, category, enabled, secret_provider, secret_key |
manage_appkeys |
list, get_limits, create, revoke |
Issue and revoke API AppKeys, enforce key quotas, expiration, and configure capability scopes. | action, name, scopes, expires_in_days, prefix |
manage_clients |
list, register, delete |
Manage dynamic OAuth 2.0 client registrations. | action, client_id, client_name, redirect_uris, grant_types, scopes |
manage_policies |
list, save, delete |
Manage role-based access control (RBAC) authorization policies across servers and categories. | action, policy_id, role_name, server_id, category, allowed, priority |
manage_group_mappings |
list, save, delete |
Map external Active Directory SIDs or OIDC SSO groups to internal security roles. | action, id, source_type, external_identifier, role_name, priority |
manage_providers |
list, save_secret, test_vault, save_auth, test_ldap |
Configure and verify HashiCorp Vault, Windows Registry DPAPI, Env, Active Directory LDAP, and OIDC providers. | action, provider_type, vault_address, vault_token, ldap_server, bind_dn |
manage_settings |
get, update |
Update dashboard UI branding (title, icon, accents) and semantic vector embedding providers/models. | action, dashboard_title, dashboard_icon, embedding_provider, embedding_model |
manage_custom_files |
list, get, save, delete |
Manage declarative prompt templates and resource files in persistent storage (/app/data/). |
action, file_type (prompts or resources), filename, content |
manage_system |
diagnostics, get_logs, clear_logs, query_audit |
Retrieve server diagnostics, inspect/clear in-memory gateway logs, and query persistent audit log entries. | action, limit, level, category, source_user, start_date, end_date |
test_tool_call |
execute |
Execute and test capabilities against downstream MCP servers via the testbench engine. | action, server_id, tool_name, arguments |
{
"mcpServers": {
"mcp-router-admin": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/client-sse", "http://localhost:8026/admin"]
}
}
}{
"mcpServers": {
"mcp-router-admin": {
"url": "http://localhost:8026/admin",
"headers": {
"Authorization": "Bearer mcp-admin-key-here"
}
}
}
}{
"mcpServers": {
"mcp-router-admin": {
"url": "http://localhost:8026/admin",
"type": "sse",
"trust": true,
"serverUrl": "http://localhost:8026/admin"
}
}
}In Meta-Mode, clients must semantically search for tools before execution.
- Tool Inquiry: Client calls
search_tools(query: "restart actual budget container"). - Hybrid Scoring Engine:
- Computes semantic similarity of tools using a Local ONNX model (
all-MiniLM-L6-v2) or LiteLLM/OpenAI APIs. - Applies Keyword Boosting (exact phrase match: +2.0 weight; individual words: +1.0/+0.5 weight).
- Computes semantic similarity of tools using a Local ONNX model (
- Execution Routing: Client executes returned namespaced tools (e.g.,
docker__restart_container) viaexecute_tool.
Configure via the Settings panel:
- Local ONNX (In-Process): Offline execution via
Microsoft.ML.OnnxRuntime. Downloads weights on first run to/app/data/. - OpenAI API / LiteLLM Provider: Uses remote models. Credentials are encrypted in the database via SQLite SQLCipher.
The MCP Router implements a Unified Authorization Pipeline across MCP capabilities:
- Tools:
tools/list,tools/call - Prompts:
prompts/list,prompts/get - Resources:
resources/list,resources/read,resources/templates/list - Completions:
completion/complete
All requests undergo this pipeline:
- AppKey Scope Validation: Validates scopes (
*,all,server:{id},tool:{id},prompt:{id},resource:{id},resource_template:{id},completion:{id}). - Admin SID Bypass: Checks caller SIDs against
Admin:GroupSid(e.g.,S-1-5-32-544). - Database Access Policies: Evaluates allows and denies in
AccessPoliciesandsp_EvaluateUserAccessagainst mapped groups/SIDs. - Discovery Filtering: Automatically omits unauthorized items from list endpoints.
- Fail-Closed Default: Unknown capabilities or targets return audited 403 errors without data leakage.
- Active Directory (Kerberos/NTLM): Resolves caller identities via AD SIDs (
WindowsIdentity). - OIDC Header Proxy: Extracts SSO headers (e.g.,
Remote-User,Remote-Groups) from reverse proxies.
External groups map to internal groups via the GroupMappings table (Settings -> Identity & Auth):
- Create Mapping: Map an AD SID or OIDC group to an internal security group (
admin,operator,readonly). - Evaluate Access: Capability invocation triggers access evaluation against the user's mapped groups.
The router supports a hybrid administrative security model:
- Enterprise Mode (with Active Directory / OIDC):
- Evaluates caller groups against
Admin:GroupSid(e.g.S-1-5-32-544),Admin:Groups(e.g.["full_admin", "Administrator"]), or dynamicGroupMappings. - Admin AppKeys with
alloradminscopes owned by an administrator are authorized asAdministrator.
- Evaluates caller groups against
- Standalone Mode (No External IDP Configured):
- When no external IDP is active, administrative endpoints (
/admin,/api/servers, etc.) permit requests originating from configured networks (Admin:StandaloneAllowedNetworks). - Default allowed networks: Loopback (
127.0.0.1,::1). - Configurable in
appsettings.jsonor environment variables for LAN subnets (e.g.,10.0.0.0/8,192.168.1.0/24) or0.0.0.0/0for centralized self-hosted setups:Or environment variables:{ "Admin": { "StandaloneAllowedNetworks": [ "127.0.0.1", "::1", "192.168.1.0/24" ] } }ADMIN__STANDALONE_ALLOWED_NETWORKS__0="127.0.0.1"ADMIN__STANDALONE_ALLOWED_NETWORKS__1="192.168.1.0/24" - Callers from non-whitelisted remote networks must present an AppKey with administrative credentials.
- When no external IDP is active, administrative endpoints (
The router issues fine-grained AppKeys and Client credentials:
- Scope Granularity:
all/*/mcp_client: Full access to all backend servers.server:<serverId>/<serverId>: Full access to a specific backend.category:<name>/group:<name>: Dynamic access to capabilities of all servers in the specified category.tool:<name>,prompt:<name>,resource:<uri>: Pinpoint access to specific capabilities.
- Dynamic Membership: Category scopes evaluate server memberships in real time. Changes to server categories apply instantly.
- Creation Validation: Category scopes are validated against registered categories during credential creation. Unknown categories yield a 400 Bad Request unless admin-provisioned.
For detailed rules and pipelines, see the AppKey Scopes & Authorization Guide.
By default, the gateway restricts CORS to local development origins (http://localhost:3000, http://localhost:5000, https://localhost:5001).
For production, configure allowed origins via the CORS_ALLOWED_ORIGINS (or AllowedOrigins) environment variable/setting:
CORS_ALLOWED_ORIGINS: Delimited list of allowed URLs (e.g.,https://my-mcp-dashboard.internal, https://cursor-plugin.internal).
The router dynamically fetches downstream API keys and passwords via pluggable retrievers to prevent plaintext storage in the database.
The CompositeSecretRetriever resolves secrets from:
- HashiCorp Vault (KV v2): Fetches secrets via path configurations (e.g.,
/secret/data/mcp/plex) with AppRole/Token auth and JIT token renewal. - Windows Registry (DPAPI): Retrieves DPAPI-secured strings from registry hives (
HKLM). - Environment Variables: Resolves secrets bound as container environment variables (
env:MY_SECRET).
Tip
For configuration recipes, AppRole policies, and AES-256-GCM encryption architecture, see docs/secret-providers.md.
- Register the secret in your store (e.g., environment variable
DOCKER_API_KEY=my-secret). - In the Add/Edit Server modal, select
Environmentfor Secret Provider and enterDOCKER_API_KEYunder SecretItemKey. - The gateway fetches, decrypts, and caches the token (
IMemoryCachewith rolling TTL) at execution time.
The Web Dashboard includes a developer environment to debug and verify setups:
- Interactive Form Builder: Generates forms matching the JSON schemas of registered backend tools.
- Logs Console: Thread-safe, real-time console displaying JSON-RPC traffic, request IDs, and security classifications.
- Search Simulator: Evaluation panel to test queries against the semantic search engine and inspect scores.
- Manual Approval Modal: Pauses dangerous tool executions pending administrator approval via the UI.
For SQLite, MS SQL Server, and MySQL dialect specifications, the 12-table Entity-Relationship Diagram (ERD), stored procedure catalogs, AES-256-GCM envelope encryption, and Docker Compose configurations, see the Database Provider Support & Deployment Matrix.
For requirements traceability, feature proofs, guardrails, and verified invariants across test suites, reference:
- Software Requirements Specification (SRS) & Test Verification Catalog
- Test Catalog & Annotation Developer Guide
The mcp-router-setup skill adheres to the AgentSkills.io open standard, enabling any AI coding or operations assistant (Antigravity, Claude Code, Cursor, Cline, Windsurf, Copilot CLI) to guide administrators through installing, configuring, and bootstrapping CSharp-MCP-Router in any workspace without cloning or compiling the repository source code.
To install the skill into any project or workspace directory:
mkdir -p .agents/skills/mcp-router-setup && curl -fsSL https://raw.githubusercontent.com/spelech/csharp-mcp-router/main/skills/mcp-router-setup/SKILL.md -o .agents/skills/mcp-router-setup/SKILL.mdWhen invoked (e.g. "Set up MCP router for my environment"), the skill executes a structured 6-phase workflow:
- Automated Environment Probing: Probes the host OS, Docker daemon socket (
/var/run/docker.sock), HashiCorp Vault (VAULT_ADDR), and Active Directory domain context (USERDNSDOMAIN) before asking the user for configuration details. - Hosting Platform Selection: Guides deployment to Docker Container / Docker Compose (Linux, macOS, WSL2, Home-Lab) or Windows Server IIS / Windows Service (with in-process ANCM and DPAPI).
- Configuration Paradigm: Explains and helps choose between Environment Variables (immutable, 12-factor
.env) and Web UI & Database (dynamic zero-downtime hot reloading & Admin MCP server). - Identity & Network Topology:
- Standalone / Home-Lab Mode: Configures SQLite database (
data/mcp_router.db) and loopback/LAN CIDR subnet authorization (Admin:StandaloneAllowedNetworks). - Enterprise Mode: Configures Active Directory LDAP or OIDC forward-auth reverse proxies (Authentik, PocketID, Authelia, Keycloak) with MSSQL, MySQL, or Vault KV v2.
- Standalone / Home-Lab Mode: Configures SQLite database (
- Artifact Generation & Secret Scaffolding:
- Generates cryptographically secure 256-bit
ROUTER_MASTER_KEY(openssl rand -base64 32or PowerShell crypto RNG). - Generates production
docker-compose.yml,web.configwith unbuffered SSE (responseBufferLimit="0"),.env, andappsettings.Production.json.
- Generates cryptographically secure 256-bit
- Health Verification & Client Integration:
- Verifies gateway reachability (
GET /healthandGET /sse). - Outputs ready-to-copy client JSON configurations for Claude Desktop, Cursor, Cline, and Windsurf for both the Meta-Mode Gateway (
/sse) and Admin MCP Server (/admin).
- Verifies gateway reachability (
The skill includes pre-tested scaffold templates under skills/mcp-router-setup/templates/:
docker-compose.yml: Production container deployment with SQLite volume mount and Docker socket pass-through.web.config: IIS ASP.NET Core In-Process module configuration with unbuffered SSE streaming..env.example: Standardized environment variable template with master key, provider, and network settings.appsettings.Production.json.example: Production ASP.NET Core configuration snippet.

