Code Runner MCP Server

Runs code snippets in dozens of languages on your machine and returns their output

By Jun Han (individual) TypeScript Local · stdio Developer tools

26 popularity score ★ 242 ↓ 1.0k/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add code-runner -- npx -y mcp-server-code-runner@latest
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "code-runner": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-code-runner@latest"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "code-runner": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-code-runner@latest"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "code-runner": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-code-runner@latest"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.code-runner]
command = "npx"
args = ["-y", "mcp-server-code-runner@latest"]
Gemini CLITerminal
gemini mcp add --scope user code-runner npx -- -y mcp-server-code-runner@latest
Local (Docker)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add code-runner -- docker run --rm -i formulahendry/mcp-server-code-runner
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "code-runner": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "formulahendry/mcp-server-code-runner"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "code-runner": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "formulahendry/mcp-server-code-runner"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "code-runner": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "formulahendry/mcp-server-code-runner"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.code-runner]
command = "docker"
args = ["run", "--rm", "-i", "formulahendry/mcp-server-code-runner"]
Gemini CLITerminal
gemini mcp add --scope user code-runner docker -- run --rm -i formulahendry/mcp-server-code-runner

What it does

Code Runner MCP Server gives an assistant one tool, run-code, that takes a snippet and a language ID, writes the snippet to a file in the operating system's temporary folder and runs it with that language's usual interpreter or compiler command (node, python -u, go run, ruby, bash, Rscript and so on). Whatever the program prints to standard output comes back as the result. It calls whatever toolchain is already installed rather than bringing its own.

The practical use is letting an assistant check a calculation, try a short script, or ask the machine about itself (its temp folder, CPU count) by writing and running a few lines. It runs over stdio by default; started with --transport http it serves Streamable HTTP instead, and a Docker image is published as well.

The source's language table (src/constants.ts) has 37 language IDs. It does not match the README's list exactly: the README names Elixir and Kotlin Script, but neither has an entry in the code, so the tool will not accept them.

What it needs

RuntimeNode.jsorDocker

Node.js with npx for the npm way (on Windows the README suggests bunx, which needs Bun, or wrapping npx in cmd /c). The interpreter or compiler for each language you want to run must already be on PATH; the server installs none. For the Docker way, Docker; the image adds only Python 3, Go, PHP and Ruby beside Node.

Limits

One tool only; there is no setting to limit languages, set a timeout, or cap output. In the code at src/server.ts every run writes to the same file name (tmp.<extension>) in the temp folder, so two runs at once in the same language can overwrite each other. Any text on standard error makes the call fail with that text, even when the program succeeds, and there is no way to pass stdin or command-line arguments. Python is started as `python`, not `python3`. The Docker image cannot run languages beyond what it ships. The README notes npx may fail to connect on Windows.

Who it suits

Suits a developer who wants an assistant to try out small snippets against the toolchains already on their own machine, and who will approve each run. Because snippets run with the user's own permissions and no sandbox, pick the Docker way to keep runs inside a container, or a sandboxed code-execution service, when the code might be untrusted or the machine holds anything sensitive. Not suited to long-running jobs, programs that need input or arguments, or projects with several files.

Tools 1

run-code
Write a snippet to a temp file, run it with the chosen language's interpreter, and return standard output

Similar servers