Deploy a private Jitterbit MCP gateway and runtime with Docker
Introduction
A private MCP gateway and private MCP runtime let you host the components that process MCP traffic in your own infrastructure, instead of using the cloud-hosted MCP gateway and runtime. This guide walks through deploying both as Docker containers, registering the gateway, and verifying the deployment. It also covers running multiple gateway and runtime instances for high availability.
Jitterbit hosts and manages the MCP control plane, which your private gateway and runtime connect to.
Prerequisites
-
Docker, installed on the host (or hosts) that will run the containers.
-
A Redis instance that the gateway can reach. This guide runs Redis as a container (
redis:7.2) alongside the gateway. The gateway uses Redis to cache policies and, when you run multiple runtimes, to keep each MCP session on the runtime that created it. -
The Admin role permission, to register the gateway and create service tokens.
-
At least one environment to assign the private gateway to, with an MCP server published in it.
-
An MCP authentication token for the published MCP server, to test it. This token differs from the service tokens you create in this guide.
-
A public HTTPS endpoint, such as a load balancer, that forwards requests to the gateway container without altering the request path. The runtime and Redis don't need a public endpoint.
-
Outbound HTTPS access from both containers to your Jitterbit MCP control plane endpoint and to the execution-log collector endpoint, both listed for your region in the Jitterbit allowlist information. The collector receives the execution logs that the gateway and runtime send over HTTPS.
Register the gateway and create service tokens
-
On the Private MCP Gateways page, click Register gateway and configure the gateway's Name, Description, Gateway URL, Environments, and Status. In Environments, select each environment that the gateway serves. Set Gateway URL to the public HTTPS address of the gateway through your load balancer, including the
/mcppath, for examplehttps://gateway.example.com/mcp.Note
Your load balancer must preserve the
/mcppath. The control plane appends the MCP server ID when routing a request, producing a URL such ashttps://gateway.example.com/mcp/{server_id}. -
On the MCP Service Tokens page, create one token with Type set to Gateway for the gateway container, selecting an environment you assigned the gateway to in step 1. The token is linked to the gateway registered for that environment. If no gateway is registered for the environment, the page displays a validation message and doesn't save the token. Then create a separate token with Type set to Runtime for each runtime container. Save each token's value when it's displayed; a service token's value can't be retrieved again after creation. A token value starts with
mcp_. A token ID, which starts withmst_, can't authenticate the gateway or the runtime.
Create the container environment files
The gateway and runtime each read their settings from an environment file. These files contain service tokens, so create them with restricted permissions before you add the tokens. For example, on Linux or macOS, run the following commands from the directory where you will run the containers:
touch gateway.env runtime.env
chmod 600 gateway.env runtime.env
Add the following variables to the gateway's environment file, gateway.env:
GW_GATEWAY_MODE=private
GW_CONTROL_PLANE_URL=https://<control-plane-host>
GW_CONTROL_PLANE_MCP_TOKEN=<gateway-service-token-value>
GW_POLICY_CACHE_REDIS_URL=redis://mcp-redis:6379/1
GW_SESSION_AFFINITY_MODE=none
GW_RUNTIME_INSTANCES=http://mcp-runtime:9009
GW_EXECUTION_LOG_ENABLED=true
GW_EXECUTION_LOG_SINKS=json,http
GW_EXECUTION_LOG_COLLECTOR_URL=https://<execution-log-collector-host>/v1/execution-log-events/batch
GW_ANALYTICS_ENABLED=false
GW_ENABLE_CORS_MCP_INSPECTOR=false
Add the following variables to the runtime's environment file, runtime.env:
RT_SINGLE_TENANT=false
RT_CONTROL_PLANE_URL=https://<control-plane-host>
RT_CONTROL_PLANE_MCP_TOKEN=<runtime-service-token-value>
RT_EXECUTION_LOG_ENABLED=true
RT_EXECUTION_LOG_SINKS=json,http
RT_EXECUTION_LOG_COLLECTOR_URL=https://<execution-log-collector-host>/v1/execution-log-events/batch
RT_ANALYTICS_ENABLED=false
RT_ENABLE_CORS_MCP_INSPECTOR=false
Replace the <control-plane-host> and <execution-log-collector-host> placeholders with the endpoints for your region from the Jitterbit allowlist information, and the token placeholders with the service token values from the previous step. Each collector URL is the complete ingest URL, with one slash between the hostname and v1. The gateway and runtime use their service tokens to authenticate requests to the collector. Analytics are a separate stream from execution logs, and these examples disable them.
Set GW_EXECUTION_LOG_COLLECTOR_URL so that private gateway executions appear on the Logs page. Without it, the gateway writes execution logs only to the container's local log.
Warning
These files contain service tokens. Don't commit them to a repository or share them outside your organization.
Run a single gateway and runtime
Run the following commands on the Docker host, from the directory containing gateway.env and runtime.env:
docker network create mcp-private
docker run -d --name mcp-redis --network mcp-private --restart unless-stopped redis:7.2
docker run -d --name mcp-runtime --network mcp-private --restart unless-stopped --env-file runtime.env jitterbit/mcp-runtime:VERSION
docker run -d --name mcp-gateway --network mcp-private --restart unless-stopped --env-file gateway.env -p 6001:6001 jitterbit/mcp-gateway:VERSION
Replace VERSION with the image tag for your release. Use the same tag for the gateway and the runtime. To find the available tags, see the jitterbit/mcp-gateway and jitterbit/mcp-runtime tags pages on Docker Hub. The container names (mcp-redis, mcp-runtime, mcp-gateway) must match the hostnames used in gateway.env; the shared Docker network lets the gateway resolve them.
Configure your load balancer to terminate HTTPS and forward /mcp/{server_id} to the Docker host on port 6001, without stripping /mcp. Forward MCP request and session headers, and allow streaming responses. Restrict direct access to port 6001 to the load balancer.
Scale to multiple gateways and runtimes
To run multiple gateway and runtime instances for high availability:
-
Run additional runtime containers using the same
runtime.envfile, each with a unique container name (for example,mcp-runtimeandmcp-runtime02). -
In
gateway.env, replaceGW_SESSION_AFFINITY_MODEandGW_RUNTIME_INSTANCESwith:GW_SESSION_AFFINITY_MODE=redis GW_SESSION_AFFINITY_REDIS_URL=redis://mcp-redis:6379/2 GW_RUNTIME_INSTANCES=http://mcp-runtime:9009,http://mcp-runtime02:9009Shared Redis session affinity keeps each MCP session on the runtime that created it.
-
Run additional gateway containers using the same
gateway.envfile and the same gateway service token, each with a unique container name and host port (for example,mcp-gatewayon port6001andmcp-gateway02on port6002). All gateway replicas represent a single registered private gateway and serve all of its assigned environments. -
Configure your load balancer to target the Docker host's ports for each gateway replica, using
/healthfor target checks. Without active health checks, the load balancer keeps sending requests to a stopped gateway.
When a runtime becomes unhealthy, the gateway stops routing new requests to it and routes to the remaining healthy runtimes instead, resuming routing to it once it recovers. If every runtime is unhealthy, the gateway returns a 503 response. An MCP session already assigned to a runtime that becomes unhealthy fails rather than being silently reassigned to a different runtime, since its in-progress tool call may have already executed.
Run with Docker Compose
As an alternative to the docker run commands in Run a single gateway and runtime, use Docker Compose to start Redis, two runtimes, and two gateways together. Create compose.yaml in the same directory as gateway.env and runtime.env:
services:
mcp-redis:
image: redis:7.2
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
mcp-runtime:
image: jitterbit/mcp-runtime:VERSION
env_file: runtime.env
restart: unless-stopped
mcp-runtime02:
image: jitterbit/mcp-runtime:VERSION
env_file: runtime.env
restart: unless-stopped
mcp-gateway:
image: jitterbit/mcp-gateway:VERSION
env_file: gateway.env
ports:
- "6001:6001"
depends_on:
mcp-redis:
condition: service_healthy
mcp-runtime:
condition: service_started
mcp-runtime02:
condition: service_started
restart: unless-stopped
mcp-gateway02:
image: jitterbit/mcp-gateway:VERSION
env_file: gateway.env
ports:
- "6002:6001"
depends_on:
mcp-redis:
condition: service_healthy
mcp-runtime:
condition: service_started
mcp-runtime02:
condition: service_started
restart: unless-stopped
Replace VERSION with the image tag for your release, as described in Run a single gateway and runtime, and use the Redis affinity and runtime values from step 2 of Scale to multiple gateways and runtimes in gateway.env. Compose creates a shared network and resolves these service names automatically, so you don't need docker network create. Run the following command from the directory containing all three files:
docker compose up -d
docker compose ps
For the checks in Verify the deployment, replace docker logs with docker compose logs and docker exec mcp-runtime with docker compose exec mcp-runtime. If you change an env file, run docker compose up -d --force-recreate to apply the new values.
Verify the deployment
Check each container's health and readiness endpoints:
curl -fsS http://127.0.0.1:6001/health
curl -fsS http://127.0.0.1:6001/ready
docker exec mcp-runtime curl -fsS http://127.0.0.1:9009/health
docker exec mcp-runtime curl -fsS http://127.0.0.1:9009/ready
/health returns 200 once the container has started. /ready returns 200 only when the gateway has at least one healthy runtime available, and 503 otherwise.
Review the container logs for startup and connectivity issues:
docker logs --tail 100 mcp-gateway
docker logs --tail 100 mcp-runtime
On the Private MCP Gateways page, confirm the gateway's environment assignments are active. Then, on the Testing tab of an MCP server published to one of those environments, invoke a tool to confirm the request is routed through the private gateway and runtime.
Note
Activity processed through a private gateway or runtime doesn't currently appear on the Analytics page.
Upgrade the gateway and runtime
To upgrade to a new image version, recreate each container from the new image. Recreate the runtime containers first, then the gateway containers, so the gateway always has a reachable runtime to route to during the upgrade. In both procedures, replace VERSION with the image tag for the new release (see Run a single gateway and runtime for how to find tags), and leave the mcp-redis container running.
Upgrade containers started with docker run
-
Pull the new runtime image, remove the existing runtime container, and start it again from the new image:
docker pull jitterbit/mcp-runtime:VERSION docker rm -f mcp-runtime docker run -d --name mcp-runtime --network mcp-private --restart unless-stopped --env-file runtime.env jitterbit/mcp-runtime:VERSIONRepeat for each additional runtime container, using its own container name.
-
Pull the new gateway image, remove the existing gateway container, and start it again from the new image:
docker pull jitterbit/mcp-gateway:VERSION docker rm -f mcp-gateway docker run -d --name mcp-gateway --network mcp-private --restart unless-stopped --env-file gateway.env -p 6001:6001 jitterbit/mcp-gateway:VERSIONRepeat for each additional gateway container, using its own container name and host port.
Upgrade containers started with Docker Compose
-
In
compose.yaml, setVERSIONto the new image tag for everyjitterbit/mcp-runtimeandjitterbit/mcp-gatewayimage. -
Pull the new images and recreate the runtime containers, then the gateway containers:
docker compose pull docker compose up -d mcp-runtime mcp-runtime02 docker compose up -d mcp-gateway mcp-gateway02
Common problems
| Symptom | Possible cause | Resolution |
|---|---|---|
403 response naming an environment not assigned to the gateway |
The gateway's environment assignment isn't active, or the gateway service token isn't linked to this gateway. | Confirm the token's Gateway Name on the MCP Service Tokens page and the environment assignment on the Private MCP Gateways page. |
| Gateway container fails to start | The GW_RUNTIME_INSTANCES value doesn't match the session affinity mode. |
List exactly one runtime URL when GW_SESSION_AFFINITY_MODE=none, or multiple runtime URLs when using Redis session affinity. Each runtime URL is a base URL, so don't add /mcp to it. |
| Gateway can't reach Redis | The gateway and Redis containers don't share a Docker network, or the Redis URL uses the wrong name. | Confirm mcp-redis and the gateway containers share a Docker network, and that GW_POLICY_CACHE_REDIS_URL uses that network's service name for Redis. |
The execution-log collector returns 404 |
A collector URL is incomplete or has the wrong number of slashes. | Confirm that GW_EXECUTION_LOG_COLLECTOR_URL and RT_EXECUTION_LOG_COLLECTOR_URL end in /v1/execution-log-events/batch, with one slash between the hostname and v1. |
| Logs show analytics disabled messages | Analytics are disabled in the environment files. | No action is needed. These messages report skipped analytics events, and they don't stop MCP requests or execution-log delivery. |
Requests return 503 |
Every configured runtime is unhealthy. The gateway returns 503 only in this case. |
Confirm at least one runtime container is running and reachable from the gateway. |
The Testing tab shows a red Failed to execute the capability test. - HttpErrorResponse: MCP test gateway request failed message with a 503 status code |
The private gateway or its runtimes are unavailable. | Confirm the gateway containers are running. If you use a load balancer, confirm it has at least one healthy gateway to route to. Confirm at least one runtime container is running and reachable from the gateway. |
If you change an environment file passed to docker run --env-file, restarting the container doesn't apply the new values. Remove the container with docker rm -f <container-name>, then start it again with the same docker run command from Run a single gateway and runtime. If the gateway's public hostname changes, update Gateway URL on the Private MCP Gateways page.