Python MCP
MCP Server to run python code locally
🔌 MCP Tools
Overview
python_local
Description:
A Python REPL environment server that executes code in persistent sessions
Category: Development Tools / Code Execution
Overview:
- Provides an interactive Python REPL environment with persistent sessions
- Maintains separate state for each session
- Captures stdout/stderr output
- Supports both expressions and statements
- Access to session history via custom repl:// URI scheme
- Each session's history viewable as text/plain resource
Installation & Configuration:
For MacOS:
~/Library/Application\ Support/Claude/claude_desktop_config.json
For Windows:
%APPDATA%/Claude/claude_desktop_config.json
Configuration JSON:
"python-local": {
"command": "path-to/python",
"args": ["path-to/python_local"],
"env": {
"PYTHON_PATH": "/usr/local/bin/python3"
}
}
Development Notes:
- Use MCP Inspector for debugging
- Debug command:
npx @modelcontextprotocol/inspector uv --directory /path/to/python_local run python-local
Key Features:
- Session management
- History tracking
- Python code execution
- Output capture
- State persistence
The server implements python_repl
tool requiring code
and session_id
arguments for execution.