mcp-python-interpreter

MCP.Pizza Chef: yzfly

Ten commands cover running code or whole script files, keeping a session's variables alive between messages, listing and switching Python setups, installing packages, and reading, writing, and listing files. Reading and writing really is confined to the one folder you nominate, which is a genuine and welcome guard. Code is not: anything it runs has the full reach of your own user account, including your files and the internet, and installing a package downloads and runs someone else's code. The time limit is ignored for quick in-chat runs, so a stuck loop hangs the server.

Coding
Data

Use This MCP server To

Run a quick calculation and show me the answer Turn a messy spreadsheet export into a clean file Test a small script before I rely on it Chart some numbers and save the picture to my folder Install a package I need and try it out Keep my variables between messages while exploring data

README

MseeP.ai Security Assessment Badge

MCP Python Interpreter

A Model Context Protocol (MCP) server that allows LLMs to interact with Python environments, read and write files, execute Python code, and manage development workflows.

Features

  • Environment Management: List and use different Python environments (system and conda)
  • Code Execution: Run Python code or scripts in any available environment
  • Package Management: List installed packages and install new ones
  • File Operations:
    • Read files of any type (text, source code, binary)
    • Write text and binary files
  • Python Prompts: Templates for common Python tasks like function creation and debugging

Installation

You can install the MCP Python Interpreter using pip:

pip install mcp-python-interpreter

Or with uv:

uv install mcp-python-interpreter

Usage with Claude Desktop

  1. Install Claude Desktop
  2. Open Claude Desktop, click on menu, then Settings
  3. Go to Developer tab and click "Edit Config"
  4. Add the following 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
        },
    }
  }
}

For Windows:

mcp-python-interpreter FAQ

Which apps does it work in?
The guide covers Claude Desktop, and any app that can start a local command should work.
Do I need a key or an account?
Neither, and nothing costs money. It uses the Python already installed on your computer.
Can I use this to clean up a data file?
Yes — you nominate a folder, and it can read the file, run code over it, and write the tidied result back into the same place.
Is the code it runs sandboxed?
No. Anything it runs has the same reach you do, including every file on the computer and the internet, so only use it with prompts and files you trust.
Does the folder limit actually work?
For the file commands, yes — reading, writing, and listing outside your chosen folder really are refused unless you switch on system-wide access. Code you run is not held to that limit.
Can it install software by itself?
Yes, and there is no confirmation step, so it will download and run somebody else's package the moment it decides one is needed.
What happens if code gets stuck in a loop?
For quick in-chat runs the time limit is accepted but never applied, so the server can hang until you restart it. Running a saved file does respect the limit.
How hard is setup?
You install the uv tool, then paste a snippet naming your working folder, so expect a few terminal steps.
Is the write-up current?
Not entirely. It still lists a separate command for creating Python files that no longer exists, and it leaves out the newer session commands.