An MCP server providing a persistent Python REPL session.
pip install mcp-py-repl
mcp-py-repl
You can run the REPL server using Docker:
docker pull ghcr.io/evalstate/mcp-py-repl
docker run -it ghcr.io/evalstate/mcp-py-repl
The container includes:
- Python 3.12
- UV package manager for fast dependency installation
- Pre-configured environment for MCP
- Persistent Python session
- Package installation via UV
- Variable inspection
- Directory awareness via MCP roots
This server is intended to be used via Docker.
args:
[
"run",
"-i",
"--rm",
"--pull=always",
"-v",
"./test_data:/mnt/data/",
"ghcr.io/evalstate/mcp-py-repl:latest",
]
The server provides three tools:
-
execute_python
: Execute Python code with persistent variablescode
: The Python code to executereset
: Optional boolean to reset the session
-
list_variables
: Show all variables in the current session -
install_package
: Install a package from pypi
Set a variable:
a = 42
Use the variable:
print(f"The value is {a}")
List all variables:
# Use the list_variables tool
Reset the session:
# Use execute_python with reset=true
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:
- Your code follows the existing style
- You've updated documentation as needed
- Maybe write some tests?
For major changes, please open an issue first to discuss what you would like to change.