python-sandbox-mcp-server
This is a secure Python code execution server that enables LLMs to run Python code safely in isolated Docker containers, supporting stdout capture and Matplotlib PNG generation.
README
Python Sandbox MCP Server
A secure Python code execution server that enables LLMs to run Python code safely in isolated Docker containers. The server supports:
- Regular Python code execution with stdout capture
- Matplotlib plotting with PNG image generation
- Secure sandboxing via Snekbox Docker container
- Real-time communication using Server-Sent Events (SSE)
Development
To get started with development, follow these steps:
Step 1: Clone the Repository
Fork and clone the repository:
git clone https://github.com/username/python_sandbox_mcp_server.git
Navigate into the project directory:
cd python_sandbox_mcp_server
Step 2: Install Dependencies
Install the required dependencies:
uv add -r requirements.txt
Step 3: Build the Python Sandbox
Pull the Snekbox Container Image:
docker pull ghcr.io/python-discord/snekbox:latest
Start the Container with Security Parameters:
docker run -d --ipc=none --privileged -p 8060:8060 ghcr.io/python-discord/snekbox
Install Additional Dependencies (Optional):
- If additional Python packages are required, you can install them as follows:
docker exec <container_id> /bin/sh -c \
'PYTHONUSERBASE=/snekbox/user_base /snekbox/python/default/bin/python -m pip install --user <package_name>'
- Replace <container_id> with the ID of your running Snekbox container and <package_name> with the desired package.
Step 4: Update MCP Server Configuration
Update your MCP server configuration to point to the local build:
{
"mcpServers": {
"python-sandbox-sse": {
"command": "mcp-proxy",
"args": [
"http://localhost:8060/eval"
],
"ssePath": "/eval"
}
}
}
Configuration
The server can be configured through the following environment variables or by modifying the Config class:
MCP_SERVER_NAME: Server identifier (default: "python-sandbox-mcp-sse")SNEKBOX_URL: Snekbox API endpoint (default: "http://localhost:8060/eval")TEMP_DIR: Directory for temporary files storage
License
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
