How it works
When you specify a GitHub repository, E2B will:- Clone the repository into the sandbox
- Run the
installCmd(optional) to install dependencies - Run the
runCmdto start the MCP server with stdio transport
runCmd must start an MCP server that follows the MCP specification and communicates via stdio (standard input/output).
Using a custom MCP server
Configuration
Use the camelCase keysinstallCmd and runCmd in Python too, even though the Python SDK’s type hints list install_cmd and run_cmd. The Python SDK passes the mcp dictionary to the gateway unchanged, and the gateway reads the commands only from installCmd and runCmd. With snake_case keys the server has no run command, so the gateway skips it and its tools are not available.
Optional command to run before starting the MCP server. Use this to install dependencies (e.g.,
npm install, pip install -r requirements.txt).Important for npx-based servers: Always include
installCmd: 'npm install' (or equivalent) when using npx in your runCmd. Without installing dependencies first, npx will try to use the local repository and fail.Troubleshooting
If your custom MCP server doesn’t work as expected:- Explore the sandbox either via the console or by connecting to it via
e2b connect <sandbox-id> - Check the gateway log file with
sudo cat /var/log/mcp-gateway/gateway.log.