68abd92c40
Adds prepulling mcp server images to the SDK.
```typescript
export const template = Template()
.fromTemplate("mcp-gateway")
.betaAddMcpServer("arxiv")
await Template.build(template, {
alias: "arxiv-mcp-gateway",
cpuCount: 1,
memoryMB: 1024,
onBuildLogs: console.log,
});
```
```python
template = Template().from_template("mcp-gateway").beta_add_mcp_server("arxiv")
Template.build(
template,
alias="arxiv-mcp-gateway-v1",
cpu_count=1,
memory_mb=1024,
)
```
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Introduce beta methods to prepull MCP servers via mcp-gateway in JS
and Python templates, with typing, validation, and stacktrace-tested
errors.
>
> - **Template SDKs**
> - **JS**:
> - Add `Template.betaAddMcpServer(servers: McpServerName |
McpServerName[])` to run `mcp-gateway pull ...`.
> - Enforce base template check (`'mcp-gateway'`), throwing `BuildError`
with stack trace.
> - Introduce and export `McpServerName` type (from `../sandbox/mcp`).
> - **Python**:
> - Add `Template.beta_add_mcp_server(servers: Union[str, List[str]])`
to run `mcp-gateway pull ...`.
> - Enforce `'mcp-gateway'` base template; raise `BuildException` with
captured traceback.
> - **Tests**
> - Add stacktrace tests for `betaAddMcpServer` (JS) and
`beta_add_mcp_server` (Python async/sync).
> - **Release**
> - Changeset: patch bumps for `@e2b/python-sdk` and `e2b`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
43b4a01ce3c856dff7def5ba6b706ee00eda0f84. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Joseph Lombrozo <joe.lombrozo@e2b.dev>
What is E2B?
E2B is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our JavaScript SDK or Python SDK.
Run your first Sandbox
1. Install SDK
pip install e2b-code-interpreter
2. Get your E2B API key
E2B_API_KEY=e2b_***
3. Execute code with code interpreter inside Sandbox
from e2b_code_interpreter import Sandbox
with Sandbox.create() as sandbox:
sandbox.run_code("x = 1")
execution = sandbox.run_code("x+=1; x")
print(execution.text) # outputs 2
4. Check docs
Visit E2B documentation.
5. E2B cookbook
Visit our Cookbook to get inspired by examples with different LLMs and AI frameworks.
