Deployment Guide¶

Deployment Guide¶

This guide covers practical ways to deploy the MCP-Fabric gateway and which topology to use for production-like canary testing. For the gateway process itself — entrypoint, env vars, ports, endpoints, security posture — see standalone-gateway.md.

The gateway runtime behavior is identical across all of these; only the process manager, networking, and session-registry backend change.

Topology summary¶

Deployment

Gateways

Session registry

Best for

Production-ready?

Local Docker (self-contained)

1

memory

Smoke tests, demos

Yes, for evaluation only

Single-host

1

file

Small/internal single-node deployments

Yes, single node

Externally managed / horizontal

2+

redis (shared)

Production-like canary, HA

Yes (Redis is the required shared backend)

1. Local Docker¶

Build and run the self-contained gateway (in-process demo applications, loopback only):

docker build -t mcp-fabric-gateway .
docker run --rm -p 127.0.0.1:3000:3000 \
  -e HOST=0.0.0.0 \
  -e MCP_GATEWAY_ALLOW_PUBLIC_BIND=true \
  -e MCP_GATEWAY_ENFORCE_STARTUP_SECURITY_AUDIT=false \
  mcp-fabric-gateway
curl -s http://127.0.0.1:3000/health | jq .

A container must bind 0.0.0.0 to be reachable through the published port, which the startup audit treats as public — hence the two opt-in flags. Publishing only to 127.0.0.1:3000 on the host keeps it off the network. This mode uses the non-durable memory registry and is for evaluation, not production traffic.

2. Single-host¶

Run one gateway with a durable file registry so placement survives restarts, fronting real backend MCP servers. Use a process manager (systemd, pm2) for restart-on-failure:

PORT=3000 HOST=127.0.0.1 \
MCP_GATEWAY_SESSION_REGISTRY_BACKEND=file \
MCP_GATEWAY_SESSION_REGISTRY_FILE=/var/lib/mcp-fabric/sessions.json \
SERVER_INSTANCES_JSON='[{"serverInstanceId":"srv-a","load":0.1,"healthy":true,"acceptingNewSessions":true}]' \
REMOTE_BASE_URLS_JSON='{"srv-a":"http://127.0.0.1:4101"}' \
npm run start:gateway

Put a TLS-terminating, authenticating reverse proxy (nginx, Caddy, a cloud LB) in front if the gateway must be reachable beyond loopback. The file registry is durable on one host but is not shared across hosts; do not run a second gateway against the same file.

3. Externally managed (horizontal / cloud)¶

Run two or more gateway replicas behind an external load balancer, all sharing a single Redis-backed session registry. This is the only topology that preserves sticky session affinity across multiple gateway processes (Redis fails closed on outage rather than splitting affinity into per-process memory).

Per-replica environment:

HOST=0.0.0.0 PORT=4400 \
MCP_GATEWAY_ALLOW_PUBLIC_BIND=true \
MCP_GATEWAY_ENFORCE_STARTUP_SECURITY_AUDIT=false \
MCP_GATEWAY_SESSION_REGISTRY_BACKEND=redis \
REDIS_URL=redis://<redis-host>:6379 \
MCP_GATEWAY_SESSION_REGISTRY_REDIS_KEY=mcp:gateway:sessions \
SERVER_INSTANCES_JSON='[...]' \
REMOTE_BASE_URLS_JSON='{...}' \
npm run start:gateway

Operational requirements for this topology:

  • All replicas share the same REDIS_URL and MCP_GATEWAY_SESSION_REGISTRY_REDIS_KEY.

  • The external LB terminates TLS and authenticates clients; the gateway has no built-in auth.

  • Health-check each replica’s GET /health; drain via the LB before stopping a replica.

  • Scrape/forward GET /observability counters into your monitoring stack.