Labsco
MCP SERVER

Safe Local Python Executor

by maxim-saplin

Run model-written Python on your own machine without handing it eval() or your filesystem.

Sandboxed Code Execution
Summary
A code interpreter for Claude Desktop that sits between raw local Python and a full container.

The restricted import list is the whole design: arithmetic, dates, regex and statistics work, while file access and everything else does not. That makes it right for calculations and one-off scripting, and wrong for anything that needs to read your disk or hit the network — for those, a VM is still the honest answer.

What it is

A stdio server that wraps Hugging Face's LocalPythonExecutor from smolagents — a restricted Python runtime built for running code an LLM produced.

What you get
  • run_python — one tool that executes a snippet and returns the result
  • No file I/O: the executor refuses filesystem operations outright
  • Imports limited to a fixed list — collections, datetime, itertools, math, queue, random, re, stat, statistics, time, unicodedata
  • Runs locally under uv in a project venv, so there is no container to build and no remote runtime to sign up for
Requirements

Uv, and a clone of the repository. The server starts with uv run mcp_server.py, which creates the venv and pulls smolagents and mcp on first launch. No account, no API key.

Setup effort

One command — npx -y @smithery/cli install @maxim-saplin/mcp_safe_local_python_executor --client claude