<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Fix Dockerfile generation to properly render `RUN` and `COPY`
instructions using only relevant args, and add patch changesets.
>
> - **Template to Dockerfile generation**:
> - JS (`packages/js-sdk/src/template/index.ts`): Special-case `RUN` and
`COPY` so Dockerfile emits `RUN <cmd>` and `COPY <src> <dest>` instead
of joining all args.
> - Python (`packages/python-sdk/e2b/template/main.py`): Same
special-casing for `RUN` and `COPY` during Dockerfile rendering.
> - **Release**:
> - Changeset: patch bumps for `@e2b/python-sdk` and `e2b` with note
"fix RUN and COPY handling in to_dockerfile".
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
04b2dbbda34f0845f3d4ec9963cc478b7b7b7f01. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Previously the gateway was just fire and forget which lead to a race
condition when you immediately tried to access the mcp server, changed
the template to launch a daemon with healthcheck.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Start MCP gateway synchronously with error checks and bump default MCP
template to `mcp-gateway-v0-2` across JS and Python SDKs.
>
> - **MCP Gateway startup**:
> - JS (`packages/js-sdk/src/sandbox/index.ts`): Start `mcp-gateway`
without background mode; validate exit code and throw on failure.
> - Python Async (`packages/python-sdk/e2b/sandbox_async/main.py`):
Await `mcp-gateway` start, remove background/timeout flags; raise on
non-zero exit.
> - Python Sync (`packages/python-sdk/e2b/sandbox_sync/main.py`): Run
`mcp-gateway` synchronously; check exit code and raise on failure.
> - **Defaults**:
> - Update `default_mcp_template` from `mcp-gateway-v0-1` to
`mcp-gateway-v0-2` in JS and Python SDKs.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
79e431c78bf384c970a5b1fede55071116a089c5. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Adds `mcp` config support for sandbox creation across API, JS, and
Python SDKs, and updates timeout tests to use explicit request timeouts.
>
> - **API/OpenAPI**:
> - Add `McpConfig` schema and `mcp` field to `NewSandbox` in
`spec/openapi.yml` and generated TS `schema.gen.ts`.
> - **JS SDK**:
> - `SandboxApi.createSandbox` sends `mcp` in POST body
(`packages/js-sdk/src/sandbox/sandboxApi.ts`).
> - Types updated to include `components["schemas"]["McpConfig"]`.
> - **Python SDK**:
> - Extend `NewSandbox` model and sandbox create flow to accept/pass
`mcp`; async/sync APIs propagate `mcp` to POST `/sandboxes`.
> - **Tests**:
> - Increase `is_running` request timeouts in timeout tests to reduce
flakiness (JS and Python).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
04ad4e6d4947e33523b74aba2f703fa1e9c05e72. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Global installs for pip/npm now run as root; pip gains an option to
install per-user instead.
>
> - **Template SDKs**:
> - **JavaScript (`packages/js-sdk/src/template`)**:
> - `pipInstall` now supports `options: { g?: boolean }` (default
`true`); when `g` is `true`, runs as `root`, when `false`, adds `--user`
and runs as current user.
> - `npmInstall` runs as `root` when `options.g` is `true`.
> - **Python (`packages/python-sdk/e2b/template/main.py`)**:
> - `pip_install` now accepts `g: bool = True`; when `True`, runs as
`root`, when `False`, adds `--user` and runs as current user.
> - `npm_install` runs as `root` when `g` is `True`.
> - **Changeset**: patch bump for `@e2b/python-sdk` and `e2b` with note:
install global packages as sudo.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6be5ba211f7d200d50ffca50c1751d455b3e2cfa. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Set default user for Dockerfiles. Includes also small migrate fixes.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Defaults Dockerfile-based templates to user 'user' and workdir
'/home/user', updates CLI templates (sudo start/ready, relative Python
import), and allows template migration without a config file.
>
> - **SDKs (Dockerfile parsing)**:
> - JS (`packages/js-sdk/src/template/dockerfileParser.ts`) and Python
(`packages/python-sdk/e2b/template/dockerfile_parser.py`): after
parsing, set defaults `setUser('user')` and `setWorkdir('/home/user')`.
> - **CLI Templates**:
> - Python build scripts: switch to relative import `from .template
import template`.
> - Generated template hbs: start/ready commands now prefixed with
`sudo`; removed explicit root/workdir before start/ready.
> - **CLI Migrate**:
> - Supports migration without `e2b.toml`; uses default config values
and prints a warning instead of exiting.
> - Initializes default config when missing; success messaging adjusted.
> - **Tests**:
> - Update fixtures to reflect new defaults (`set_user('user')`,
`set_workdir('/home/user')`, `sudo` start/ready, relative imports).
> - Relax error case to succeed with warning when config is missing.
> - Comment out stacktrace tests for `fromDockerfile` in JS/Python until
fixed.
> - **Changesets**: Patch bumps for `@e2b/cli`, `@e2b/python-sdk`, and
`e2b`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
934dc3b23b5607f70d4a4f5b7a9413a9d04df28a. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Updates stacktrace tests to use root-owned paths for workdir/dir ops
and a more explicit failing set_user command in JS and Python
(async/sync) SDKs.
>
> - **Tests (stacktrace)**:
> - **JS SDK (`packages/js-sdk/tests/template/stacktrace.test.ts`)**:
> - `setWorkdir`: set user to `root` and change path to `/root/.bashrc`.
> - `setUser`: use `; exit 1` as the failing command.
> - **Python SDK**:
> - Async
(`packages/python-sdk/tests/async/template_async/test_stacktrace.py`):
> - `make_dir`, `set_workdir`: set user to `root` and target
`/root/.bashrc`.
> - `set_user`: use `; exit 1` as the failing command.
> - Sync
(`packages/python-sdk/tests/sync/template_sync/test_stacktrace.py`):
> - `make_dir`, `set_workdir`: set user to `root` and target
`/root/.bashrc`.
> - `set_user`: use `; exit 1` as the failing command.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
780023b3819f19ba908ccd794195e630bab2741b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Changed to use commands instead of API and added auth.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Introduce MCP auth by launching mcp-gateway with an access token and
exposing a token getter; replace HTTP config with command execution and
bump default MCP template to v0-1.
>
> - **SDKs**:
> - **MCP auth**:
> - Launch `mcp-gateway` via `commands.run` with `GATEWAY_ACCESS_TOKEN`
set to a generated token (JS/TS and Python, async/sync).
> - Expose token retrieval: `betaGetMcpToken()` (JS) and
`beta_get_mcp_token()` (Python) reading `/etc/mcp-gateway/.token` if
needed.
> - **Configuration flow**:
> - Replace HTTP `POST /config` setup with command-based startup; remove
retry logic (JS and Python).
> - **Defaults**:
> - Update `defaultMcpTemplate`/`default_mcp_template` to
`mcp-gateway-v0-1` (JS and Python).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
4456a1822d87fa32110f6659c3bf9135bff71045. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Upgrade openapi-fetch to v0.14 and openapi-typescript to v7.9 with
required API/middleware changes, adjust multipart upload, and extend Bun
test with file I/O.
>
> - **JS SDK**:
> - **Dependencies**: Bump `openapi-fetch` to `^0.14.1` and
`openapi-typescript` to `^7.9.1`.
> - **API Client (`src/envd/api.ts`)**:
> - Update `handleEnvdApiError` to accept `{ error, response }` per new
client response shape; remove `FetchResponse` generic import.
> - **Logging (`src/logs.ts`)**:
> - Update `Middleware` usage to new signatures: `onRequest({ request
})` and `onResponse({ response })` and return `request`/`response`.
> - **Filesystem (`src/sandbox/filesystem/index.ts`)**:
> - Adjust `POST /files` multipart upload: use `bodySerializer()` with
`FormData`; remove manual `Content-Type` headers; minor comment typo
fix.
> - **Tests**:
> - Extend Bun runtime test to write/read a file via `sbx.files`.
> - **Release**: Add patch changeset.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
03afbac2fdcf761368bc91040f1d715711994c6c. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Adjusts `skipCache` to return `this` in types and aligns
implementation for proper fluent chaining.
>
> - **JS SDK – `template`**:
> - **Types**: Change `skipCache` return type from `TemplateBuilder` to
`this` in `types.ts` (`TemplateFromImage`, `TemplateBuilder`).
> - **Implementation**: Align `skipCache` in `index.ts` by removing
explicit return type annotation to match `this` chaining.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
58131d1e5c8caaddc3a23523f99c069ac00a32a7. 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>
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Unifies Template APIs across JS/Python with PathLike support, new
copyItems, option/name tweaks, and simpler registry auth via
credentials; updates parser, exports, and tests.
>
> - **Template API (JS + Python)**
> - Add PathLike support for paths in `copy`, `remove`, `rename`,
`makeDir`, `makeSymlink`, `setWorkdir`, and `gitClone`.
> - Introduce `copyItems` and corresponding `CopyItem` typing; adjust
Dockerfile parser to use `copyItems` overload.
> - Simplify registry auth: `fromImage(baseImage, credentials)` accepts
`{username,password}`; remove `fromRegistry`; update
`fromAWSRegistry`/`fromGCPRegistry` to take credentials and set config
internally.
> - Rename options: `ignoreFilePaths` -> `fileIgnorePatterns`;
`fileContextPath` can be `PathLike`.
> - Ensure internal hashing/upload use stringified paths; minor
enum/type tweaks (e.g., `InstructionType` as string enum, `forceUpload?:
true`).
> - **Exports**
> - Export `CopyItem` from JS `index.ts` and Python `__init__.py`.
> - **Tests**
> - Update stacktrace and build tests to new method names/signatures
(e.g., registry via `fromImage` credentials, new `copyItems` tests,
optional `skipCache` param).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
95391030550a340fe99ebaac4494867b3e3e9507. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Jakub Dobry <jakub.dobry8@gmail.com>
This PR fixes a mismatch between the TypeScript types and the
documented/default runtime behavior in the JS SDK.
- The docs indicate `stdin` defaults to `false` (`@default false`).
- The current type declares `stdin: boolean;` (required), which causes
TypeScript errors for callers who rely on the default.
- Change: mark `stdin` as optional (`stdin?: boolean;`) so types match
docs/runtime.
Disable stdin (setting it to `/dev/null` for `command.run()`, but enable
to setting it to pipe, which you can send the input via
`command.sendStdin()`
This fixes issues with tools checking for stdin and then hanging
indefinitely
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Disables stdin by default and introduces a new `StartRequest.stdin`
flag to opt-in to stdin piping, updating JS/Python SDKs, version gating,
and tests.
>
> - **Spec/Protobuf**:
> - Add `optional bool stdin` to `process.StartRequest` in
`spec/envd/process/process.proto` and regenerate JS/Python protos.
> - **JS SDK**:
> - Add `ENVD_COMMANDS_STDIN = '0.3.0'` and version check; error if
`stdin === false` on older envd.
> - Extend `CommandStartOpts` with `stdin` (default `false`); pass
`stdin` to `rpc.start`.
> - **Python SDK**:
> - Add `ENVD_COMMANDS_STDIN = Version("0.3.0")` and version check
mirroring JS.
> - Extend async/sync `commands.run()` with `stdin` (default `False`);
pass to `StartRequest`.
> - Update generated `process_pb2`/`.pyi` with `StartRequest.stdin`.
> - **Tests**:
> - Update send-stdin tests to run commands with `stdin:
true`/`stdin=True`.
> - **Changeset**:
> - Minor bump for `@e2b/python-sdk` and `e2b`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
458a15187e6eadccd43540e6b8972c4d45e1bb78. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->