Skip to content

Consider simplifying the process to expose Docker MCP getaway to Docker Sandbox  #501

@pawelpabich

Description

@pawelpabich

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

  1. Create your own Docker MCP profile and test it locally as per Docker MCP documentation.
  2. Create a secret token for Docker MCP gateway, e.g. dmcp{secret_value}
  3. Add the secret to Docker sandbox via sbx secret set -g dockermcp
  4. 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}
  5. Run Docker MCP gateway: docker mcp gateway run --profile your_profile_name --transport streaming --port PORT
  6. 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}"
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions