MCP Catalogs
Home

mcp-python-executor

by bsmi021·3·Score 30

An MCP server for executing Python code and managing packages with safety constraints.

developer-toolsai-llmproductivity
1
Forks
0
Open issues
15 mo ago
Last commit
2d ago
Indexed

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:

you:Data analysis workflows in AI assistants using Python libraries like pandas and numpy
you:Educational environments for teaching Python programming with safety constraints
you:Prototyping machine learning models in restricted execution environments
you:How can I specify custom Python packages to install?
you:What happens if my code exceeds the memory limit?

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 README
  • execute_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

python-shellexec-mcpjupyter-mcp

Installation

Installation

  1. Clone the repository:
git clone https://github.com/bsmi021/mcp-python-executor.git
cd mcp-python-executor
  1. Install dependencies:
npm install
  1. Build the project:
npm run build
  1. 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

GitHub →

Last updated · Auto-generated from public README + GitHub signals.