Python REPL MCP Server
# Python REPL MCP Server
This MCP server provides a Python REPL (Read-Eval-Print Loop) as a tool. It allows execution of Python code through the MCP protocol with a persistent session.
<a href="https://glama.ai/mcp/servers/jsorljnhdl">
<img width="380" height="200" src="https://glama.ai/mcp/servers/jsorljnhdl/badge" alt="Python REPL Server MCP server" />
</a>
## Setup
No setup needed! The project uses `uv` for dependency management.
## Running the Server
Simply run:
```bash
uv run src/python_repl/server.py
```
## Usage with Claude Desktop
Add this configuration to your Claude Desktop config file:
```json
{
"mcpServers": {
"python-repl": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/python-repl-server",
"run",
"mcp_python"
]
}
}
}
```
The server provides three tools:
1. `execute_python`: Execute Python code with persistent variables
- `code`: The Python code to execute
- `reset`: Optional boolean to reset the session
2. `list_variables`: Show all variables in the current session
3. `install_package`: Install a package from pypi
## Examples
Set a variable:
```python
a = 42
```
Use the variable:
```python
print(f"The value is {a}")
```
List all variables:
```python
# Use the list_variables tool
```
Reset the session:
```python
# Use execute_python with reset=true
```
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request. Here are some ways you can contribute:
- Report bugs
- Suggest new features
- Improve documentation
- Add test cases
- Submit code improvements
Before submitting a PR, please ensure:
1. Your code follows the existing style
2. You've updated documentation as needed
3. Maybe write some tests?
For major changes, please open an issue first to discuss what you would like to change.TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose with no overlap: execute_python runs code, install_package manages dependencies, and list_variables inspects the session state. An agent can easily tell them apart as they target different aspects of the Python REPL workflow.
All tools follow a consistent verb_noun pattern (execute_python, install_package, list_variables) with clear, descriptive names. The naming convention is uniform throughout the set, making it predictable and easy to understand.
With only 3 tools, the set feels thin for a Python REPL server, as it lacks operations like uninstalling packages, clearing variables, or handling errors. While the core functions are covered, the count is borderline low for the domain's typical scope.
The tools cover basic execution, package installation, and variable listing, but there are notable gaps: no way to update or remove packages, delete variables, or manage session state beyond listing. This could cause agent failures in more complex workflows.