Skip to main content

Server Runtime

How the MCP Gateway hosts and executes MCP servers on-demand with hardware-backed isolation.

On-demand execution

MCP servers are not always running. When you enable a server and call one of its tools, the gateway:

  1. Pulls the server package from its registry (npm, PyPI, Docker, or Git)
  2. Starts the server in an isolated container
  3. Routes your tool call to the running server
  4. Returns the result with an execution proof
  5. The server stays warm for subsequent calls, then shuts down after inactivity

Package caching ensures fast cold starts — the gateway pre-caches packages from all registries.

Container sandbox

Each MCP server runs in an isolated Docker container with multiple hardening layers:

PropertySetting
Root filesystemRead-only (--read-only)
/tmpMounted as noexec
CapabilitiesAll dropped (--cap-drop=ALL)
PrivilegesNo new privileges (--security-opt=no-new-privileges)
UserNon-root inside container
NetworkRestricted to specific upstream services
RuntimeOptional gVisor for syscall filtering

Secrets in containers

Server secrets (API keys you've stored) are:

  • Injected as environment variables (never written to the container filesystem)
  • Redacted from all error paths by the MCP bridge process
  • Recorded by name (not value) in execution proofs for audit

Package registries

The gateway supports servers from multiple registries:

RegistryPackage formatExample
npmNode.js packages@anthropic/brave-search-mcp-server
PyPIPython packagesarxiv-mcp-server
DockerContainer imagesghcr.io/owner/mcp-server
GitGit repositorieshttps://github.com/owner/mcp-server

Verification tiers

Servers go through tiered verification:

TierMeaning
tools_listedServer started and tools were listed successfully
tool_smoke_passedAt least one safe runtime tool probe executed successfully

Continuous discovery runs periodically to refresh marketplace data and improve coverage.

Per-server endpoints

In addition to the unified /mcp endpoint, each server has a dedicated endpoint:

POST /mcp/server/:serverId

This endpoint exposes only that server's tools and validates server existence, security filter status, and runnability before accepting calls.

Warmup and caching

The gateway pre-caches packages for fast startup:

# Check cache status
curl -s https://mcp.rickydata.org/api/warmup/status | jq '.summary'

A daily cron job at 3 AM UTC refreshes all package caches. Packages are also cached through normal usage when servers are started.

MCP protocol details

The gateway implements Streamable HTTP transport with JSON-RPC 2.0:

MethodDescription
initializeMCP handshake
tools/listList available tools (meta-tools + enabled server tools)
tools/callExecute a tool (x402 payment required for non-meta tools)
notifications/initializedClient ready notification

The endpoint is statelessGET and DELETE on /mcp return 405. Session state is managed through wallet auth and the X-MCP-Session header, not through MCP protocol sessions.

Request constraints

  • Maximum serialized argument size for tools/call: 100KB
  • Invalid methods or malformed JSON-RPC payloads return standard JSON-RPC errors

Next steps