Skip to main content

Running with Docker

This guide covers deploying the Infrahub MCP server as a container, including running it alongside Infrahub in the same Docker Compose stack.

Quick start with Docker Compose

docker compose up -d

This pulls the published image from the Opsmill registry and starts the MCP server. Configure it with a .env file or environment variables (see Configuration reference).

Build the image locally

docker build -f development/Dockerfile -t infrahub-mcp .

Run standalone

docker run -p 8001:8001 \
-e INFRAHUB_ADDRESS=http://your-infrahub-host:8000 \
-e INFRAHUB_API_TOKEN=your-token \
registry.opsmill.io/opsmill/infrahub-mcp:latest

The server listens on http://localhost:8001/mcp using the MCP Streamable HTTP transport.

Deploy alongside Infrahub

The MCP server connects to Infrahub over HTTP, making it a natural sidecar in a Docker Compose stack. Add the infrahub-mcp service to your existing docker-compose.yml:

services:
# ... your existing Infrahub services ...

infrahub-mcp:
image: registry.opsmill.io/opsmill/infrahub-mcp:latest
ports:
- "8001:8001"
environment:
INFRAHUB_ADDRESS: "http://infrahub-server:8000"
INFRAHUB_API_TOKEN: "${INFRAHUB_API_TOKEN}"
MCP_HOST: "0.0.0.0"
MCP_PORT: "8001"
depends_on:
- infrahub-server
restart: unless-stopped

Replace infrahub-server with the service name of your Infrahub instance.

Connect your MCP client

Once the container is running, point your MCP client at the HTTP endpoint instead of running a local subprocess:

{
"mcpServers": {
"infrahub_mcp": {
"type": "streamable-http",
"url": "http://localhost:8001/mcp"
}
}
}

Configuration reference

VariableDescriptionDefault
INFRAHUB_ADDRESSURL of your Infrahub instancerequired
INFRAHUB_API_TOKENAPI token (or use username + password)
INFRAHUB_USERNAMEUsername for basic-auth login
INFRAHUB_PASSWORDPassword for basic-auth login
INFRAHUB_TIMEOUTHTTP request timeout in seconds30
MCP_HOSTBind address for the HTTP server0.0.0.0
MCP_PORTPort for the HTTP server8001
INFRAHUB_MCP_READ_ONLYDisable write operationsfalse
INFRAHUB_MCP_RATE_LIMIT_RPSRate limit (requests/sec, 0 = off)0
INFRAHUB_MCP_CACHE_ENABLEDEnable response cachingfalse
INFRAHUB_MCP_PROMETHEUS_ENABLEDPrometheus format for /metricsfalse

For the full list including retry, auth, OpenTelemetry, and more, see the Configuration reference.

Endpoints

PathMethodDescription
/mcpPOSTMCP Streamable HTTP transport
/healthGETHealth check for container orchestration probes
/metricsGETRequest counts, errors, and latency (JSON or Prometheus)