execute_codeLABSCO SUMMARY
Generated code that runs where your libraries already live.
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.
What it is
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.
What you get
- 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
Requirements
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.
Setup effort
One command — docker run -i --rm mcp-code-executor
USE CASES
Running analysis against libraries you already have
Point the server at the Conda environment holding your stack and execute the snippet there, no reinstalling.
Writing a program too long for one message
Initialise the file with the skeleton, append the rest across calls, read it back to confirm, then execute the file.
Adding a dependency mid-task
Check whether the package is present before installing it, then install into the same environment the code runs in.
Switching projects without restarting
Change the environment configuration at runtime and carry on in the new one.
9 tools
Listed in project docs. Your client may show a different list.
install_dependenciescheck_installed_packagesconfigure_environmentget_environment_configinitialize_code_fileappend_to_code_fileexecute_code_fileread_code_fileBEFORE YOU INSTALL
What to know first
Tools you get
9 tools named in the project's documentation.
Requires
docker on PATH
INSTALLATION
Connect your client
Add the block to your client, or run the command directly.
Server setup
Configuration file
{
"mcpServers": {
"mcp-code-executor": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"mcp-code-executor"
]
}
}
}docker
docker run -i --rm mcp-code-executor