Skip to main content
Glama
hara-mcp

hara-mcp

Official
by hara-lang

hara-mcp

Language-owned MCP gateway and execution-host coordination for Hara.

The architecture and six-phase delivery plan are tracked in issue #1. The gateway scaffold is issue #8; the active loopback-relay slice is issue #10.

Current status

This branch contains the MCP gateway, a closed four-tool catalogue, fail-closed host selection, and the first authenticated loopback relay for an outbound execution host. It does not provide a production endpoint or prove real Hara execution.

Two development paths exist, and they are deliberately mutually exclusive:

  • a disabled-by-default deterministic transport fixture for MCP schema and routing tests;

  • a 127.0.0.1-only relay that lets an enrolled host register, poll for one bounded request, acknowledge commands, submit a terminal result, and receive cancellation.

Phase 1 remains open until an unpacked Hara Chrome host executes a request in a fresh restricted Rust/Wasm Sandbox. A relay transport result is not semantic evidence.

Related MCP server: MCP Agent Execution Runtime

Development

Node.js 22 is required.

npm ci
npm run check

Start the stdio MCP server with no registered host:

npm run dev

Enable the deterministic transport fixture for MCP Inspector development only:

HARA_MCP_ENABLE_TEST_FIXTURE=1 npm run dev

Start the stdio server and loopback host relay:

HARA_MCP_LOOPBACK_TOKEN='replace-with-a-random-development-token' \
HARA_MCP_LOOPBACK_PORT=8765 \
HARA_MCP_LOOPBACK_ORIGIN='chrome-extension://your-extension-id' \
npm run dev

HARA_MCP_LOOPBACK_TOKEN is required whenever another loopback setting is present. The token must contain at least 16 non-whitespace bytes. It authenticates the local HTTP transport only; it must never enter an execution request, descriptor, result, MCP response, diagnostic, or log.

HARA_MCP_LOOPBACK_ORIGIN is optional. When configured, requests carrying an Origin header must match it exactly. Wildcards are prohibited. The relay always binds exactly to 127.0.0.1 and refuses wildcard, LAN, or public bind addresses.

Probe the relay process without exposing host or run details:

curl --fail --silent http://127.0.0.1:8765/v0/health

The health response proves only that the local relay process is answering. Host readiness remains derived from an authenticated, current-generation heartbeat and is reported separately by hara_runtime_get.

See the loopback relay guide for the host protocol and lifecycle.

MCP catalogue

The initial catalogue is exactly:

hara_runtime_get
hara_eval
hara_call
hara_check

All four tools are declared read-only, non-destructive, and closed-world. No option enables browser, network, persistent filesystem, package, process, provider, database, shell, or external-effect authority.

MCP request cancellation is propagated through the SDK request signal to the selected execution host. The loopback relay converts it into a distinct, idempotent cancel command. Requested wall-clock deadlines use the same path.

Boundaries

  • Hara owns execution semantics and the canonical Sandbox/LiveSession lifecycle.

  • Hara Chrome is an enrolled execution host, not an MCP server.

  • The loopback relay is a temporary Phase 1 transport adapter, not a second Hara runtime protocol.

  • mcp.greenways.ai remains a Greenways application ingress and consumes the lower-level Hara host protocol directly when needed.

  • MCP client credentials, loopback transport credentials, and execution-host/device credentials terminate at independent boundaries.

  • Exact command redelivery is allowed until acknowledgement; the host must de-duplicate by command and request identity.

See the architecture note and AGENTS.md before making changes.

Available Tools

4 tools
hara_callCall a qualified Hara VarB
Read-only

Invoke an already-loaded fully qualified Hara Var with transfer-safe arguments in a fresh restricted sandbox. Arguments are never concatenated into source.

Inputs: symbol (required), namespace (required), limits, source, +1 more. Returns: ok, error, result

hara_checkCheck Hara sourceA
Read-only

Run a bounded reader, compile, namespace, lint, or test check in the same fresh restricted pure sandbox profile and return structured diagnostics.

Inputs: source (required), profile (required), limits. Returns: ok, error, result

hara_evalEvaluate Hara sourceA
Read-only

Evaluate inline Hara source in a fresh restricted, no-network, no-browser, non-persistent sandbox on an enrolled compatible host.

Inputs: source (required), limits. Returns: ok, error, result

hara_runtime_getGet Hara runtimeA
Read-only

Return the selected compatible Hara execution host, exact runtime build, pure sandbox profile, limits, and observed availability.

Inputs: no named parameters. Returns: ok, host, error

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool serves a distinct purpose: eval executes inline source, call invokes a loaded var, check runs diagnostics, and runtime_get provides environment info. There is no meaningful overlap among the four tools.

    Naming Consistency4/5

    Three tools follow a clean verb pattern (hara_eval, hara_call, hara_check), but hara_runtime_get uses a noun-verb ordering that slightly deviates. The prefix is consistent, and the naming remains intuitive overall.

    Tool Count5/5

    Four tools is a tight, focused set for a niche language runtime server. Each tool earns its place without redundancy or bloat.

    Completeness4/5

    The core execution and checking workflow is well covered. A minor gap is the lack of an explicit var-loading or listing mechanism, but since call assumes pre-loaded vars, this may be handled externally.

    Maintenance

    ActivityInactive
    ResponsivenessMostly unanswered

    Related MCP Connectors

    Related MCP Servers