MCP Catalogs
Home

mcp-python-interpreter

by yzfly·99·Score 44

MCP Python interpreter server enabling LLMs to run Python code, manage environments, and handle files with proper security isolation.

developer-toolsai-llmfile-system
36
Forks
2
Open issues
7 mo ago
Last commit
2d ago
Indexed

Overview

The MCP Python Interpreter is a robust server that enables AI models to interact with Python environments. It provides comprehensive functionality for code execution in different Python environments, package management, and file operations. The server implements security measures through isolated working directories and file path restrictions, making it suitable for development workflows. The documentation is thorough with clear examples and security considerations outlined.

Try asking AI

After installing, here are 5 things you can ask your AI assistant:

you:AI-assisted Python development with code execution and debugging
you:File operations and content generation in a secure sandboxed environment
you:Python environment and package management through LLM interactions
you:What security measures are in place?
you:Can I use different Python environments?

When to choose this

Choose this MCP server when you need to enable AI agents to execute Python code in a controlled environment, manage Python environments and packages, or work with files within a specific directory.

When NOT to choose this

Avoid using this server if you need broader system access outside the isolated working directory or require access to environments beyond Python.

Tools this server exposes

12 tools extracted from the README
  • list_python_environments

    List all available Python environments (system and conda)

  • list_installed_packages

    List packages installed in a specific Python environment

  • install_package

    Install a Python package in a specific environment

  • run_python_code

    Execute Python code in a specific environment

  • run_python_file

    Execute a Python file in a specific environment

  • read_file

    Read contents of any file type, with size and safety limits

  • write_file

    Create or overwrite files with text or binary content

  • write_python_file

    Create or overwrite a Python file specifically

  • list_directory

    List Python files in a directory

  • python_function_template

    Generate a template for a Python function

  • refactor_python_code

    Help refactor Python code

  • debug_python_error

    Help debug a Python error

Comparable tools

mcp-shellmcp-code-executormcp-sandbox

Installation

Install with pip:

pip install mcp-python-interpreter

Or with uv:

uv install mcp-python-interpreter

Claude Desktop Configuration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-python-interpreter": {
        "command": "uvx",
        "args": [
            "mcp-python-interpreter",
            "--dir",
            "/path/to/your/work/dir",
            "--python-path",
            "/path/to/your/python"
        ],
        "env": {
            "MCP_ALLOW_SYSTEM_ACCESS": 0
        },
    }
  }
}

FAQ

What security measures are in place?
The server operates within an isolated working directory specified with --dir parameter, has file size limits (up to 1MB), prevents writes outside the working directory, and includes explicit overwrite protection.
Can I use different Python environments?
Yes, the server lists and allows using different Python environments including system and conda environments through the list_python_environments tool.

Compare mcp-python-interpreter with

GitHub →

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