mcpField
C
Code Runner MCP Server

Code Runner MCP Server

Local
npmjs.comDeveloper Tools242Updated 57w ago

About Code Runner MCP Server

Code Runner MCP Server is an MCP server that runs code snippets and returns their output. It supports a long list of programming languages and suits developers who want an AI assistant to execute code directly. The required interpreter or compiler must be available on the PATH environment variable.

Key features

  1. 01Supports many languages including JavaScript, Python, Go and Ruby
  2. 02Returns the output of executed code snippets
  3. 03Can be launched via npx or Docker
  4. 04Supports Streamable HTTP transport

Use cases

  1. 01Letting an AI assistant run a snippet and inspect the output
  2. 02Querying local environment details such as the temp folder or CPU count
  3. 03Testing code snippets from VS Code or Claude Desktop

MCP support

This is an MCP server that exposes a run-code tool to MCP clients for executing code and returning results.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"code-runner": {
"command": "npx",
"args": [
"-y",
"mcp-server-code-runner"
]
}
}
}
Run commandnpx -y mcp-server-code-runner

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmmcp-server-code-runner0.1.8
ocidocker.io/formulahendry/mcp-server-code-runner:0.1.8

Tools

1

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
codestringYesCode Snippet
languageIdenumYesLanguage IDjavascript | php | python | perl | perl6 | ruby | go | lua | groovy | powershell | bat | shellscript | fsharp | csharp | vbscript | typescript | coffeescript | scala | swift | julia | crystal | ocaml | r | applescript | clojure | racket | scheme | ahk | autoit | dart | haskell | nim | lisp | kit | v | sass | scss

Details

From the project README

Code Runner MCP Server

NPM Downloads smithery badge Docker Pulls

MCP Server for running code snippet and show the result.

It supports running multiple programming languages: JavaScript, PHP, Python, Perl, Perl 6, Ruby, Go, Lua, Groovy, PowerShell, BAT/CMD, BASH/SH, F# Script, C# Script, VBScript, TypeScript, CoffeeScript, Scala, Swift, Julia, Crystal, OCaml Script, R, AppleScript, Elixir, Clojure, Racket, Scheme, AutoHotkey, AutoIt, Kotlin Script, Dart, Haskell, Ni, Lisp, Kit, V, SCSS, Sass. Full list could be seen here in constants.ts.

mcp-server-code-runner MCP server

Setup

npx for VS Code

Install the Code Runner MCP server in VS Code using below buttons:

Install in VS Code Install in VS Code Insiders

Alternatively, you can add configuration in settings.json:

{
  "mcp": {
    "inputs": [],
    "servers": {
      "mcp-server-code-runner": {
        "command": "npx",
        "args": [
          "-y",
          "mcp-server-code-runner@latest"
        ],
      }
    }
  }
}
npx for Claude Desktop

Configuration in claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-server-code-runner": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-code-runner@latest"
      ],
    }
  }
}
Docker

Use VS Code as example. Install the Code Runner MCP server in VS Code using below buttons:

Install in VS Code Install in VS Code Insiders

Alternatively, you can add configuration in settings.json:

{
  "mcp": {
    "inputs": [],
    "servers": {
      "mcp-server-code-runner": {
        "command": "docker",
        "args": [
          "run",
          "--rm",
          "-i",
          "formulahendry/mcp-server-code-runner"
        ]
      }
    }
  }
}
npx issue on Widnows

On Windows, MCP servers may fail to connect with npx.

You could try below two workarounds:

use bunx
  1. Install Bun.
  2. In configuration, change npx with bunx.
use cmd

Below is VS Code configuration in settings.json:

{
  "mcp": {
    "inputs": [],
    "servers": {
      "mcp-server-code-runner": {
        "command": "cmd",
        "args": [
          "/c",
          "npx",
          "-y",
          "mcp-server-code-runner@latest"
        ],
      }
    }
  }
}

Run with Streamable HTTP Transport

npm install -g mcp-server-code-runner@latest
mcp-server-code-runner --transport http

Usage

Before using Code Runner MCP Server, please make sure interpreter or compiler of the programming language you want to run is set in PATH environment variable.

Try below prompts in the application which has configured Code Runner MCP Server:

  • Run the JavaScript Code: console.log(5+6)
  • Where is temporary folder in my OS? Use run-code tool
  • How many CPUs do I have in my machine? Use run-code tool

README image

README image

Build your own MCP Server

Want to build your own MCP Server? Try Yeoman Generator for MCP Server to create your MCP Server project!

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.