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.

Build the image

docker build -t infrahub-mcp .

Run standalone

docker run -p 8001:8001 \
-e INFRAHUB_ADDRESS=http://your-infrahub-host:8000 \
-e INFRAHUB_API_TOKEN=your-token \
infrahub-mcp

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:
build: https://github.com/opsmill/infrahub-mcp.git
# or use a pre-built image when published:
# 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