mcp-python-executor
by bsmi021·★ 3·Score 30
An MCP server for executing Python code and managing packages with safety constraints.
Overview
The MCP Python Executor server provides a secure environment for executing Python code and managing packages. It features safety constraints like memory limits, execution timeouts, and concurrent execution limits. The server supports both inline code execution and script file execution, with options for input data and pre-installed packages. It includes resource monitoring, health checks, and structured logging capabilities.
Try asking AI
After installing, here are 5 things you can ask your AI assistant:
When to choose this
Choose this server when you need to execute Python code in AI environments with controlled resource limits and package management.
When NOT to choose this
Avoid if you need to install system packages or if you require execution of Python scripts with long-running processes (>30s timeout).
Tools this server exposes
2 tools extracted from the READMEexecute_pythonexecute_python(code?: string, scriptPath?: string, inputData?: string[])Execute Python code and return the results.
install_packagesinstall_packages(packages: string[])Install Python packages.
Comparable tools
Installation
Installation
- Clone the repository:
git clone https://github.com/bsmi021/mcp-python-executor.git
cd mcp-python-executor- Install dependencies:
npm install- Build the project:
npm run build- Configure in Claude Desktop:
Add to your claude_desktop_config.json:
{
"mcpServers": {
"mcp-python-executor": {
"command": "node",
"args": ["path/to/python-executor/build/index.js"],
"env": {
"PREINSTALLED_PACKAGES": "numpy pandas matplotlib scikit-learn",
"MAX_MEMORY_MB": "512",
"EXECUTION_TIMEOUT_MS": "30000",
"MAX_CONCURRENT_EXECUTIONS": "5",
"LOG_LEVEL": "info",
"LOG_FORMAT": "json"
}
}
}
}FAQ
- How can I specify custom Python packages to install?
- Use the PREINSTALLED_PACKAGES environment variable with space-separated package names, like 'numpy pandas matplotlib'
- What happens if my code exceeds the memory limit?
- The execution will be terminated automatically and an error message will be returned indicating the memory limit was exceeded
Compare mcp-python-executor with
Last updated · Auto-generated from public README + GitHub signals.