Skip to content

feat: add HTTP/Streamable HTTP transport for containerised deployment#23

Open
eejd wants to merge 3 commits into
QuantGeekDev:mainfrom
eejd:feat/http-transport
Open

feat: add HTTP/Streamable HTTP transport for containerised deployment#23
eejd wants to merge 3 commits into
QuantGeekDev:mainfrom
eejd:feat/http-transport

Conversation

@eejd

@eejd eejd commented May 27, 2026

Copy link
Copy Markdown

Closes #22

What this adds

--transport http mode so docker-mcp can run as a long-lived container accessible at http://localhost:<port>/mcp rather than requiring a stdio subprocess on every client machine.

Changes

server.py — adds _create_starlette_app() using StreamableHTTPSessionManager (stateless mode) and updates main() to accept --transport, --port, --host args (also readable from DOCKER_MCP_TRANSPORT, DOCKER_MCP_PORT, DOCKER_MCP_HOST env vars). stdio remains the default — fully backward-compatible.

pyproject.toml — bumps mcp>=1.6.0 (minimum for Streamable HTTP support), adds explicit starlette and uvicorn deps.

Dockerfile — Alpine-based image with docker-cli installed so python-on-whales can reach the socket. Defaults to HTTP transport on port 8080.

docker-compose.example.yml — shows the socket-mount deployment pattern.

Usage

Containerised (new):

services:
  docker-mcp:
    build: .
    ports:
      - "127.0.0.1:4001:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro

MCP client config:

{ "mcpServers": { "docker-mcp": { "type": "http", "url": "http://localhost:4001/mcp" } } }

stdio (unchanged):

docker-mcp  # or: docker-mcp --transport stdio

Tested

  • tools/list returns all 4 tools via HTTP ✓
  • list-containers returns real container data via mounted socket ✓
  • /health endpoint returns {"status":"ok"}
  • stdio mode unchanged ✓
  • Built and run on Apple Silicon (aarch64) with Colima

eejd and others added 3 commits May 27, 2026 21:47
Adds --transport http mode so docker-mcp can run as a long-lived
container accessible at http://localhost:<port>/mcp rather than
requiring a stdio subprocess on the host.

Transport is selected via --transport flag or DOCKER_MCP_TRANSPORT env
var (default: stdio, preserving backward compatibility). Host and port
are configurable via --host/--port or DOCKER_MCP_HOST/DOCKER_MCP_PORT.

Adds:
- HTTP transport using mcp.server.streamable_http_manager
  (stateless mode, no session state between requests)
- /health endpoint for container health checks
- Dockerfile (Alpine-based, includes docker-cli for socket access)
- docker-compose.example.yml showing socket mount pattern

Bumps mcp>=1.6.0 (minimum for Streamable HTTP support) and adds
explicit starlette and uvicorn dependencies.

Closes QuantGeekDev#22

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gate (#113)

Two related changes (the second built on previously-uncommitted working-tree work
that the deployed agent-services-hive mcp-docker was already running):

1. Commits the lifecycle handlers + tool entries (start/stop/restart/inspect) that
   existed only in the working tree on feat/http-transport — addresses the build-
   from-uncommitted-source drift noted in ADR-006.
2. Adds a manage-only gate: when DOCKER_MCP_ALLOW_CREATE is false (default), hides
   create-container + deploy-compose from tools/list, refuses them if called, and
   suppresses the deploy-stack prompt. Pairs with a scoped docker-socket-proxy in
   the as-hive deployment (which also denies the underlying create/pull API calls)
   to remove the host bind-mount escape path while keeping lifecycle management.
   Set the var to true to restore the full lifecycle capability.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add HTTP/Streamable HTTP transport for containerised deployment

1 participant