Nearly everything is vibe-coded using https://eca.dev. This repo will not be properly maintained by me. Currently, it is just a playground!
An MCP (Model Context Protocol) server that provides a Python REPL with execution state.
This MCP server allows you to execute Python code while maintaining state between executions. Variables and globals persist within the server process but are not persisted to disk.
- Execute Python code with persistent global state
- Three available tools:
execute,get_globals, andreset_globals - State persists within the server process (resets on server restart)
- Python 3.12+
- uv package manager
make installOr using uv directly:
uv syncmake install-editableOr:
uv pip install -e .make runOr:
uv run python src/main.pyThe server will start and can be connected to via MCP clients.
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"pyrepl": {
"command": "uv",
"args": ["run", "python", "src/main.py"],
"env": {},
"cwd": "/path/to/mcp-pyrepl"
}
}
}The server exposes three tools:
Execute Python code and get the result.
# Example: Assign a variable
execute(code="x = 5")
# Returns: {"success": true, "result": "5", "globals_keys": ["x"]}
# Example: Use a previously assigned variable
execute(code="x * 2")
# Returns: {"success": true, "result": "10", "globals_keys": ["x"]}
# Example: Import and use a module
execute(code="import math; math.sqrt(16)")
# Returns: {"success": true, "result": "4.0", "globals_keys": ["x", "math"]}View all current global variables.
get_globals()
# Returns: {"x": "5", "math": "<module 'math' from ...>"}Clear all global variables and start fresh.
reset_globals()
# Returns: {"status": "globals reset"}| Command | Description |
|---|---|
make install |
Install dependencies with uv sync |
make install-editable |
Install package in editable mode |
make run |
Run the MCP server |
make test |
Run tests |
make lint |
Run linter |
make format |
Format code |
make all |
Run install, lint, format, and test |
- Variables persist within the server process only
- Server restart will reset all globals