This document describes how to build and run mcp-remote using Docker.
# Build the Docker image
docker build -t mcp-remote:latest .
# Or using docker-compose
docker-compose build# Run with a remote server URL
docker run -it mcp-remote:latest https://remote.mcp.server/sse
# With custom headers
docker run -it \
-e AUTH_TOKEN="your-token-here" \
mcp-remote:latest \
https://remote.mcp.server/sse \
--header "Authorization: Bearer ${AUTH_TOKEN}"
# With debug logging
docker run -it \
-v mcp-auth:/home/mcp/.mcp-auth \
mcp-remote:latest \
https://remote.mcp.server/sse \
--debug# Run with docker-compose
docker-compose run mcp-remote https://remote.mcp.server/sse
# Run client mode for testing
docker-compose run mcp-remote node dist/client.js https://remote.mcp.server/sseFor OAuth flows, you'll need to handle the callback URL. Options:
- Host Network Mode (Linux only):
docker run -it --network host mcp-remote:latest https://remote.mcp.server/sse- Port Forwarding:
docker run -it -p 3334:3334 mcp-remote:latest https://remote.mcp.server/sse- Custom Callback Host:
docker run -it \
-p 3334:3334 \
mcp-remote:latest \
https://remote.mcp.server/sse \
--host "localhost"To persist OAuth tokens between container runs:
# Create a named volume
docker volume create mcp-auth
# Run with volume mounted
docker run -it \
-v mcp-auth:/home/mcp/.mcp-auth \
mcp-remote:latest \
https://remote.mcp.server/sseTo use the Docker container with Claude Desktop, Cursor, or Windsurf:
{
"mcpServers": {
"remote-example": {
"command": "docker",
"args": ["run", "-i", "--rm", "-v", "mcp-auth:/home/mcp/.mcp-auth", "mcp-remote:latest", "https://remote.mcp.server/sse"]
}
}
}MCP_REMOTE_CONFIG_DIR: Directory for storing auth tokens (default:/home/mcp/.mcp-auth)NODE_EXTRA_CA_CERTS: Path to CA certificate file for VPN/proxy environments
If the OAuth callback fails:
- Ensure the port is properly exposed
- Check that the callback URL matches what the OAuth provider expects
- Consider using host network mode on Linux
The container runs as a non-root user (uid: 1001). Ensure mounted volumes have appropriate permissions.
Enable debug logging with the --debug flag. Logs will be stored in the mounted volume at /home/mcp/.mcp-auth/{server_hash}_debug.log.