Code Runner MCP Server
用于运行代码片段并显示结果的 MCP Server。
它支持运行多种编程语言: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。完整列表可在 constants.ts 中查看。
安装
在 VS Code 中使用 npx 安装
通过以下按钮在 VS Code 中安装 Code Runner MCP Server:
或者,您可以在
settings.json
中添加配置:在 Claude Desktop 中使用 npx 安装
在
claude_desktop_config.json
中添加配置:使用 Docker 安装
以 VS Code 为例,通过以下按钮在 VS Code 中安装 Code Runner MCP Server:
或者,您可以在
settings.json
中添加配置:在 Windows 上使用 npx 的问题
您可以尝试以下两种解决方法:
使用 bunx
- 安装 Bun。
- 在配置中将
npx
替换为bunx
。
使用 cmd
以下是在 VS Code 的
settings.json
中的配置:使用 Streamable HTTP Transport 运行
使用说明
在使用 Code Runner MCP Server 之前,请确保您要运行的编程语言的解释器或编译器已设置在
PATH
环境变量中。在已配置 Code Runner MCP Server 的应用程序中尝试以下提示:
运行 JavaScript 代码: console.log(5+6)
我的操作系统中的临时文件夹在哪里?使用 run-code 工具
我的机器中有多少个 CPU?使用 run-code 工具
构建您自己的 MCP Server
- Author:waytomcp
- URL:https://www.waytomcp.com/article/formulahendry/mcp-server-code-runner
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!