feat: add HTTP/Streamable HTTP transport for containerised deployment#23
Open
eejd wants to merge 1 commit into
Open
feat: add HTTP/Streamable HTTP transport for containerised deployment#23eejd wants to merge 1 commit into
eejd wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #22
What this adds
--transport httpmode so docker-mcp can run as a long-lived container accessible athttp://localhost:<port>/mcprather than requiring a stdio subprocess on every client machine.Changes
server.py— adds_create_starlette_app()usingStreamableHTTPSessionManager(stateless mode) and updatesmain()to accept--transport,--port,--hostargs (also readable fromDOCKER_MCP_TRANSPORT,DOCKER_MCP_PORT,DOCKER_MCP_HOSTenv vars). stdio remains the default — fully backward-compatible.pyproject.toml— bumpsmcp>=1.6.0(minimum for Streamable HTTP support), adds explicitstarletteanduvicorndeps.Dockerfile— Alpine-based image withdocker-cliinstalled sopython-on-whalescan reach the socket. Defaults to HTTP transport on port 8080.docker-compose.example.yml— shows the socket-mount deployment pattern.Usage
Containerised (new):
MCP client config:
{ "mcpServers": { "docker-mcp": { "type": "http", "url": "http://localhost:4001/mcp" } } }stdio (unchanged):
docker-mcp # or: docker-mcp --transport stdioTested
tools/listreturns all 4 tools via HTTP ✓list-containersreturns real container data via mounted socket ✓/healthendpoint returns{"status":"ok"}✓