This adds (experimantal) support to add arbitrary MCP server from
Github.
```python
sbx = await AsyncSandbox.beta_create(timeout=600, mcp={
"github/modelcontextprotocol/servers": {
"install_cmd": "npm install",
"run_cmd": "sudo npx -y @modelcontextprotocol/server-filesystem /root",
},
})
```
or in TS with better typing:
```typescript
const sandbox = await Sandbox.betaCreate({
mcp: {
duckduckgo: {},
'github/modelcontextprotocol/servers': {
installCmd: 'npm install',
runCmd: `sudo npx -y @modelcontextprotocol/server-filesystem /root`,
},
},
timeoutMs: 600_000,
});
```
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds beta support to launch custom MCP servers (including
GitHub-defined ones) and updates MCP schemas/types; also switches
default MCP template to `mcp-gateway`.
>
> - **SDK (JS & Python)**:
> - Add beta support for `mcp` config, including dynamic GitHub-based
servers with custom `runCmd/installCmd/envs` and automatic `mcp-gateway`
startup with token.
> - Send `UNSET`/omit when `mcp` not provided to avoid API noise.
> - Change default MCP template from `mcp-gateway-v0-2` to
`mcp-gateway`.
> - **Types/Schema**:
> - Extend `McpServer` typings (JS `mcp.d.ts`, Python type hints) to
include many servers and descriptive metadata.
> - Introduce GitHub MCP types (TS `GitHubMcpServer`, Python
`GitHubMcpServerConfig`) and export in SDK surfaces.
> - Regenerate and enrich `spec/mcp-server.json` with
titles/descriptions and new server entries.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f3139b8fc2f1246c72734d8048ba277a13e3949d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Adds beta MCP support to JS/Python SDKs with template auto-selection,
config POST, MCP URL helpers, and codegen for MCP types/schemas.
>
> - **SDKs (Beta MCP support)**:
> - **JS SDK**:
> - Add `McpServer` types and export; extend `Sandbox.betaCreate` with
`mcp` option that auto-selects `mcp-gateway-v0`, configures MCP via POST
`/config` on port `50005` with retries, and expose `betaGetMcpUrl()`.
> - Add `wait(ms)` util; generate MCP types from `spec/mcp-server.json`;
new `generate:mcp` script and dev dep `json-schema-to-typescript`.
> - **Python SDK**:
> - Generate and export `McpServer` (TypedDict); extend sync/async
`beta_create` with `mcp` option, auto-select default MCP template, POST
MCP config with retries, and add `beta_get_mcp_url()`; define `mcp_port`
and `default_mcp_template`.
> - Makefile: add `generate-mcp` target; include
`datamodel-code-generator` in tooling; update lockfile/pyproject deps.
> - **Tooling**:
> - Add `spec/mcp-server.json` schema; update codegen Dockerfile to
install `datamodel-code-generator`.
> -
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
cf3f175d310d4c242cd2e867efd801f5c04f2099. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Jonas Scholz <Jonas.Scholz@bbscholz.de>