Registry / ai-ml / mcp-server-code-runner

mcp-server-code-runner

JSON →
library0.1.8jsnpmunverified

The `mcp-server-code-runner` package provides a server designed to execute code snippets across a vast array of programming languages, including JavaScript, Python, PHP, Go, Ruby, TypeScript, and many others, then display their results. It acts as an MCP (Model Context Protocol) server, integrating with compatible AI clients and development environments like VS Code or Claude Desktop to offer real-time code execution capabilities. While the current version 0.1.8 suggests an early-stage or pre-1.0 development phase, it is actively maintained and serves as a powerful utility for agents requiring quick, sandboxed code execution. Its key differentiators include extensive language support (over 30 languages) and flexible deployment options via `npx` or Docker, making it highly adaptable for various AI-driven development and testing workflows.

npm install mcp-server-code-runner
INSTALL
IMPORT
SIG · MCP-SERVER-CODE-RU
M
mcp-server-code-runner
ai-mljavascriptv0.1.8
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

npx Command Invocation
npx -y mcp-server-code-runner@latest
mcp-server-code-runner
This package is a server application, not a library meant for direct JS import. This entry describes the common command-line invocation pattern to run the server via npx. The `-y` flag is for automatic confirmation.
VS Code MCP Server Configuration
{ "mcp": { "inputs": [], "servers": { "mcp-server-code-runner": { "command": "npx", "args": [ "-y", "mcp-server-code-runner@latest" ] } } } }
{ "mcp-server-code-runner": { "command": "npx" } }
This JSON snippet illustrates how to configure the Code Runner MCP server within VS Code's `settings.json` to enable an AI agent to use it. The full `mcp` object structure is crucial.
Docker Invocation
docker run --rm -i formulahendry/mcp-server-code-runner
docker run formulahendry/mcp-server-code-runner
This command demonstrates running the MCP server using Docker. The `--rm` flag ensures the container is removed on exit, and `-i` keeps stdin open. This provides an isolated execution environment.

This quickstart demonstrates configuring the `mcp-server-code-runner` within VS Code's `settings.json` to enable code execution capabilities for AI agents. This JSON structure registers the server to be run via `npx` on demand.

{ "mcp": { "inputs": [], "servers": { "mcp-server-code-runner": { "command": "npx", "args": [ "-y", "mcp-server-code-runner@latest" ] } } } }
Debug
Known issues
gotchaWhen running `mcp-server-code-runner` via `npx` on Windows, users may encounter issues related to PowerShell execution policies or `npx` not being found in the PATH, especially with Node.js version managers like nvm, fnm, or volta.
fix
Adjust PowerShell execution policies (e.g., `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser`). Ensure Node.js and `npx` are correctly installed and added to your system's PATH. For some environments, explicitly calling `cmd.exe /c npx ...` in the MCP server configuration might be necessary to ensure proper shell handling.
affects: >=0.1.0
gotchaThe server executes code locally on your machine. While powerful, this means executed code has potential access to your files or system resources. Running untrusted code without proper sandboxing can pose security risks, especially with AI agents.
fix
Always use a reputable MCP client that prompts for explicit human confirmation before executing code. Consider running the server inside a Docker container for an isolated execution environment. Review the source code on GitHub for trusted servers.
affects: >=0.1.0
gotchaTo execute code in various programming languages, ensure that the respective language interpreter or compiler (e.g., Node.js for JavaScript, Python executable for Python) is installed and correctly configured in your system's PATH environment variable. The server relies on these external tools.
fix
Verify that all necessary language runtimes are installed. Check your system's PATH environment variable to ensure the directories containing the interpreters/compilers are included. For Node.js, ensure version 18 or later is installed for optimal `npx` functionality.
affects: >=0.1.0
Errors
Common errors & fixes
failed to start command: exec: "npx": executable file not found in $PATH
The `npx` command-line tool is not installed or not accessible in the system's PATH environment variable.
fix
Install Node.js (which includes npm and npx) version 18 or later. Verify installation with `node -v` and `npx -v`. Ensure Node.js's installation directory is in your system's PATH.
Error: spawn npx ENOENT
The MCP client cannot correctly find the `npx` command in your system's PATH, often due to how child processes inherit environment variables, especially on Windows or with Node.js version managers like fnm.
fix
Ensure `npx` is installed and the Node.js executable path is fully discoverable by the environment starting the MCP server. On Windows, try explicitly setting the `command` in your MCP server configuration to `cmd.exe` and passing `/c` before `npx` (e.g., `"command": "cmd.exe", "args": ["/c", "npx", "-y", "mcp-server-code-runner@latest"]`).
Cannot run program "C:\Program Files\nodejs\npx": CreateProcess error=193, %1 is not a valid Win32 application
This error can occur on Windows when the environment tries to execute `npx` in an incompatible mode (e.g., x86 on an x64 machine) or if the `npx` executable itself is corrupted or incorrectly linked.
fix
Ensure your Node.js installation is correct for your system's architecture. Reinstall Node.js if necessary. Verify that no other Node.js tasks are interfering. Consider the `cmd.exe /c npx` workaround as described for 'spawn npx ENOENT' to ensure correct shell context.
Upgrade
Version history
0.1.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
mcp-server-code-runner — npm install mcp-server-code-runner · libregistry