MCP Gateway
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Gateway
A FastMCP 2.x-based gateway that aggregates multiple
upstream Model Context Protocol servers
(stdio, streamable-http, sse, websocket) behind a single streamable-HTTP
endpoint. Upstream servers are configured declaratively in
config/mcpServers.json, with per-server namespacing, tool/resource/prompt
filtering, read-only enforcement, environment-variable interpolation, and
automatic reload on config changes.
Architecture
gateway/
├── main.py # entrypoint: builds & serves the gateway, wires reload
├── config.py # GatewayConfig, loaded from environment variables
├── loader.py # mcpServers.json parsing, env interpolation, validation
├── proxy.py # builds the aggregated FastMCP server (mount per upstream)
├── namespace.py # per-server middleware: toolFilter/resourceFilter/promptFilter, readOnly
├── reconnect.py # retry-with-backoff helper used for upstream connectivity probes
├── reload.py # watchdog-based watcher for mcpServers.json
├── health.py # /health, /healthz, /metrics routes
├── logging.py # logging setup
└── transports/
├── stdio.py # spawns local processes (npx, uvx, ...)
├── streamable_http.py # streamable-HTTP upstream client transport
├── sse.py # SSE upstream client transport
└── websocket.py # WebSocket upstream client transport (custom, mcp SDK based)Each enabled upstream server becomes a FastMCP proxy sub-server
(FastMCPProxy with an explicit client_factory that builds a fresh
transport per call, for concurrent-request isolation), gets a
ServerFilterMiddleware attached
(enforcing readOnly / toolFilter / resourceFilter / promptFilter), and
is mounted onto the main gateway server with namespace=<namespace> when
prefixTools is enabled. Tool/resource/prompt names are then automatically
namespaced by FastMCP as {namespace}_{name}.
Related MCP server: MCPDog
Configuration
config/mcpServers.json
{
"mcpServers": {
"filesystem": {
"type": "stdio",
"enabled": true,
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "${FS_ROOT:-/data}"],
"env": {},
"namespace": "fs",
"readOnly": false,
"prefixTools": true,
"toolFilter": ["*"],
"resourceFilter": ["*"],
"promptFilter": ["*"],
"timeout": 30
}
}
}Field reference per server entry:
Field | Type | Description |
|
| Upstream transport kind |
| bool | If |
| string | Required for |
| - | Required for |
| object | Extra HTTP headers for |
| string | Prefix used for this server's tools/resources/prompts; defaults to the server's key |
| bool | If |
| bool | If |
| list of glob patterns |
|
| number | Per-call timeout (seconds) for the upstream connection probe |
Any string value in the file supports ${VAR} / ${VAR:-default}
interpolation, resolved against the process environment (.env +
docker-compose.yml environment:). An unresolved variable without a
default raises a configuration error for enabled servers; disabled server
entries with unresolved variables are tolerated (logged as a warning).
Environment variables (.env / docker-compose.yml)
Variable | Default | Description |
|
| Bind address ( |
|
| Bind port |
|
| HTTP path for the MCP streamable-HTTP endpoint |
|
| Watch |
|
| Enable |
|
| Enable |
|
|
|
|
| Default for |
|
| Path to the servers config file |
Running locally
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
cp .env .env.local # adjust as needed
export $(grep -v '^#' .env.local | xargs)
python -m gateway.mainThe gateway will be reachable at http://localhost:5555/mcp, with
http://localhost:5555/health and http://localhost:5555/metrics alongside it.
stdio upstream servers
stdio servers (npx, uvx, ...) are spawned as subprocesses inside the
gateway process/container — no separate container or network hop is needed.
Make sure node/npx and/or uv/uvx are available in the runtime
environment (the provided Dockerfile installs both).
Docker Compose
docker compose up -d --buildThis starts only the gateway service, on the mcp Docker network, mounting
./config read-only and loading ./.env. To use the published image instead
of building locally:
docker pull ghcr.io/cociweb/mcp-gateway:latest
docker compose up -dReload behavior
When GATEWAY_RELOAD=true, a watchdog observer watches the directory
containing mcpServers.json. On any change to that file, the gateway
gracefully restarts itself in-place (os.execv) to rebuild the full mounted
server tree (reconnect upstreams, reapply filters/prefixes). Streamable-HTTP
clients are expected to reconnect automatically on disconnect.
Health & metrics
GET /health— JSON status, per-server connectivity and config summary.GET /healthz— plain-textokliveness probe.GET /metrics— Prometheus-style text exposition (uptime, enabled/connected server counts, per-server connectivity gauge).
Development / testing
pip install -e ".[dev]"
pytest -qtests/test_proxy_integration.py spins up a real npx-based MCP filesystem
server and is skipped automatically if npx is not available.
CI / GHCR
.github/workflows/ghcr.yml builds a multi-platform (linux/amd64,
linux/arm64) image and pushes it to ghcr.io/cociweb/mcp-gateway on pushes
to main and on version tags.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Streamable HTTP MCP gateway for NV oOS fleets — one API key, namespaced tools, quotas and policy.
Stateless MCP gateway and OTel span-streaming bridge for hosted MCP servers.
Host any HTTP API as a standard MCP server; auto-distribute to 12+ mainstream agent platforms.
Streamable HTTP MCP server exposing planner flows, tasks, and squads.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceAggregates multiple MCP backend servers behind a single HTTP/SSE endpoint, exposing all tools and resources with name-prefixed routing, hot reload, and structured request logging.MIT
- AlicenseNot gradedqualityBmaintenanceAggregates multiple MCP sub-servers into a single unified entry point, supporting stdio and Streamable HTTP protocols, with a web-based management interface for configuration, routing, and tool management.17 npm1MIT
- AlicenseNot gradedqualityAmaintenanceAggregates multiple backend MCP servers (Stdio, SSE, and Streamable HTTP) into a single unified endpoint, exposing their combined tools and resources via SSE, Streamable HTTP, or Stdio. It also offers an optional web admin UI for managing server connections, tool enablement, and live configuration reloads.120 npmMIT
- AlicenseNot gradedqualityAmaintenanceAggregates multiple backend MCP resource servers (Stdio, SSE, and Streamable HTTP) into a single unified endpoint exposed over SSE, Streamable HTTP, or Stdio. Enables routing of tool calls, resource access, and per-tool enable/disable or rename overrides through an optional web admin UI with configurable API key or bearer-token authentication.120 npmMIT