Komodo MCP Server
An MCP (Model Context Protocol) server that exposes Komodo — a Docker/container management and deployment system — to AI assistants.
Highlights
- 35 tools across read / execute / write categories
- Streamable HTTP transport (default) per the latest MCP spec, plus legacy SSE and stdio
- Per-session
McpServer— concurrent clients are isolated - Official
komodo_client2.1.1 for the upstream API contract - Bearer-token auth with constant-time compare; loopback-only fallback when no token is configured
- DNS-rebinding defense via a default
Hostallow-list and an optionalOriginallow-list - Helmet security headers; CORS allow-list
- Pino structured logs with
Authorization/X-Api-Secret/X-Api-Keyredaction - Graceful shutdown on
SIGTERM/SIGINT - Strict input schemas: bounded
tail,terms,compose_contents, andcontents; update configs reject keys beginning with API-key, API-secret, password, secret, webhook-secret, or token variants - Shared upstream adapter with Undici pooling, an absolute timeout, a 16 MiB response cap,
p-limitconcurrency control, and secret redaction; requests are not retried
Quick Start
Local (loopback) with Docker Compose
git clone https://github.com/nicolasestrem/komodo-mcp.git
cd komodo-mcp
export KOMODO_ADDRESS=http://host.docker.internal:9120
export KOMODO_API_KEY='YOUR_KEY'
export KOMODO_API_SECRET='YOUR_SECRET'
export MCP_AUTH_TOKEN="$(openssl rand -hex 32)"
docker compose up -d
Plain docker compose automatically loads the local-development override and passes these environment variables into the container. The container binds 0.0.0.0:3113 internally but docker-compose.yml publishes the port only to host loopback (127.0.0.1:3113:3113). Docker requests still cross a container-network boundary, so use the generated bearer token. Front the service with a reverse proxy when you need network access.
Add to Claude Code (.mcp.json)
Local npm process / loopback (no token needed when MCP_AUTH_TOKEN is unset):
{
"mcpServers": {
"komodo": {
"type": "http",
"url": "http://127.0.0.1:3113/mcp"
}
}
}
Docker (token required):
{
"mcpServers": {
"komodo": {
"type": "http",
"url": "http://127.0.0.1:3113/mcp",
"headers": { "Authorization": "Bearer ${MCP_AUTH_TOKEN}" }
}
}
}
For a networked deployment, replace the URL with the TLS endpoint exposed by your reverse proxy.
Local development (npm)
npm install
npm run build
npm start # default streamable HTTP on 127.0.0.1:3113
npm run dev:sse # legacy SSE transport with a dev token
Configuration
Komodo upstream
MCP server
Getting Komodo API credentials
- Open the Komodo web UI
- Go to Settings → API Keys
- Click Create API Key, copy the key and secret
Security model
This server holds Komodo admin credentials. A successful tool call can deploy code, prune systems, or destroy stacks on every Komodo-managed host. Treat it as privileged.
The defaults aim for "secure by accident":
- Bind is
127.0.0.1unless explicitly opened. MCP_AUTH_TOKENis required for any non-loopback caller.- The default
Hostallow-list blocks DNS rebinding even if a browser is tricked into reaching the loopback port;MCP_ALLOWED_ORIGINSadds optional browser Origin enforcement. - All requests, including loopback, go through Helmet + CORS.
- Errors emitted to MCP clients have the API key/secret scrubbed from upstream bodies.
For non-loopback deployments use a reverse proxy that terminates TLS, set a random MCP_AUTH_TOKEN (openssl rand -hex 32), and configure MCP_ALLOWED_HOSTS/MCP_ALLOWED_ORIGINS for your domain. See docs/DEPLOYMENT.md and docs/RUNBOOK.md.
Available tools
35 tools are registered from a single declarative table in src/tools/registry.ts. Read tools carry readOnlyHint and idempotentHint; start/stop/restart and pull operations carry idempotentHint; prune/destroy/delete and komodo_write_stack_contents carry destructiveHint. Exact operation mappings and schemas are in docs/API.md.
Read (15)
Execute (12)
Write (8)
Example prompts
- "List all my Komodo stacks"
- "Show me the logs for the nginx stack"
- "Restart the wordpress stack"
- "What containers are running on my server?"
- "Deploy the staging stack"
Development
npm install
npm run lint # biome
npm run build # tsc
npm test # node:test suites (auth/secret/tool/format/smoke)
npm run dev # tsc --watch
Architecture
src/
├── index.ts # Express factory, transports, auth/Origin/Host gates, SIGTERM
├── server.ts # createServer({ client? }) — DI-friendly factory
├── komodo-client.ts # Official client adapter: shared Undici pool, timeout/size/concurrency guards
└── tools/
├── registry.ts # Declarative TOOLS table + registerAll(server, client)
└── utils.ts # formatResult + toolHandler (errors → MCP isError)
See docs/ARCHITECTURE.md for diagrams and the request-flow walk-through.
API reference
The server uses the official komodo_client 2.1.1 package for the Komodo Core API. It sends JSON POST requests to /read/<Operation>, /write/<Operation>, or /execute/<Operation>, with the operation parameters as the request body and API-key headers:
curl -X POST http://your-komodo:9120/read/ListStacks \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_KEY" \
-H "X-Api-Secret: YOUR_SECRET" \
-d '{}'
Streamable HTTP and legacy SSE each create a separate McpServer per session while sharing one upstream adapter. Idle sessions are closed after MCP_SESSION_IDLE_TIMEOUT_MS; requests carrying an unknown session ID receive HTTP 404. CORS exposes the mcp-session-id response header to allowed browser clients.
License
MIT — see LICENSE.
Dependency note: the official komodo_client package declares GPL-3.0. Redistribution scenarios should receive a separate licensing review; this note is not a legal conclusion.