MCP Safe Local Python Executor logo

MCP Safe Local Python Executor

by maxim-saplin

Runs LLM-generated Python locally through a restricted executor exposed as an MCP tool, without Docker or a VM.

Install MCP Safe Local Python Executor

Pick your client, then add it in one click or paste the config.

No confirmed install command yet

We only publish a config when the install details come from the project itself — its README, its docs, or a verified owner. We haven’t found those for maxim-saplin/mcp_safe_local_python_executor, and we’d rather show nothing than a guess you’d paste into your client.

Open setup steps on GitHub

Overview

The maxim-saplin/mcp_safe_local_python_executor MCP server exposes Hugging Face Smolagents' LocalPythonExecutor through a stdio MCP tool. It provides a `run_python` tool for executing generated Python with no file I/O and a restricted import list. The server runs locally through `uv` and does not require Docker or a virtual machine. Reach for it when an MCP client needs basic local code execution for calculations or data manipulation, while recognizing that a container or VM may provide stronger isolation.

Use cases

  • Calculate mathematical results with generated Python
  • Generate number sequences such as prime lists
  • Solve equations using the local interpreter
  • Add a restricted code interpreter to an MCP client

Key features

  • Exposes a run_python MCP tool
  • Uses Smolagents LocalPythonExecutor
  • Runs locally over stdio with uv
  • Blocks file I/O operations
  • Restricts available Python imports

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 2d ago

Recent health check succeeded.

13/17 checks healthy over the last 79d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 8/23/2026 via OSV.dev

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars48Stargazers on the source repository.
Last commit1y agoMost recent push to the default branch.
Directory activity5 viewsConfig copies, upvotes, and views on AllMCPs.

How MCP Safe Local Python Executor works

What maxim-saplin/mcp_safe_local_python_executor does

The maxim-saplin/mcp_safe_local_python_executor MCP server makes a restricted Python runtime available to MCP-compatible applications. It wraps Hugging Face Smolagents' LocalPythonExecutor rather than invoking the regular Python interpreter directly. The exposed run_python tool is intended for code generated by an LLM and supports tasks such as calculations, generating number sequences, and solving equations.

The project is designed for local use. It does not depend on Docker or a virtual machine, and it can add a Python execution tool to clients such as Claude Desktop and Cursor. The maxim-saplin/mcp_safe_local_python_executor MCP server is therefore relevant when an agent needs an embedded code interpreter for straightforward computation without sending code to a third-party runtime.

How it works

The server communicates over MCP's stdio transport. When started, it uses LocalPythonExecutor from the Smolagents framework to process Python supplied through the MCP tool. This executor is intended to provide more control than directly evaluating arbitrary Python code.

Execution disallows file I/O operations. Imports are limited to the following modules: collections, datetime, itertools, math, queue, random, re, stat, statistics, time, and unicodedata. This restriction makes the runtime more constrained than a normal local Python environment, so scripts that depend on other packages, filesystem access, or broader operating-system functionality are not suitable.

The restrictions should not be treated as equivalent to a VM or container boundary. The project documentation describes the local executor as a security and convenience compromise, and recommends stronger isolation approaches when the risk of running generated code warrants them.

Setup and configuration

Install uv, clone the repository, and change into the project directory. Running uv run mcp_server.py creates the virtual environment as needed and installs the listed dependencies, including Smolagents and MCP. The same command starts the stdio server.

For Claude Desktop, add an MCP server entry whose command is uv, with arguments that select the cloned project directory and run mcp_server.py. The directory value must point to the local checkout; the example path in the project documentation is a placeholder. Restart Claude Desktop after saving the configuration. The Python executor should then appear as an available tool.

The maxim-saplin/mcp_safe_local_python_executor MCP server does not document API keys, OAuth credentials, or required environment variables. It is operated from the local Python environment created by uv.

Tools and capabilities

  • Exposes one documented MCP tool, run_python.
  • Executes Python through Smolagents' restricted local executor.
  • Supports basic calculations and other code that stays within the permitted runtime.
  • Blocks file I/O operations.
  • Allows imports only from the documented module list.
  • Works with Claude Desktop, Cursor, and other MCP-compatible clients.

Limitations and notes

This is not a general-purpose Python environment. The import allowlist and disabled file operations prevent many scripts from running, and the documentation does not claim complete security isolation. Generated code still runs on the user's machine, so users should assess the risks of allowing an agent to execute code locally. A Docker container or VM may be a better choice when stronger separation is required, although those approaches add setup and resource costs.

The maxim-saplin/mcp_safe_local_python_executor MCP server is provided as a local stdio process rather than a hosted execution service. Its documented installation flow requires the repository and uv; no hosted endpoint or external execution account is described.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about MCP Safe Local Python Executor

Install uv, clone the repository, enter its directory, and run `uv run mcp_server.py`. The command creates a virtual environment and installs the dependencies.

Yes. The README provides Claude Desktop configuration using `uv` and the local project directory, followed by `uv run mcp_server.py`.

The documented allowlist includes collections, datetime, itertools, math, queue, random, re, stat, statistics, time, and unicodedata.

No. The project states that file I/O operations are not allowed.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMCP Safe Local Python Executor AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/maxim-saplin-mcp-safe-local-python-executor?style=directory)](https://allmcps.com/mcp/maxim-saplin-mcp-safe-local-python-executor)
HTML Embed
<a href="https://allmcps.com/mcp/maxim-saplin-mcp-safe-local-python-executor"><img src="https://allmcps.com/api/badge/maxim-saplin-mcp-safe-local-python-executor?style=directory" alt="MCP Safe Local Python Executor on AllMCPs" /></a>