# code-runner

An MCP server that executes a snippet and hands the output back to your agent. Handy for checking a calculation or a function's behaviour without leaving the conversation.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed · ★ 242
- Author: formulahendry
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/formulahendry/mcp-server-code-runner
- Updated: 2026-02-05
- HTML: https://affpapa.org/en/nevibecode/mcp/code-runner

## What it does

code-runner exposes a `run-code` tool. The agent passes source code in, the server runs it on your machine, and the result lands in the chat. JavaScript, Python, PHP, Ruby, Go, Lua, PowerShell, BAT/CMD, BASH/SH, TypeScript, CoffeeScript, Scala, Swift, Julia, Crystal, R, Elixir, Clojure, Kotlin Script, Dart and Haskell are among the supported languages; the full set lives in `constants.ts` in the repo.

Two install routes: `npx` or a Docker container. Claude takes a single command, while Cursor and GitHub Copilot need a JSON block in their settings file. There is also a Streamable HTTP transport — install the package globally and start the server with `--transport http`.

The catch is `PATH`. Whatever interpreter or compiler you want to use has to be reachable there, otherwise the tool call fails with nothing to execute. Windows users hit a separate snag: `npx` sometimes refuses to connect an MCP server, and the README suggests switching to `bunx` or wrapping the call in `cmd /c`.

## Requirements
- Needs: Node.js (commands run via npx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add code-runner -- npx -y mcp-server-code-runner
```

### Codex

**Platform CLI**
```bash
codex mcp add code-runner -- npx -y mcp-server-code-runner
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "code-runner": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-server-code-runner"
            ]
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "code-runner": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "mcp-server-code-runner"
            ]
        }
    }
}
```

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add code-runner npx -y mcp-server-code-runner
```

## When to use it
- check a Python calculation without opening a terminal
- run a short Go or Ruby snippet and read the output
- find the temp folder path or CPU count by executing code
- compare how a function behaves in two languages
- execute a PowerShell or BASH script from inside the agent

## Example prompts
- Run the JavaScript code: `console.log(5+6)`
- Where is the temporary folder on my OS? Use the `run-code` tool
- How many CPUs does this machine have? Use `run-code`

## Similar
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47392
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43872
- [AIHawk](https://affpapa.org/en/nevibecode/mcp/aihawk.md) — MCP server · ★ 32221

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
