Skip to main content
Glama

mcp-server-code-runner

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

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

使用可流式 HTTP 传输运行

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

用法

在使用 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

local-only server

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

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

  1. 设置
    1. VS Code 的 npx
    2. 克劳德桌面版的 npx
    3. Docker
    4. Widnows 上的 npx 问题
  2. 使用可流式 HTTP 传输运行
    1. 用法
      1. 构建您自己的 MCP 服务器

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          An MCP server to run commands.
          Last updated -
          2
          265
          150
          TypeScript
          MIT License
          • Apple
        • A
          security
          A
          license
          A
          quality
          MCP server for collecting code from files and directories into a single markdown document.
          Last updated -
          2
          4
          Python
          MIT License
        • A
          security
          A
          license
          A
          quality
          A MCP server for managing and storing code snippets in various programming languages, allowing users to create, list, and delete snippets via a standardized interface.
          Last updated -
          3
          4
          JavaScript
          MIT License
        • A
          security
          A
          license
          A
          quality
          This project aims to build a Claude Code MCP server and implement its associated tools (explain\_code, review\_code, fix\_code, edit\_code, test\_code, simulate\_command, your\_own\_query). The server is implemented using Node.js and the MCP SDK. It receives tool requests from clients via Stdio, dynamically
          Last updated -
          7
          30
          18
          JavaScript
          MIT License
          • Linux

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/formulahendry/mcp-server-code-runner'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server