Hey,
Currently, there doesn't seem to be an easy way to expose Docker MCP gateway to Docker Sandbox.
It feels that steps 2-5 of our current process could be automated by Docker Desktop, in the same way it adds MCP_DOCKER entry to the user's Claude settings file. What is more, if we add additional config to the sandbox's startup process, step 6 could also be eliminated.
Our current process
- Create your own Docker MCP profile and test it locally as per Docker MCP documentation.
- Create a secret token for Docker MCP gateway, e.g.
dmcp{secret_value}
- Add the secret to Docker sandbox via
sbx secret set -g dockermcp
- Set
MCP_GATEWAY_AUTH_TOKEN env variable to the value of the secret token so the Docker MCP gateway can use it for authentication, e.g. export MCP_GATEWAY_AUTH_TOKEN=dmcp{secret_value} or $env:MCP_GATEWAY_AUTH_TOKEN=dmcp{secret_value}
- Run Docker MCP gateway:
docker mcp gateway run --profile your_profile_name --transport streaming --port PORT
- Create a sandbox with the following kit:
spec.yaml
schemaVersion: "1"
kind: mixin
name: docker-mcp
network:
allowedDomains:
- "host.docker.internal:PORT"
- "localhost:PORT"
serviceDomains:
"localhost:PORT": dockermcp
serviceAuth:
dockermcp:
headerName: Authorization
valueFormat: "Bearer %s"
credentials:
sources:
dockermcp:
env:
- DOCKER_MCP_API_KEY
environment:
proxyManaged:
- DOCKER_MCP_API_KEY
files/workspace
{
"mcpServers": {
"MCP_DOCKER": {
"type": "http",
"url": "http://host.docker.internal:PORT/mcp",
"headers": {
"Authorization": "Bearer ${DOCKER_MCP_API_KEY}"
}
}
}
}
Hey,
Currently, there doesn't seem to be an easy way to expose Docker MCP gateway to Docker Sandbox.
It feels that steps 2-5 of our current process could be automated by Docker Desktop, in the same way it adds MCP_DOCKER entry to the user's Claude settings file. What is more, if we add additional config to the sandbox's startup process, step 6 could also be eliminated.
Our current process
dmcp{secret_value}sbx secret set -g dockermcpMCP_GATEWAY_AUTH_TOKENenv variable to the value of the secret token so the Docker MCP gateway can use it for authentication, e.g.export MCP_GATEWAY_AUTH_TOKEN=dmcp{secret_value}or$env:MCP_GATEWAY_AUTH_TOKEN=dmcp{secret_value}docker mcp gateway run --profile your_profile_name --transport streaming --port PORTspec.yaml
files/workspace