An MCP server that executes Python code in isolated rootless containers with optional MCP server proxying. Implementation of Anthropic's and Cloudflare's ideas for reducing MCP tool definitions context bloat.
git clone https://github.com/elusznik/mcp-server-code-execution-mode.gitAn MCP server that executes Python code in isolated rootless containers with optional MCP server proxying. Implementation of Anthropic's and Cloudflare's ideas for reducing MCP tool definitions context bloat.
["Install the MCP server: `mcp install mcp-server-code-execution-mode` (requires Docker or Podman for containerization)","Prepare your Python code in a file (e.g., `script.py`) or paste it directly into the prompt. Include all dependencies in the prompt or as a requirements.txt file.","Execute with context: Add `[INPUT_DATA]` for stdin input or `[OUTPUT_FORMAT]` to specify JSON/YAML output. Example: `Use the server to run [script.py] with [INPUT_DATA='{\"filter\": \"West\"}'] and return [OUTPUT_FORMAT='json']`","For complex workflows, chain executions by referencing previous outputs: `Take the output from [PREVIOUS_EXECUTION] and run [script.py] with it as [INPUT_DATA]`","Monitor resource usage: The server provides real-time memory/CPU metrics. For long-running tasks, add `[TIMEOUT=300]` to limit execution time."]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/elusznik/mcp-server-code-execution-modeCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Use the mcp-server-code-execution-mode to execute the following Python code in an isolated container: [PYTHON_CODE]. If the code requires external dependencies, specify them as [DEPENDENCIES]. For complex workflows, chain multiple executions with [INPUT_DATA] and [OUTPUT_FORMAT].
```python
# Example: Data Processing Pipeline
import pandas as pd
import numpy as np
# Input data (simulated)
sales_data = pd.DataFrame({
'date': pd.date_range(start='2023-01-01', periods=100),
'product_id': np.random.choice(['A100', 'B200', 'C300'], 100),
'revenue': np.random.uniform(1000, 5000, 100).round(2),
'region': np.random.choice(['North', 'South', 'East', 'West'], 100)
})
# Data processing
processed = (
sales_data
.groupby(['product_id', 'region'])
.agg({'revenue': ['sum', 'mean', 'count']})
.reset_index()
)
# Output
processed.columns = ['product_id', 'region', 'total_revenue', 'avg_revenue', 'transaction_count']
processed['total_revenue'] = processed['total_revenue'].round(2)
processed['avg_revenue'] = processed['avg_revenue'].round(2)
print("Top 5 Revenue-Generating Product-Region Pairs:")
print(processed.nlargest(5, 'total_revenue').to_string(index=False))
```
**Execution Log:**
- Container: Ubuntu 22.04 (rootless, 2GB RAM)
- Dependencies: pandas==2.0.3, numpy==1.24.3 (installed via pip in 8s)
- Runtime: 1.2s
- Memory Usage: 142MB peak
**Output:**
```
Top 5 Revenue-Generating Product-Region Pairs:
product_id region total_revenue avg_revenue transaction_count
A100 West 24567.89 2456.79 10
B200 North 22345.67 2234.57 10
C300 South 21890.12 2189.01 10
A100 East 20123.45 2012.35 10
B200 West 19876.54 1987.65 10
```
**Security Notes:**
- Filesystem: Ephemeral (no persistence after execution)
- Network: Disabled by default (enable with --allow-network if needed)
- User: Non-root (UID 1000)Book house cleaning services
Container platform for building, sharing, and running applications
Unlock data insights with interactive dashboards and collaborative analytics capabilities.
Protect and enhance web performance with DDoS protection, firewalls, and content delivery.
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan