mcp python interpreter
A Model Context Protocol server that allows LLMs to interact with Python environments, execute code, and manage files within a specified working directory.
A Model Context Protocol server that allows LLMs to interact with Python environments, execute code, and manage files within a specified working directory.
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.
You can install the MCP Python Interpreter using pip:
pip install mcp-python-interpreter
Or with uv:
uv install mcp-python-interpreter
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:
{
"mcpServers": {
"python-interpreter": {
"command": "uvx",
"args": [
"mcp-python-interpreter",
"--dir",
"C:pathtoyourworkingdirectory",
"--python-path",
"/path/to/your/python"
],
"env": {
"MCP_ALLOW_SYSTEM_ACCESS": 0
},
}
}
}
The --dir
parameter is required and specifies where all files will be saved and executed. This helps maintain security by isolating the MCP server to a specific directory.
uv
installed. If not, install it using:
curl -LsSf https://astral.sh/uv/install.sh | sh
powershell -ExecutionPolicy Bypass -Command "iwr -useb https://astral.sh/uv/install.ps1 | iex"
The Python Interpreter provides the following tools:
Here are some examples of what you can ask Claude to do with this MCP server:
The MCP Python Interpreter now supports comprehensive file operations: - Read text and binary files up to 1MB - Write text and binary files - Syntax highlighting for source code files - Hex representation for binary files - Strict file path security (only within the working directory)
This MCP server has access to your Python environments and file system. Key security features include: - Isolated working directory - File size limits - Prevented writes outside the working directory - Explicit overwrite protection
Always be cautious about running code or file operations that you don't fully understand.
MIT