Skip to main content

harold-mcp

Harold logo

Harold MCP tools:

What is this?

harold-mcp is an MCP server that gives AI coding assistants tools for working with the Maude specification and verification language.

Harold MCP Tools

  • maude_program_diagnostics(path) — diagnoses a Maude source file with two independent sources, run in a single call:

    • the Maude interpreter, which loads the file and reports every problem Maude finds, including the warnings it recovers from; and
    • Harold's heuristic linter, which checks the file's text for common mistakes: a when guard borrowed from Haskell/SML, -- used as a comment, a single = in an if … then … else … fi term, non-linear equation patterns, capitalized identifiers that nothing declares, non-ASCII typographic punctuation, and sorts that shadow a prelude sort. Heuristic findings are pattern-based and may be false positives, so they are reported as warning (suspicious code) or info (observations that do not affect the load).

    Every diagnostic carries source and code provenance, a severity (info, warning or error), a message, an LSP-style 1-based range (null for whole-file problems; heuristic findings include exact, exclusive-end columns), and — when a deterministic correction exists, such as replacing typographic punctuation with ASCII — a report-only fix (a description plus applyable edits; the tool never modifies the file). Diagnostics are ordered by position, whole-file problems last. success is true only when no diagnostic has severity warning or error, so info-only results still count as success. Use it to check whether a Maude program is well formed, and to get a list of issues to fix.

    Each call is hermetic: the file is loaded into a fresh Maude interpreter, with no state carried over from previous calls. The interpreter checks the whole load — the file plus anything it pulls in with load/in — and problems found in a dependency are reported as whole-file diagnostics whose message names the dependency file and suggests diagnosing it on its own. If a diagnostic provider fails, the call fails with one section per failing provider — category, context, cause chain and a bounded traceback — and the full detail is logged server-side.

  • maude_run(path, module, steps) — runs a bounded Maude interpreter session: loads one file into a fresh interpreter, selects a module, and executes an ordered list of reduce, rewrite, frewrite, erewrite, match and search steps, returning every intermediate result. Steps thread a current term REPL-style (omit a step's term or subject to use the previous result), and the optional bound, gas and depth inputs map to Maude's limits. Each call is hermetic: nothing survives between calls, so carry state by re-submitting a saved result term or writing a wrapper module. Load warnings are reported but evaluation proceeds; per-step failures (parse-error, too-large) stop the run and are returned as outcomes, and match/search cap their results with a truncated flag. Each search solution carries its rewrite path: path: "labels" (the default) returns the ordered rule labels, path: "full" also the rule text and intermediate states, and path: "none" omits it. Every phase reports the interpreter's captured stdout/stderr, and the path must be absolute (the server's working directory is not the client's). Whole-call failures (missing path, load failure, missing/theory module, worker crash or timeout) fail the call with a category (timeout, crash, spawn-failure, init-failure, remote-exception, cancelled, protocol-error), the call context, the cause chain and a bounded traceback; the full detail is logged server-side.

Planned tools: a vector index of the Maude documentation for retrieval-augmented generation (RAG).

Installation

  • Install uv
  • Run uvx harold-mcp --version

Harold requires Python 3.14: the maude dependency ships CPython 3.14 wheels only, so Harold's metadata pins the 3.14 series. If you don't have 3.14 installed, uvx downloads it automatically (or run uv python install 3.14); to select it explicitly — e.g. a specific patch release — pass uvx --python 3.14 harold-mcp.

The maude dependency bundles the Maude interpreter (built against Maude 3.5.1), so there is nothing else to install.

Then setup the harold-mcp command defined on pyproject.toml as an MCP server for your IDE.
Any MCP-compatible client works (including Cline); the Zed and opencode configurations below are the ones we test.
For example, for Zed IDE add the following to ~/.config/zed/settings.json:

  "context_servers": {
    "harold": {
      "enabled": true,
      "remote": false,
      "command": "uvx",
      "args": [
        "harold-mcp"
      ],
      "env": {}
    }
  },
  ...

Note: with the Zed agent (at least as of Zed 1.20.2) you must use the "Write" profile, as Zed ignores MCP tools in other profiles, even those marked with readOnlyHint.
Also note Zed requires a reload after changing the MCP config, both for the Zed agent and for ACP agents.

For opencode add the following to ~/.config/opencode/opencode.jsonc:

  "mcp" : {
    "harold": {
      "type": "local",
      "command": ["uvx", "harold-mcp"],
      "enabled": true,
      "environment": {}
    }
  }

This works both for the opencode TUI, and the ACP agent for opencode in Zed.

Update

To manually update run uvx --refresh harold-mcp --version.
Alternatively, use uvx harold-mcp@latest in your MCP client configuration, to perform an update check on each boot (instead of the manual command above). That implies a longer boot time, but for most IDEs this is negligible, since they spawn MCP servers in the background and don't block the UI on startup. CLI clients may behave differently.
If you want to run a specific version, check the release history in PyPI. Use uvx harold-mcp@VERSION, e.g. uvx harold-mcp@0.0.2.

Configuration

The server is configured through environment variables set in the MCP server configuration. HAROLD_* variables are Harold's own settings; MAUDE_LIB is inherited from the underlying Maude bindings:

Env var Meaning Default
HAROLD_MAUDE_WORKERS Maximum number of concurrent Maude interpreter processes. Every call runs in a fresh process, so this caps concurrent interpreters, not warm workers. half the logical CPUs, capped at 3
HAROLD_DIAGNOSTICS_TIMEOUT_SECS Seconds to wait for each maude_program_diagnostics worker call before failing it as timed out. Renamed from HAROLD_MAUDE_WORKER_TIMEOUT_SECS. 60
HAROLD_INTERPRETER_TIMEOUT_SECS Default timeout for each maude_run call; its timeout_secs argument overrides it. 60
HAROLD_INTERPRETER_MAX_STEPS Maximum steps per maude_run call. 200
HAROLD_INTERPRETER_MAX_REWRITE_BOUND Maximum accepted bound per rewrite step. 1000
HAROLD_INTERPRETER_MAX_SOLUTIONS Maximum match substitutions or search solutions returned per step. 200
HAROLD_INTERPRETER_MAX_TERM_LENGTH Maximum characters of a term, pattern or subject input. 100000
HAROLD_INTERPRETER_MAX_RESULT_LENGTH Maximum characters of a returned term (or path string); a longer result becomes a too-large step outcome. 1000000
HAROLD_INTERPRETER_MAX_PATH_STEPS Maximum transitions per search solution path; a longer path becomes a too-large step outcome. 100
HAROLD_INTERPRETER_MAX_OUTPUT_LENGTH Maximum characters of each captured stream (stdout and stderr separately) returned per phase; longer captures are truncated and marked. 1000000
HAROLD_ERROR_DETAIL_MAX_CHARS Maximum characters of the error detail returned to the client by a failed tool call. The full report is always logged; a truncated client report ends with a marker pointing at the log. 4000
HAROLD_IPC_MAX_RESPONSE_BYTES Maximum size in bytes of one worker response read by the server (hardening against a buggy child, not a quality-of-service limit). An oversized response is a protocol error naming this setting. 2147483648 (2 GiB)
MAUDE_LIB Inherited by the Maude bindings, not read by Harold itself: colon-separated directories where Maude searches for prelude.maude (and for library files loaded with in/load). Only needed to override the prelude bundled with the maude wheel. unset (the bundled prelude is used)

Invalid values (e.g. HAROLD_MAUDE_WORKERS=0) make the server fail fast at startup.

Both timeouts cover the whole worker call (admission, process startup, Maude initialization, the load and every step) and are best effort: a call that exceeds its timeout fails, its process is killed, and other concurrent calls are unaffected. Allow more time for long evaluations.

If you use MAUDE_LIB to override the bundled prelude, that prelude must match the Maude version Harold uses (currently Maude 3.5.1, the version the maude dependency is built against); a mismatched prelude can make the interpreter fail to load it or behave inconsistently. See .agents/summary/maude-lib.md for how Maude locates the prelude.

Development

Contributions are welcome! See CONTRIBUTING.md for the contribution workflow, and DEVELOPER_GUIDE.md for the development environment and release process.


Repository initiated with osprey-oss/cookiecutter-uv.

Metadata

Release files for harold-mcp 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for harold-mcp 0.0.5
File Size Uploaded Provenance Actions
harold_mcp-0.0.5.tar.gz 1.0 MB Without provenance Details for harold_mcp-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for harold-mcp 0.0.5
File Interpreter ABI Platform Actions
harold_mcp-0.0.5-py3-none-any.whl Python 3 none any Details for harold_mcp-0.0.5-py3-none-any.whl

Total release size: 1.4 MB

Release files / harold_mcp-0.0.5.tar.gz

Download URL harold_mcp-0.0.5.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
1f052b29c809dddc8506e8119d126c43ce7e29b382a09662a668aabf82b31a41
BLAKE2b-256 checksum
How to use checksums
dc55b45c285929f0afc535790a6464d3d1731b70e95b4d3aa5d2c11637b3b468
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / harold_mcp-0.0.5-py3-none-any.whl

Download URL harold_mcp-0.0.5-py3-none-any.whl
Size 345.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8390762eaf0817ef078d7a345d111c566e59810cc653b525a3d30010b6adeb70
BLAKE2b-256 checksum
How to use checksums
2bc534bb3aec45abf69fb4c81ffc85763103bdbb7a942b990da1e41d8c8ce388
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for harold-mcp 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page