Labsco
MCP SERVER

Python Local

by Alec2435

Give the model a persistent Python REPL, so variables from one call are still there in the next.

Sandboxed Code Execution
Summary
Persistent sessions are the difference between a calculator and a workspace.

Because state survives between calls, a model can load a dataframe once and keep poking at it, instead of rebuilding context in every snippet — and the readable history resource means you can see exactly what it ran. Treat it as a local shell with the same trust level: point it at a machine and directory you would be comfortable letting the model write to.

What it is

A small MCP server that exposes an interactive Python read-eval-print loop. State is kept per session, so a value defined in one call is still in scope for the next one.

What you get
  • `python_repl` — runs Python code in a named session, taking `code` and `session_id`
  • Separate state per session, so two lines of work do not collide
  • Expressions and statements both work, and stdout and stderr come back with the result
  • Session history exposed as a `repl://` resource, showing each input and its output
Requirements

The `python-local` package, run with uv or uvx. Code executes in the server's own Python process on your machine, with whatever that interpreter can reach — there is no sandbox in front of it.

Setup effort

One command — uvx python-local