用于运行代码片段并显示结果的MCP服务器。
它支持多种编程语言:JavaScript、PHP、Python、Perl、Perl 6、Ruby、Go、Lua、Groovy、PowerShell、BAT/CMD、BASH/SH、F# 脚本、C# 脚本、VBScript、TypeScript、CoffeeScript、Scala、Swift、Julia、Crystal、OCaml 脚本、R、AppleScript、Elixir、Clojure、Racket、Scheme、AutoHotkey、AutoIt、Kotlin 脚本、Dart、Haskell、Ni、Lisp、Kit、V、SCSS、Sass。完整的列表可以在 constants.ts 中查看。
<a href="https://glama.ai/mcp/servers/d3mluq4vy9"> <img width="380" height="200" src="https://gips2.baidu.com/it/u=1378948258,1812652707&fm=3081&app=3081&f=PNG?w=760&h=400" alt="mcp-server-code-runner MCP 服务器" /> </a>通过以下按钮在 VS Code 中安装 Code Runner MCP 服务器:
或者,您可以在 settings.json 中添加配置:
{
"mcp": {
"inputs": [],
"servers": {
"mcp-server-code-runner": {
"command": "npx",
"args": [
"-y",
"mcp-server-code-runner@latest"
],
}
}
}
}
在 claude_desktop_config.json 中进行配置:
{
"mcpServers": {
"mcp-server-code-runner": {
"command": "npx",
"args": [
"-y",
"mcp-server-code-runner@latest"
],
}
}
}
以 VS Code 为例。通过以下按钮在 VS Code 中安装 Code Runner MCP 服务器:
或者,您可以在 settings.json 中添加配置:
{
"mcp": {
"inputs": [],
"servers": {
"mcp-server-code-runner": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"formulahendry/mcp-server-code-runner"
]
}
}
}
}
在 Windows 上,MCP 服务器可能无法通过 npx 连接。
您可以尝试以下两种解决方法:
npx 更改为 bunx。以下是 VS Code 中 settings.json 的配置:
{
"mcp": {
"inputs": [],
"servers": {
"mcp-server-code-runner": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"mcp-server-code-runner@latest"
],
}
}
}
}
npm install -g mcp-server-code-runner@latest
mcp-server-code-runner --transport http
在使用 Code Runner MCP 服务器之前,请确保您要运行的编程语言的解释器或编译器已设置在 PATH 环境变量中。
在已配置 Code Runner MCP 服务器的应用程序中尝试以下提示:
运行 JavaScript 代码:console.log(5+6)我的操作系统中的临时文件夹在哪里?使用 run-code 工具我机器上有多少个 CPU?使用 run-code 工具

想要构建自己的 MCP 服务器吗?试试 Yeoman Generator for MCP Server 来创建您的 MCP 服务器项目!