HackerEarth MCP
Give any AI assistant a code run button via HackerEarth. 24 languages, zero setup.
ماذا يمكنك أن تفعل مع HackerEarth MCP؟
- Exposes two MCP tools:
run_codeandlist_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_KEYand unknown languages without making network calls. - Lists all supported language identifiers.
- Simple installation via
uvxorpip. - Compatible with any MCP‑compatible AI assistant (Claude Desktop, Cursor, etc.).
التثبيت
أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: .cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).
hackerearth-mcpclaude mcp add hackerearth-mcp -e 'HACKEREARTH_KEY=<your hackerearth_key>' -- uvx hackerearth-mcp==0.2.1
{
"mcpServers": {
"hackerearth-mcp": {
"command": "uvx",
"args": [
"hackerearth-mcp==0.2.1"
],
"env": {
"HACKEREARTH_KEY": "<your hackerearth_key>"
}
}
}
}
متغيرات البيئة
HACKEREARTH_KEYإلزامي سري Your HackerEarth client-secret (free from hackerearth.com). Code runs against your HackerEarth account quota.
التوثيق
مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.
المحتويات
hackerearth-mcp
mcp-name: io.github.pratham-jain33/hackerearth-mcp
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
| Tool | Description |
|---|---|
run_code | Sends code plus a language to HackerEarth, waits for it to run, and returns the printed output and any error messages. |
list_languages | Lists every language HackerEarth can run, with the exact identifiers to pass to run_code. Takes no inputs. |
Installation
# Quick install via uvx (recommended)
uvx hackerearth-mcp
# Or install with pip
pip install hackerearth-mcp
# Install from source
git clone https://github.com/pratham-jain33/hackerearth-mcp
cd hackerearth-mcp
python -m venv .venv
.venv/bin/pip install -e .
Features
- Exposes two MCP tools:
run_codeandlist_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_KEYand unknown languages without making network calls. - Lists all supported language identifiers.
- Simple installation via
uvxorpip. - 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:
uvx hackerearth-mcp
or with pip:
pip install hackerearth-mcp
From source instead:
git clone https://github.com/pratham-jain33/hackerearth-mcp
cd hackerearth-mcp
python -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
{
"mcpServers": {
"hackerearth": {
"command": "uvx",
"args": ["hackerearth-mcp"],
"env": {
"HACKEREARTH_KEY": "paste-your-client-secret-here"
}
}
}
}
From source, point at your checkout instead:
{
"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
| Variable | Required | Description |
|---|---|---|
HACKEREARTH_KEY | Yes | Your 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.)
- You ask the assistant to run some code.
- The assistant calls
run_codewith the code and the language. - The server sends it to HackerEarth with your key and gets back a tracking token.
- The server polls HackerEarth until the run finishes.
- HackerEarth runs the code in a sealed sandbox on their machines.
- 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
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
- [x] v0.1 — code submission, status polling, output download, compile/runtime error reporting, 24-language list
- [x] v0.2 — PyPI packaging, install and run with a single
uvx hackerearth-mcpcommand,server.jsonfor the official MCP registry - [x] 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:
pip install fastmcp requests
python 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) -> strExecutes the suppliedcodein the specifiedlanguageon HackerEarth and returns the program's printed output or error messages.list_languages() -> strReturns 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
الأسئلة الشائعة
ما هو HackerEarth MCP؟
Give any AI assistant a code run button via HackerEarth. 24 languages, zero setup.
كيف أثبّت HackerEarth MCP؟
يعمل على جهازك. في Claude Code: claude mcp add hackerearth-mcp -e 'HACKEREARTH_KEY=<your hackerearth_key>' -- uvx hackerearth-mcp==0.2.1. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.
هل يحتاج HackerEarth MCP إلى مفتاح API؟
نعم. يتطلب HACKEREARTH_KEY، وتضبطها في إعداداته.
هل HackerEarth MCP مفتوح المصدر؟
نعم. شيفرته متاحة على GitHub بترخيص MIT.
من يصون HackerEarth MCP؟
ينشره pratham-jain33. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.
من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.