mcp-server-code-runner

by formulahendry
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Allows running AutoHotkey code snippets with result display

  • Supports execution of AutoIt code snippets and shows results

  • Enables running Clojure code snippets and displays execution results

Code Runner MCP 服务器

MCP 服务器用于运行代码片段并显示结果。

它支持运行多种编程语言: 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 服务器:

或者,您可以在settings.json中添加配置:

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

克劳德桌面版的 npx

claude_desktop_config.json中的配置:

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

Docker

以 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" ] } } } }

通过 Smithery 安装

***注意:***这将在 Smithery 托管的远程容器环境中运行 Code Runner MCP Server。

要通过Smithery自动为 Claude Desktop 安装 Code Runner MCP Server:

npx -y @smithery/cli install @formulahendry/mcp-server-code-runner --client claude

Widnows 上的 npx 问题

在 Windows 上, MCP 服务器可能无法连接npx

您可以尝试以下两种解决方法:

使用bunx

  1. 安装Bun
  2. 在配置中,将npx更改为bunx

使用 cmd

以下是settings.json中的 VS Code 配置:

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

用法

在使用 Code Runner MCP Server 之前,请确保您要运行的编程语言的解释器或编译器已在PATH环境变量中设置。

在已配置 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

构建您自己的 MCP 服务器

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

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

MCP 服务器用于运行代码片段并显示结果。

  1. Setup
    1. npx for VS Code
    2. npx for Claude Desktop
    3. Docker
    4. Installing via Smithery
    5. npx issue on Widnows
  2. Usage
    1. Build your own MCP Server
      ID: d3mluq4vy9