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.
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:
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 READMElist_python_environmentsList all available Python environments (system and conda)
list_installed_packagesList packages installed in a specific Python environment
install_packageInstall a Python package in a specific environment
run_python_codeExecute Python code in a specific environment
run_python_fileExecute a Python file in a specific environment
read_fileRead contents of any file type, with size and safety limits
write_fileCreate or overwrite files with text or binary content
write_python_fileCreate or overwrite a Python file specifically
list_directoryList Python files in a directory
python_function_templateGenerate a template for a Python function
refactor_python_codeHelp refactor Python code
debug_python_errorHelp debug a Python error
Comparable tools
Installation
Install with pip:
pip install mcp-python-interpreterOr with uv:
uv install mcp-python-interpreterClaude 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
Last updated · Auto-generated from public README + GitHub signals.