1203ccbad3
<!-- 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>
42 lines
1.1 KiB
Makefile
42 lines
1.1 KiB
Makefile
ROOT_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../..)
|
|
|
|
generate-api:
|
|
python $(ROOT_DIR)/spec/remove_extra_tags.py sandboxes templates
|
|
openapi-python-client generate --output-path $(ROOT_DIR)/packages/python-sdk/e2b/api/api --overwrite --path $(ROOT_DIR)/spec/openapi_generated.yml
|
|
rm -rf e2b/api/client
|
|
mv e2b/api/api/e2b_api_client e2b/api/client
|
|
rm -rf e2b/api/api
|
|
ruff format .
|
|
|
|
generate-envd:
|
|
if [ ! -f "/go/bin/protoc-gen-connect-python" ]; then \
|
|
$(MAKE) -C $(ROOT_DIR)/packages/connect-python build; \
|
|
fi
|
|
|
|
cd $(ROOT_DIR)/spec/envd && pwd && buf generate --template buf-python.gen.yaml
|
|
./scripts/fix-python-pb.sh
|
|
|
|
ruff format .
|
|
|
|
generate: generate-api generate-envd generate-mcp
|
|
|
|
init:
|
|
pip install openapi-python-client datamodel-code-generator
|
|
|
|
lint:
|
|
ruff check .
|
|
|
|
format:
|
|
ruff format .
|
|
|
|
generate-mcp:
|
|
datamodel-codegen \
|
|
--input ../../spec/mcp-server.json \
|
|
--input-file-type jsonschema \
|
|
--output e2b/sandbox/mcp.py \
|
|
--output-model-type typing.TypedDict \
|
|
--target-python-version 3.9 \
|
|
--class-name McpServer \
|
|
--use-field-description \
|
|
--disable-timestamp \
|
|
--extra-fields forbid
|