home / mcp / code executor mcp server

Code Executor MCP Server

Provides an orchestration layer to access multiple MCP servers securely with sandboxed execution and on-demand loading.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "aberemia24-code-executor-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "code-executor-mcp"
      ],
      "env": {
        "DENO_PATH": "/home/user/.deno/bin/deno",
        "AUDIT_LOG_PATH": "/var/log/code-executor/audit.log",
        "PYTHON_ENABLED": "true",
        "MCP_CONFIG_PATH": "/absolute/path/to/.mcp.json",
        "ALLOWED_PROJECTS": "/home/user/projects:/tmp",
        "ENABLE_AUDIT_LOG": "true"
      }
    }
  }
}

You manage and run an all-in-one MCP server called Code Executor MCP. It lets you orchestrate multiple MCP servers from a single, sandboxed execution environment, dramatically reducing token usage while giving you secure, on-demand access to a wide range of tools. You can run the executor locally or in Docker, configure on-demand tool loading, and generate type-safe wrappers for easy integration.

How to use

Use the Code Executor MCP to run code and access MCP tools through a single, centralized executor. You interact with it from your client by invoking tool calls through the executor, which handles sandboxing, tool discovery, and on-demand loading. You can chain multiple tool calls in one execution, enable sampling for dynamic reasoning, and keep security controls in place to protect your environment.

How to install

Prerequisites: you need Node.js and NPM installed on your machine. If you plan to run the Docker container, you need Docker as well.

# Install the MCP server CLI globally
npm install -g code-executor-mcp

# Start the interactive setup (recommended)
code-executor-mcp setup

Alternative: install and run directly without the setup wizard.

# Install the MCP server globally
npm install -g code-executor-mcp

# Start the server (recommended direct start)
code-executor-mcp

Docker users can start quickly with the official image and customize via environment variables.

# Quick start with Docker
docker pull aberemia24/code-executor-mcp:latest
docker run -p 3333:3333 aberemia24/code-executor-mcp:latest

Configuration and usage notes

You can configure multiple MCP servers and merge global and project configurations. The example configuration shows how to run the core code executor along with additional MCPs like a filesystem server and a zen codereview server. The setup merges global MCPs from your home directory with project MCPs in your repository, giving you a unified list of accessible MCP servers.

{
  "mcpServers": {
    "code-executor": {
      "command": "npx",
      "args": ["-y", "code-executor-mcp"],
      "env": {
        "MCP_CONFIG_PATH": "/absolute/path/to/.mcp.json",
        "DENO_PATH": "/home/user/.deno/bin/deno"
      }
    },
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user"]
    },
    "zen": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/zen-mcp.git", "zen-mcp-server"],
      "env": {
        "GEMINI_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

Key usage patterns

- Load only needed MCPs to minimize token usage. For example, start with the code executor and add others on demand inside the sandbox.

- Use on-demand tool calls within your code to access filesystem, code review, or version control actions without loading all tools upfront.

- Enable type-safe wrappers to simplify calling MCP tools from TypeScript or Python, and keep wrappers up to date with daily syncs if you opt in.

Security and sandboxing

Code Executor MCP runs code in a sandboxed environment with strict access controls. It uses a Deno-based TypeScript sandbox and Pyodide WebAssembly for Python, with network access restricted by default and audit logging enabled. The system validates tool calls against live schemas and blocks dangerous patterns such as eval or dynamic imports.

Examples

Example: read a file, analyze with a language model, and commit changes in one flow.

const file = await callMCPTool('mcp__filesystem__read_file', { path: '/src/auth.ts' });
const review = await callMCPTool('mcp__zen__codereview', { code: file });
await callMCPTool('mcp__filesystem__write_file', { path: '/src/auth.ts', content: review.suggestions });
await callMCPTool('mcp__git__commit', { message: review.suggestions });

MCP Sampling and multi-agent workflows

You can enable LLM-assisted reasoning inside the sandbox to improve analysis and decision-making. This feature supports multiple providers and falls back to a paid API if needed.

const result = await callMCPTool('mcp__code-executor__executeTypescript', {
  code: `...`,
  enableSampling: true,
  allowedTools: ['mcp__filesystem__read_file']
});

Troubleshooting tips

If you encounter configuration issues, verify that your MCP config paths are correct and that the DENO_PATH is valid. Ensure environment variables required by the executors are present when starting the server.

Available tools

callMCPTool

Invoke a specific MCP tool by name with parameters; used to read files, write files, review code, commit changes, and more.

discoverMCPTools

Discover available MCP tools inside the sandbox without incurring token costs.

getToolSchema

Inspect the schema for a given MCP tool to understand required parameters and shapes.

executeTypescript

Execute TypeScript code within the sandbox with optional tool access and timeout.

executePython

Execute Python code within the Pyodide sandbox with optional tool access.