MCP Code Execution Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Code Execution Server
A powerful, secure, and stateful code execution server for the Model Context Protocol (MCP).
This server turns your AI assistant into a capable data analyst by providing:
Stateful Python Execution: Define variables and use them in subsequent calls (REPL-style)
Data Visualization: Automatically captures
matplotlibplots and returns them as imagesFile System Access: Read and write files securely within a dedicated workspace
Package Management: Install any Python package on the fly
Inspired by: Code Execution with MCP - Anthropic's article on implementing code execution with MCP
Quick Start
Prerequisites
uv (Recommended) or Python 3.10+
Installation
# Clone the repository
git clone https://github.com/ozgureyilmaz/mcp-executor.git
cd mcp-executor
# Create virtual environment and install dependencies
uv venv
uv pip install -e .Related MCP server: MCP Python Interpreter
Usage
Running the Server
The server communicates via stdio. To use it with an MCP client (like Claude Desktop), configure it as follows:
{
"mcpServers": {
"executor": {
"command": "/Users/yourusername/dev/mcp-executor/.venv/bin/python",
"args": ["-m", "mcp_executor.server"],
"cwd": "/Users/yourusername/dev/mcp-executor"
}
}
}Important: Replace /Users/yourusername/dev/mcp-executor with your actual project path.
Available Tools
Tool | Description |
| Execute Python code. Preserves state between calls. Returns text output and plots. |
| Install a Python package (e.g., |
| Read a file from the |
| Write content to a file in the |
| List files in the |
Examples
Check the examples/ directory for usage examples.
Security
Workspace Isolation: File operations are strictly limited to the
./workspacedirectoryLocal Execution: Code runs locally on your machine. Ensure you trust the code being executed
Package Installations: Packages are installed in the isolated virtual environment
Project Structure
mcp-executor/
├── src/
│ └── mcp_executor/
│ ├── __init__.py # Package initialization
│ ├── __main__.py # Direct module execution
│ ├── server.py # MCP server implementation
│ └── execution.py # Code execution layer
├── examples/ # Example scripts
├── pyproject.toml # Project configuration
└── README.md # This fileResources
Code Execution with MCP - Anthropic's article that inspired this project
License
MIT License - See LICENSE file for details
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent cloud workspaces for AI agents: run commands, edit files, use git and a browser.
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Run Python code in a secure sandbox without local setup. Declare inline dependencies and execute s…
Give your agent a persistent workspace: files, a code sandbox and a public URL to publish to.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceEnables LLMs to interact with Python environments, execute code or scripts, manage packages, and read/write files within an isolated working directory.-
- FlicenseNot gradedqualityAmaintenanceEnables LLMs to manage Python environments, execute code and scripts, install packages, and read or write files within an isolated working directory.-
- FlicenseNot gradedqualityAmaintenanceEnables LLMs to manage Python environments, execute code and scripts, install packages, and read or write files within an isolated working directory.-
- FlicenseNot gradedqualityAmaintenanceEnables LLMs to interact with Python environments, execute code or scripts, manage packages, and read/write files within an isolated working directory.-