Code Executor
Allows LLMs to execute Python code in a specified Conda environment, enabling access to necessary libraries and dependencies for efficient code execution.
What is Code Executor?
Code Executor is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to allows llms to execute python code in a specified conda environment, enabling access to necessary libraries and dependencies for efficient code execution.
Allows LLMs to execute Python code in a specified Conda environment, enabling access to necessary libraries and dependencies for efficient code execution.
This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Allows LLMs to execute Python code in a specified Conda envi
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-code-executorConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Code Executor
MCP Code Executor lets AI language models execute Python code inside a specified environment — Conda, virtualenv, or uv virtualenv — and manage the full lifecycle of code files through the Model Context Protocol. It exposes nine tools covering code snippet execution, dependency installation, package verification, environment configuration, and an incremental file-based execution workflow suited for large code blocks that exceed token limits. This is particularly useful when you want Claude or another LLM to run data science notebooks, scientific computing scripts, or any Python task that requires specific libraries installed in a controlled environment.
Prerequisites
- Node.js 18+ (the server is built with npm/TypeScript)
- Python environment: Conda, virtualenv, or uv virtualenv pre-created with required packages
- An MCP-compatible client such as Claude Desktop or Cursor
- A writable directory for CODE_STORAGE_DIR where generated scripts will be saved
Clone the repository and install Node dependencies
Clone the mcp_code_executor repository, navigate into it, install npm dependencies, and build the TypeScript project.
git clone https://github.com/bazinga012/mcp_code_executor.git
cd mcp_code_executor
npm install
npm run buildCreate or identify your Python environment
Ensure you have a Python environment with the libraries you need. For Conda, create a named environment; for virtualenv or uv, note the path to the environment directory.
# Conda:
conda create -n myenv python=3.11 numpy pandas scikit-learn
conda activate myenv
# Or virtualenv:
python -m venv /path/to/venv
# Or uv:
uv venv /path/to/uv-venvConfigure the MCP client with required environment variables
Add the server to your MCP client config, setting CODE_STORAGE_DIR to a writable directory and the environment type variables appropriate for your Python setup.
{
"mcpServers": {
"code-executor": {
"command": "node",
"args": ["/absolute/path/to/mcp_code_executor/build/index.js"],
"env": {
"CODE_STORAGE_DIR": "/tmp/mcp_code",
"ENV_TYPE": "conda",
"CONDA_ENV_NAME": "myenv"
}
}
}
}For virtualenv or uv environments, adjust the env block
If using a standard virtualenv or uv virtualenv instead of Conda, change ENV_TYPE and provide the path variable instead of the environment name.
{
"mcpServers": {
"code-executor": {
"command": "node",
"args": ["/absolute/path/to/mcp_code_executor/build/index.js"],
"env": {
"CODE_STORAGE_DIR": "/tmp/mcp_code",
"ENV_TYPE": "venv",
"VENV_PATH": "/path/to/venv"
}
}
}
}Verify the setup by checking installed packages
Ask your MCP client to call check_installed_packages to confirm that the Python environment is accessible and the expected libraries are present before running any code.
Code Executor Examples
Client configuration
Claude Desktop configuration using a Conda environment named 'datascience' with code stored in /tmp/mcp_code.
{
"mcpServers": {
"code-executor": {
"command": "node",
"args": ["/Users/yourname/mcp_code_executor/build/index.js"],
"env": {
"CODE_STORAGE_DIR": "/tmp/mcp_code",
"ENV_TYPE": "conda",
"CONDA_ENV_NAME": "datascience"
}
}
}
}Prompts to try
These prompts work once the server is running and connected to a Python environment.
- "Install the 'lightgbm' package in my Python environment"
- "Execute this pandas code to load data.csv and show the first 10 rows with summary statistics"
- "Write a script that trains a RandomForest classifier on the iris dataset and save it to a file, then run it"
- "Check which version of numpy is installed in my environment"
- "Create a code file for a web scraper, append the parsing logic incrementally, then execute it"Troubleshooting Code Executor
execute_code fails with 'conda: command not found'
The server needs Conda in PATH when it starts. On macOS/Linux, add the Conda bin directory to your shell profile and restart the MCP client. On Windows, use the Anaconda Prompt or add Conda to the system PATH via the Anaconda installer options.
ModuleNotFoundError for packages that are installed in the environment
Verify that ENV_TYPE matches your actual environment type and that CONDA_ENV_NAME or VENV_PATH is correct. A mismatch causes the executor to use the wrong Python binary. Use check_installed_packages to confirm which environment is being used.
CODE_STORAGE_DIR is not writable and code files cannot be saved
Ensure the directory specified in CODE_STORAGE_DIR exists and is writable by the process running the MCP server. Create it with 'mkdir -p /tmp/mcp_code' and verify permissions with 'ls -la /tmp/mcp_code'.
Frequently Asked Questions about Code Executor
What is Code Executor?
Code Executor is a Model Context Protocol (MCP) server that allows llms to execute python code in a specified conda environment, enabling access to necessary libraries and dependencies for efficient code execution. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Code Executor?
Follow the installation instructions on the Code Executor GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Code Executor?
Code Executor works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Code Executor free to use?
Yes, Code Executor is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
Code Executor Alternatives — Similar Coding Agents Servers
Looking for alternatives to Code Executor? Here are other popular coding agents servers you can use with Claude, Cursor, and VS Code.
Dify
★ 142.2kProduction-ready platform for agentic workflow development.
Ruflo
★ 54.0k🌊 The leading agent orchestration platform for Claude. Deploy intelligent multi-agent swarms, coordinate autonomous workflows, and build conversational AI systems. Features enterprise-grade architecture, self-learning swarm intelligence, RAG integrat
Goose
★ 45.7kan open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
Antigravity Awesome Skills
★ 38.3kInstallable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.
AgentScope
★ 25.5kBuild and run agents you can see, understand and trust.
Serena
★ 24.5kA coding agent toolkit that provides IDE-like semantic code retrieval and editing tools, enabling LLMs to efficiently navigate and modify codebases using symbol-level operations instead of basic file reading and string replacements.
Browse More Coding Agents MCP Servers
Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Code Executor in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Code Executor?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.