About
A lightweight MCP server that safely runs arbitrary Python code for LLMs, capturing stdout and generating Matplotlib PNGs within a Snekbox sandbox, with real‑time updates via Server‑Sent Events.
Capabilities

Overview
The Python Sandbox MCP Server is a dedicated execution engine that lets large language models (LLMs) run arbitrary Python code in a tightly controlled, isolated environment. By leveraging Docker containers and the Snekbox runtime, it guarantees that user‑supplied scripts cannot escape or compromise the host system. This capability is essential for developers who want to embed dynamic code evaluation, data analysis, or visualisation directly into conversational AI workflows without exposing their infrastructure to risk.
At its core, the server exposes a simple HTTP endpoint that accepts Python source code and returns stdout, error traces, and any generated images. When a model instructs the server to evaluate a snippet, the request is forwarded to Snekbox’s API. The container runs the code with a strict resource quota, captures standard output, and streams intermediate results back to the client through Server‑Sent Events (SSE). This real‑time channel allows the LLM to provide step‑by‑step feedback or to stream large outputs such as plots without waiting for the entire execution to finish.
Key features include:
- Safe isolation – Docker’s IPC and privilege restrictions prevent filesystem or network access beyond the sandbox.
- Plot support – Matplotlib commands are executed inside the container, and resulting PNG images are returned to the client as binary blobs that can be embedded in chat messages.
- SSE integration – Developers can build responsive interfaces where the model reacts to incremental output, enabling richer interactions such as live debugging or progressive visualisation.
- Extensibility – The server can be configured to use any Snekbox image or custom packages, allowing teams to tailor the environment to their domain libraries.
Typical use cases span from educational tools that let students run code snippets in a chat tutor, to data science assistants that generate plots on demand, or even automated code review systems where an LLM can execute and test user‑submitted patches. By abstracting the complexities of sandbox management, the Python Sandbox MCP Server lets developers focus on crafting intelligent prompts while trusting that code execution remains secure and reliable.
Related Servers
MarkItDown MCP Server
Convert documents to Markdown for LLMs quickly and accurately
Context7 MCP
Real‑time, version‑specific code docs for LLMs
Playwright MCP
Browser automation via structured accessibility trees
BlenderMCP
Claude AI meets Blender for instant 3D creation
Pydantic AI
Build GenAI agents with Pydantic validation and observability
Chrome DevTools MCP
AI-powered Chrome automation and debugging
Weekly Views
Server Health
Information
Explore More Servers
ASR MCP Server
Real-time speech recognition with Whisper via MCP
Edgee
MCP Server: Edgee
Spurs Blog MCP Server
AI assistant access to Spurs game results and blog updates
Memory MCP Server (Go)
Persist knowledge graphs for AI assistants
Mcp Omnisearch
Unified search and AI answer hub
Test Server MCP
Simple note storage and summarization for MCP clients