Python REPL is an MCP server that provides an interactive Python Read-Eval-Print Loop with persistent session state and automatic dependency management via uv. It connects Model Context Protocol clients directly to a local Python execution runtime, allowing AI agents to evaluate code snippets iteratively while retaining defined variables and imported modules across calls. Developers, data analysts, and AI practitioners use it to execute multi-step calculations, test algorithms, and prototype scripts without losing runtime context between queries. In addition to running arbitrary Python scripts, the server enables language models to inspect currently active session variables and install new packages directly from PyPI on demand. By maintaining environment persistence, it avoids the overhead of reloading libraries or re-evaluating heavy code segments during conversational agent workflows. The server handles package resolutions through uv, requiring minimal setup and offering an environment for running Python execution tasks within supported MCP client configurations.
Category: AI & LLM Tooling
Tags: execution, python, repl, scripting, uv
https://github.com/hdresearch/mcp-python. 3. Open your Claude Desktop configuration file and add the server definition under mcpServers: json { "mcpServers": { "python-repl": { "command": "uv", "args": [ "--directory", "/absolute/path/to/python-repl-server", "run", "mcp_python" ] } } } 4. Replace /absolute/path/to/python-repl-server with your real directory path. 5. Save the configuration and restart Claude Desktop.Part of MCP Servers
Python REPL provides a persistent Python runtime for MCP clients. It allows executing arbitrary Python code, preserving variables across multiple executions, listing all active session variables, resetting the execution session, and dynamically installing external packages from PyPI using uv.
You can clone the repository from GitHub and configure your client to run it via uv. In your Claude Desktop config file, set the command to uv and pass the directory path, run command, and mcp_python argument to launch the server.
Python REPL works with Claude Desktop and any standard Model Context Protocol client capable of launching local command-line processes via standard input and output.
Yes, Python REPL is open-source software available on GitHub under the hdresearch/mcp-python repository, where users can report issues, propose enhancements, or contribute code improvements.