code-executor

code-executor

An MCP server that allows LLMs to execute Python code within a specified Conda environment.

207
Stars
39
Forks
0
Releases

Overview

The MCP Code Executor is an MCP server that allows LLMs to execute Python code within a specified Python environment. This enables LLMs to run code with access to libraries and dependencies defined in the environment. It also supports incremental code generation for handling large code blocks that may exceed token limits. The server can run code within environments such as Conda, standard virtualenvs, or UV virtualenvs, and can install missing dependencies on demand. Code is stored in a configurable storage directory, and the environment can be dynamically reconfigured at runtime. The setup requires Node.js and a chosen environment (Conda, virtualenv, or UV virtualenv). Configuration supports Node.js and Docker deployment. A set of tools is exposed to LLMs for code execution, dependency management, and code file handling (initialize, append, read, execute). This enables LLMs to generate and execute multi-part code while maintaining a structured workflow.

Details

Owner
bazinga012
Language
JavaScript
License
MIT License
Updated
2025-12-07

Features

Execute Python code from LLM prompts

Runs Python code generated by LLM prompts within the configured environment.

Support for incremental code generation

Allows handling large code blocks by incrementally building code across multiple calls.

Run code within a specified environment

Supports Conda, standard virtualenv, or UV virtualenv environments to control dependencies and isolation.

Install dependencies when needed

Installs missing Python packages into the active environment as required by the executed code.

Check if packages are already installed

Provides a utility to verify presence of required packages before installation.

Dynamically configure the environment at runtime

Allows changing the active environment configuration on the fly (type, env name, paths).

Configurable code storage directory

Stores generated code in a user-specified directory for persistence and later execution.

Tags

mcpcode-executorpythoncondavirtualenvuvllmcode-storageincremental-code-generation