Run Python and install packages from natural language prompts.
https://next.hal9.ai/mcp/mcpbuild/run-python
First time connecting an MCP? See Installing MCPs for setup steps in Claude, Claude Code, and other clients.
run-python turns a plain-language request into real Python. Instead of shipping a script or a rigid schema, an agent (or a human) describes the calculation — including which libraries to install — and the MCP writes, installs, and runs the code:
install a package that calculates space orbits and compute the Hohmann transfer time from Earth to Mars and back, departing 2026-09-08
Under the hood, the prompt is passed to a language model with two tools:
install_packages and run_python. The model picks
PyPI packages (for example skyfield, astropy, or
poliastro), installs them into a sandbox, executes Python, and
returns the printed result.
Once connected, an agent can just ask in plain English. The MCP exposes two tools:
| Tool | Parameter | Description |
|---|---|---|
| install_packages | packages | List of PyPI names, optionally with extras or version pins |
| run_python | code | Python source to execute; results must be printed to stdout |
The agent doesn't need to call the tools directly with structured arguments — it can just be asked in plain English, and it will:
install_packages for PyPI libraries the code will importTypical uses: science and engineering calculations that need a library you don't have locally, quick numeric checks, or letting an agent install a package and compute something in one prompt.
run-python is open source and built on the Hal9 agent structure. You can run it yourself instead of using the hosted version:
cd run-python pip install -r requirements.txt export GROQ_API_KEY=… echo "print the first 10 primes" | python app.py
| Variable | Required |
|---|---|
| GROQ_API_KEY | Yes |
| GROQ_MODEL | No — defaults to qwen/qwen3.6-27b |
| PYTHON_TIMEOUT | No — seconds allowed for each run (default 60) |
| PIP_TIMEOUT | No — seconds allowed for pip install (default 180) |
| PACKAGES_DIR | No — directory for installed packages |
Code runs in a subprocess with a timeout. API keys and deploy tokens are not passed into the sandbox. Full source, deploy workflow, and contributing guide: github.com/hal9ai/mcp.build/tree/main/run-python
Connecting from Claude, Claude Code, Cursor, or another MCP client? Point it at the endpoint above — full step-by-step instructions live on the Installing MCPs page.