HackerEarth MCP

io.github.pratham-jain33由 GitHub 账号 pratham-jain33 发布v0.2.1更新于 Oct 24, 2026

Give any AI assistant a code run button via HackerEarth. 24 languages, zero setup.

概览

AI 生成的概览

在 HackerEarth 沙箱云服务器上运行 24 种语言的代码并返回真实输出,让助手能实际测试代码片段而非猜测。

可以做什么
  • 运行代码:把代码和语言发送到 HackerEarth,取回打印输出和错误信息。
  • 列出语言:查看所有支持的语言标识符,并支持 python 等友好别名映射到准确标识符。
  • 核对结果:助手可验证函数是否正确并解释实际输出。
适用场景
适合希望助手真正执行小程序、检查代码片段是否正确,或在不安装本地工具链的情况下比较不同语言输出的场景。
运行要求
本地 Python 包(Python 3.10 及以上),通过 uvx 或 pip 安装,运行在桌面助手中。需要 HackerEarth 客户端密钥,通过环境变量 HACKEREARTH_KEY 提供,可在 HackerEarth 开发者面板免费获取。需要访问 HackerEarth 的网络连接。
安装前请注意
必须提供 HACKEREARTH_KEY 客户端密钥,应保存在环境变量中,不要粘贴到对话里。每次运行都会把代码发送到 HackerEarth 服务器,并消耗你账户的请求配额。这是非官方社区项目,与 HackerEarth 无关联。

安装

在 SourceWeft 中

  1. 打开 控制台中的 HackerEarth MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

hackerearth-mcp

mcp-name: io.github.pratham-jain33/hackerearth-mcp

[License: MIT] [Python 3.10+] [MCP Compatible] [Version] [PyPI] [Stars] [Tests]

Also listed on Glama with one-click deploy.

Give any AI assistant a code run button.

Unofficial community project. Not made by, endorsed by, or affiliated with HackerEarth. You bring your own free HackerEarth API key.

Why

AI assistants are great at writing code and terrible at knowing whether it works. They guess. This server plugs into any MCP-compatible assistant (Claude Desktop, Claude Code, Cursor, and more) and lets it actually run code in 24 programming languages on HackerEarth's sandboxed servers, then read the real output. No local toolchains to install. Nothing untrusted ever touches your machine.

Tools

ToolDescription
run_codeSends code plus a language to HackerEarth, waits for it to run, and returns the printed output and any error messages.
list_languagesLists every language HackerEarth can run, with the exact identifiers to pass to run_code. Takes no inputs.

Installation

bash
# Quick install via uvx (recommended)uvx hackerearth-mcp
bash
# Or install with pippip install hackerearth-mcp
bash
# Install from sourcegit clone https://github.com/pratham-jain33/hackerearth-mcpcd hackerearth-mcppython -m venv .venv.venv/bin/pip install -e .

Features

  • Exposes two MCP tools: run_code and list_languages.
  • Executes code in 24 programming languages via HackerEarth's sandboxed cloud servers.
  • Provides friendly language aliases (e.g., python → PYTHON3).
  • Returns real program output and error messages.
  • Gracefully handles missing HACKEREARTH_KEY and unknown languages without making network calls.
  • Lists all supported language identifiers.
  • Simple installation via uvx or pip.
  • Compatible with any MCP‑compatible AI assistant (Claude Desktop, Cursor, etc.).

Tech/framework used

  • Language: Python (>=3.10)
  • Core libraries: FastMCP (provides MCP server framework), requests (HTTP client)

Quickstart

1. Get a free HackerEarth API key

Register a client in the HackerEarth developer dashboard to receive a client-secret. The free tier includes a generous request quota.

2. Install

No cloning needed:

bash
uvx hackerearth-mcp

or with pip:

bash
pip install hackerearth-mcp

From source instead:

bash
git clone https://github.com/pratham-jain33/hackerearth-mcpcd hackerearth-mcppython -m venv .venv.venv/bin/pip install -e .

3. Connect your assistant

Claude Desktop config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{  "mcpServers": {    "hackerearth": {      "command": "uvx",      "args": ["hackerearth-mcp"],      "env": {        "HACKEREARTH_KEY": "paste-your-client-secret-here"      }    }  }}

From source, point at your checkout instead:

json
{  "mcpServers": {    "hackerearth": {      "command": "/absolute/path/to/hackerearth-mcp/.venv/bin/python",      "args": ["/absolute/path/to/hackerearth-mcp/server.py"],      "env": {        "HACKEREARTH_KEY": "paste-your-client-secret-here"      }    }  }}

Restart Claude Desktop, then try: "run this Python program and tell me what it prints: print(6 * 7)"

Configuration

VariableRequiredDescription
HACKEREARTH_KEYYesYour HackerEarth client-secret. Read from the environment, never hardcoded, never sent to the assistant in chat.

How it works

(This section is written by the project's author.)

  1. You ask the assistant to run some code.
  2. The assistant calls run_code with the code and the language.
  3. The server sends it to HackerEarth with your key and gets back a tracking token.
  4. The server polls HackerEarth until the run finishes.
  5. HackerEarth runs the code in a sealed sandbox on their machines.
  6. The server hands the output back to the assistant, which explains it to you.

Screenshots

Code style

No explicit linting or formatting tools are configured. The code follows standard PEP 8 conventions as observed in the source files.

Build status

[Tests]

Example session

You:    Is this Fibonacci function correct? Run it and show me the first 10 numbers.        def fib(n):            a, b = 0, 1            for _ in range(n):                print(a, end=" ")                a, b = b, a + b        fib(10)
Claude: [calls run_code with your function]        It works. The output is: 0 1 1 2 3 5 8 13 21 34

Roadmap

  • v0.1 — code submission, status polling, output download, compile/runtime error reporting, 24-language list
  • v0.2 — PyPI packaging, install and run with a single uvx hackerearth-mcp command, server.json for the official MCP registry
  • Published to the official MCP registry and Glama; submitted to awesome-mcp

Contributing

Issues and pull requests are welcome. If you add a tool, write its description the way you'd explain it to a smart friend who has never seen it — the assistant reads that text to decide when to use it.

License

MIT © Pratham Jain. See LICENSE.

Acknowledgments

Built on HackerEarth's code execution API and the Model Context Protocol. Thanks to HackerEarth for a genuinely developer-friendly free tier.

Tests

The repository includes a local test script test_local.py. To run the tests:

bash
pip install fastmcp requestspython test_local.py

The GitHub Actions workflow test.yml executes the same commands on each push/pull request.

API reference

  • run_code(code: str, language: str) -> str Executes the supplied code in the specified language on HackerEarth and returns the program's printed output or error messages.
  • list_languages() -> str Returns a newline‑separated list of all supported language identifiers (e.g., PYTHON3, JAVASCRIPT_NODE).
  • _normalize_language(lang: str) -> str (internal) Normalizes user‑provided language names or aliases to the exact HackerEarth identifiers.
  • MCP registration is performed via FastMCP("hackerearth-mcp") which automatically registers the two tools above.

Created with repo-doctor

来源:README.md,提交 b639e2d

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.2.1最新Sep 27, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分