CSOAI-ORG

Code Executor MCP Server

Community CSOAI-ORG
Updated

Sandboxed code execution: Python, JavaScript, and shell commands with safety guards, output capture, and timeout protection.

By MEOK AI Labs โ€” Sovereign AI tools for everyone.

Code Executor MCP Server

Sandboxed code execution for AI agents. Run Python, JavaScript, and shell commands with comprehensive safety guards, output capture, timeout protection, and file access restrictions. Built for production use with blocked destructive patterns and configurable limits.

Tools

Tool Description
execute_code Run Python or JavaScript code with safety checks and output capture
run_command Execute shell commands with destructive-pattern blocking
run_tests Run test suites (pytest, jest, etc.) with pass/fail summary
read_file Read files within allowed directories
list_sandbox_files List files in the execution sandbox
get_safety_rules View current blocked patterns and safety configuration

Safety Features

  • Blocks destructive shell commands: rm -rf /, fork bombs, pipe-to-shell
  • Blocks dangerous Python: os.system, subprocess, eval(input), raw sockets
  • Blocks dangerous JavaScript: child_process, require('fs'), eval()
  • File access restricted to Desktop, Documents, Downloads, /tmp
  • All execution happens in an isolated temp directory
  • Hard timeout cap at 60 seconds
  • Output truncated at 10KB to prevent memory issues

Installation

pip install mcp

Optional for JavaScript support:

brew install node  # or: apt install nodejs

Usage

Run the server

python server.py

Claude Desktop config

{
  "mcpServers": {
    "code-executor": {
      "command": "python",
      "args": ["/path/to/code-executor-mcp/server.py"]
    }
  }
}

Example calls

Execute Python:

Tool: execute_code
Input: {"code": "import math\nprint(f'Pi = {math.pi:.10f}')\nprint(f'e = {math.e:.10f}')", "language": "python"}
Output: {"output": "Pi = 3.1415926536\ne = 2.7182818285\n", "exit_code": 0, "elapsed_seconds": 0.045}

Run shell command:

Tool: run_command
Input: {"command": "ls -la /tmp | head -20"}
Output: {"output": "total 128\ndrwxrwxrwt ...", "exit_code": 0, "elapsed_seconds": 0.012}

Run tests:

Tool: run_tests
Input: {"test_command": "python -m pytest tests/ -v", "working_dir": "/path/to/project"}
Output: {"passed": true, "summary": "12 passed in 1.34s", "exit_code": 0}

Blocked command example:

Tool: run_command
Input: {"command": "rm -rf /"}
Output: {"error": "Command blocked by safety filter (matches: rm\\s+-rf\\s+/)"}

Pricing

Tier Limit Price
Free 50 executions/day, 30s timeout $0
Pro Unlimited, 120s timeout, Docker isolation $9/mo
Enterprise Custom + network access + GPU execution Contact us

License

MIT

MCP Server ยท Populars

MCP Server ยท New

    adelinamart

    RoBrain

    Shared memory across your team and your AI agents โ€” with judgment about what's worth keeping.

    Community adelinamart
    Lyellr88

    MARM: Local-First Persistent Multi-Agent Memory Layer for MCP Clients v2.20.0

    Self-hosted, local-first MCP memory server for AI agents. Sub-20ms recall at 10k memories, hybrid semantic + exact-syntax search (RAG), code & concept knowledge graphs (158 languages). All local in SQLite: no cloud, no vector DB, no API keys. Works with Claude Code, Codex, Cursor, Gemini & any MCP client.

    Community Lyellr88
    Bumblebiber

    hmem โ€” Humanlike Memory for AI Agents

    Persistent memory and agent lifecycle for Claude Code โ€” because sessions shouldn't start from zero.

    Community Bumblebiber
    firish

    Claude Code for Visual Studio

    Bring Claude Code to Visual Studio 2026: A native diff with accept/reject, a live debugger Claude can drive autonomously, Roslyn code navigation, and Test Explorer integration. The IDE half of Claude Code's integration protocol. Community-built, unofficial.

    Community firish
    uiNerd16

    @aicanvas/mcp

    Open-source React and Tailwind component marketplace. Install via the shadcn CLI or your AI editor over MCP, with reproduction prompts for Claude Code, Lovable, and V0.

    Community uiNerd16