hackerearth-mcp
This server lets an AI assistant execute code remotely on HackerEarth's sandboxed cloud servers and read back the real output.
Run code in any of 24 programming languages via the
run_codetool (requirescodeandlanguage), returning actual printed output and error messages.Test and verify code — get real execution results instead of the assistant guessing whether a program works (e.g., compile/runtime errors, output values).
Discover supported languages with
list_languages, which returns the exact identifiers (e.g.,PYTHON3,JAVASCRIPT_NODE) to pass torun_code.Use friendly aliases such as
python, which are normalized to the correct HackerEarth identifier.Run untrusted code safely — nothing executes on your local machine and no toolchains need installing.
Connect from any MCP-compatible assistant (Claude Desktop, Claude Code, Cursor, etc.), needing only a free
HACKEREARTH_KEY, with graceful handling of a missing key or unknown language.
Provides tools to run code in 24 programming languages through HackerEarth's sandboxed code execution API, returning printed output and compile/runtime errors, and to list supported language identifiers.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@hackerearth-mcpRun this Python code and show the output: print('Hello, world!')"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.
Related MCP server: Netmind Code Interpreter
Tools
Tool | Description |
| Sends code plus a language to HackerEarth, waits for it to run, and returns the printed output and any error messages. |
| Lists every language HackerEarth can run, with the exact identifiers to pass to |
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-mcpor with pip:
pip install hackerearth-mcpFrom 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.jsonWindows:
%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 |
| Yes | Your HackerEarth |
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 34Roadmap
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-mcpcommand,server.jsonfor the official MCP registryPublished 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.pyThe 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
Available Tools
2 toolslist_languagesList LanguagesA
Returns the list of programming languages HackerEarth can execute, with the exact identifiers to pass to run_code. Use this when you are unsure which language name to use, or when the user asks what languages are available. Takes no inputs.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are supplied, so the description carries the full burden, but for a zero-parameter read-only listing it discloses the relevant traits: it takes no inputs and returns executable language identifiers. It omits minor details such as whether authentication or rate limits apply, which keeps it just short of a 5.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three short sentences, front-loaded with what is returned, then when to use it, then the no-input note. Nothing is redundant and no sentence is filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return values need no prose explanation, yet the description still clarifies the practical value of the returned identifiers for run_code. For a trivial zero-param lookup tool this is fully adequate.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, so per the rubric the baseline is 4. The description correctly states 'Takes no inputs,' matching the empty schema with additionalProperties false.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('Returns the list of programming languages HackerEarth can execute') and adds the key qualifier that the results contain 'the exact identifiers to pass to run_code', which cleanly separates it from its only sibling, run_code.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly names both trigger conditions: 'when you are unsure which language name to use' and 'when the user asks what languages are available.' This is a direct routing rule to the discovery tool rather than a guess.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
run_codeRun CodeA
Executes a snippet of code on HackerEarth's cloud servers in any of 24 languages. Use when the user wants to test code, see real output instead of predicted output, or check whether a program works. Needs the code and the language identifier, call list_languages if unsure of the exact name. Requires HACKEREARTH_KEY to be set; every run consumes the key owner's HackerEarth API quota. Returns the program's printed output and any error messages.
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| language | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full behavioral burden and does so well: it discloses remote execution on HackerEarth servers, the HACKEREARTH_KEY prerequisite, and the fact that each run consumes the key owner's API quota (a real cost/rate signal). It also describes the returned artifacts (printed output and error messages), which is more than the annotations would have supplied.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Four sentences, front-loaded with the core action and scope before prerequisites and return values. Slight redundancy in the trigger list ('see real output' and 'check whether a program works' overlap), but no filler sentences.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Covers purpose, triggers, prerequisites, cost, and (briefly) output for a two-parameter tool that already ships an output schema. It omits execution constraints such as runtime/memory limits or sandbox restrictions, which matter for a remote code-execution tool, but the essentials for correct invocation are present.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate, and it does: it names both required inputs (code, language identifier) and routes the agent to list_languages for resolving the language value. It stops short of giving format or size constraints for the code payload, so it is not exhaustive.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource (executes a code snippet) plus scope (HackerEarth cloud servers, 24 languages), which cleanly separates it from the sibling list_languages tool. An agent can tell what this tool does without opening the schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives explicit trigger conditions ('test code, see real output instead of predicted output, or check whether a program works') and names the alternative to consult when a prerequisite is unclear ('call list_languages if unsure of the exact name'). Nothing is left to inference about when to reach for this tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
- First observed
list_languages - First observed
run_code
TDQS
Scored across 2 tools
The two tools have completely distinct purposes: one enumerates supported languages and the other executes code. There is no overlap in their intent or expected inputs, so an agent cannot confuse them.
Both names follow a clean verb_noun pattern (list_languages, run_code) in consistent snake_case. The convention is predictable and readable.
The domain (remote code execution) is narrow, so a small surface is defensible, but two tools is on the thin side. There is little room for the set to grow without adding value, making it borderline under-scoped.
The pair covers the essential lifecycle: discover a language, then run code and receive output/errors. Minor gaps exist (e.g. no explicit async job-status or quota-check operation), but core functionality is intact and workable.
Maintenance
Related MCP Connectors
Run Python, Java, C, C++, C#, Go, Rust and 39 more languages, each run in a fresh, offline sandbox.
- mcp-serverOAuthai.cdbx
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Execute code in 8 languages (Python, JS, TS, Go, Java, C++, C, Bash) in gVisor sandboxes.
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables code execution and compilation through the Judge0 CE API, supporting multiple programming languages with submission management, status checking, and language configuration retrieval.9MIT
- AlicenseNot gradedqualityDmaintenanceEnables secure cloud-based execution of code across 14+ programming languages within a sandboxed environment. It supports file management, standard input/output handling, and automatic generation of visual artifacts like plots and charts.MIT

sandboxapi-mcpofficial
AlicenseNot gradedqualityFmaintenanceExecute code in 8 programming languages via gVisor-sandboxed Docker containers. Supports Python, JS, TS, Go, Java, C++, C, and Bash.2MIT- AlicenseAqualityDmaintenanceEnables AI assistants to securely execute Python and JavaScript code in sandboxed environments, with file management and package installation.753 npmMIT