Pointing execution at a named environment is the difference between a snippet that imports your project's dependencies and one that fails on the first import. The incremental file path is the other useful idea: initialise, append, read back, then execute - so a long program is built in pieces instead of being truncated.
A code-execution server that runs against an environment you nominate, so generated code has the libraries you already installed. It also handles code too long for one message by writing it to a file across several calls before running it.
- Execute a Python snippet in the configured environment and get the output back
- Install packages into that environment, and check which ones are already there
- Read the current environment configuration, and switch to a different one at runtime
- Create a Python file with initial content, append to it, and read it back to check its state
- Execute the finished file - the path for code that would not fit in a single message
Node.js, plus one Python environment: a Conda environment, a virtualenv, or a UV virtualenv. Clone, npm install, npm run build. CODE_STORAGE_DIR is required and is where generated code is written. ENV_TYPE selects the environment kind and is paired with CONDA_ENV_NAME, VENV_PATH or UV_VENV_PATH. The Docker image has been tested with the UV virtualenv type only.
One command — docker run -i --rm mcp-code-executor
