execute_pythonLABSCO SUMMARY
Persistence is the feature: load the data once, then keep asking questions of it.
A stateless executor makes the model re-read the file on every call. Here a DataFrame loaded in step one is still in memory in step five, and list_variables lets the assistant check what it has rather than guess. install_package means a missing dependency is a one-line fix instead of a dead end.
What it is
A REPL exposed over MCP: code runs in one persistent session, and what you defined earlier is still there on the next call.
What you get
- execute_python runs code in the session, with a reset flag to clear it and start over
- list_variables shows everything currently defined
- install_package pulls a package from PyPI into the session
- State that survives between calls, so a variable set in one step is usable in the next
Requirements
uv, and a clone — the client launches it with uv run against the project directory. No setup beyond that, no key, no account. Code runs as your user with no sandbox, so treat it as running Python on your own machine.
Setup effort
One command — uvx mcp-python
USE CASES
Exploring a dataset over several questions
Load it once, then keep querying the same in-memory object instead of re-reading the file each time.
Getting past a missing dependency mid-task
Install the package from PyPI into the running session and carry on.
Checking what the session currently holds
List the variables so the assistant works from what is actually defined.
Starting clean after a bad experiment
Run with reset to clear the session rather than restarting the server.
3 tools
Listed in project docs. Your client may show a different list.
list_variablesinstall_packageBEFORE YOU INSTALL
What to know first
Tools you get
3 tools named in the project's documentation.
Requires
uvx on PATH
Where it runs
The documented client runs the server on your machine.
INSTALLATION
Connect your client
Server setup
uvx mcp-pythonMCP Clients
Claude Desktop
{
"mcpServers": {
"python-repl": {
"command": "uv",
"args": [
"--directory",
"<YOUR_PATH_TO_PYTHON_REPL_SERVER>",
"run",
"mcp_python"
]
}
}
}