Skip to main content

@rqml/mcp

A Model Context Protocol server that exposes @rqml/core to coding agents as tools, over stdio. It lets an agent validate and reason about RQML documents through the same engine the CLI uses — so a tool call and the corresponding rqml command return equivalent results.

npm install -g @rqml/mcp     # provides the `rqml-mcp` binary

Tools

ToolPurposeInput
rqml_validateXSD + referential-integrity validationxml or path
rqml_statusRequirement count, trace coverage, dangling referencesxml or path
rqml_checkThe deterministic gate (validation + coverage + drift) → pass/failxml or path, baseDir?, strictness?
rqml_traceResolve the trace graph and report dangling local referencesxml or path
rqml_discoverEnumerate the governing specs in a repository, and resolve the spec governing a file — for monoreposroot, file?
rqml_showOne artifact: statement, acceptance criteria, trace neighborhood (+ rendered markdown)xml or path, id
rqml_impactWhat is affected, transitively, if this artifact changesxml or path, id
rqml_matrixTraceability matrix: per-requirement status, goals, code, tests, and coverage warnings (+ rendered markdown)xml or path, status?, type?, warning?
rqml_overviewReadable spec projection: whole document or scoped by section/id — outline + markdownxml or path, section?, id?
rqml_approveTransition a requirement's lifecycle status — writes to diskpath, id, status?
rqml_gateApproval-before-implementation verdict (optionally scoped to changed paths)xml or path, changed?
rqml_skeletonA schema-valid snippet: req, edge, testCase, or stateMachinekind, id?
rqml_linkRecord or maintain an implements/verifiedBy edge and its drift baseline — writes to diskpath, mode?, artifactId, uri, type?, edgeId?, kind?, title?

Every document-reading tool accepts the document text (xml), a filesystem path, or a file — a path whose governing spec is resolved by nearest-wins discovery (handy in monorepos; see the Monorepo guide). Prefer path or file, so the agent never inlines a multi-thousand-line spec into a tool call. When path is given, implements code links resolve against the spec's directory unless baseDir overrides it. strictness is relaxed · standard · strict · certified.

rqml_show and rqml_impact are the context-economy tools: an agent working on one requirement reads a few-hundred-token slice instead of the whole document. rqml_matrix is the spec-health surface — one row per requirement with coverage status and warnings, filterable by status / type / warning — for reviewing what is implemented, verified, or still has gaps without reading the raw spec.

rqml_link is the one writing tool, and mirrors rqml link mode for mode: mode: "append" (the default) adds a new edge and records the linked artifact's hash in .rqml/baseline.json; mode: "update" repoints the existing edge's external locator in place — matched by edgeId or the same derived id used when appending — and re-records its baseline entry; mode: "refresh" takes an edgeId alone and re-blesses one intentionally changed artifact's baseline without touching the spec document. The maintenance modes are deliberately edge-scoped, so unrelated drift is never silently blessed along the way (see Drift baselines).

Connecting an agent

Most MCP clients are configured with a server entry that launches the binary over stdio. For example:

{
"mcpServers": {
"rqml": {
"command": "npx",
"args": ["-y", "@rqml/mcp"]
}
}
}

(If you installed it globally, use "command": "rqml-mcp" with no args.)

Behavior

  • Engine parity. Every tool is backed by @rqml/core, so results match the corresponding rqml CLI command — covered by an integration test that runs both against the same project.
  • Read-mostly. Every tool is read-only except rqml_link, which requires an explicit path (no inline-XML form). Its append and update modes edit the spec textually — comments and formatting survive — and write the file only when the edited document still validates; refresh mode writes only the baseline store. The recorded hashes are what let subsequent rqml_check calls detect changed implementations, not just missing ones.
  • Deterministic. Like the rest of the toolchain, the verdicts involve no language model — the agent proposes RQML, the engine disposes.
Authoring vs. enforcement

Use the MCP tools to let an agent write and revise RQML, and the rqml check gate (in CI or a hook) to enforce it. The model proposes; the deterministic engine decides.