MCP Reference
MCP Reference
Section titled “MCP Reference”The ContextBrew MCP server gives AI coding agents direct access to your specification models. Claude Code, Cursor, Windsurf, and any MCP-compatible client can query, author, and govern the spec without leaving their workflow.
Registry: 75 tools · 48 resources · 6 prompts. Full mode exposes 72
tools by default, or 75 with MCP_BAZAAR_ENABLED=1 (adds the
bazaar_* tools). The full, generated tool registry lives in the repo at
apps/mcp/README.md.
Two Modes
Section titled “Two Modes”| Mode | How It Works | Use When |
|---|---|---|
| Local (default) | Reads the .contextbrew/ directory from disk. No API needed. |
Working on a local project with spec files |
| Cloud | Connects to the ContextBrew platform via API. | Using the hosted platform |
| Variable | Description | Default |
|---|---|---|
CBRL_PROJECT_ROOT |
Project root for local mode | cwd |
CBRL_API_URL |
API URL for cloud mode | – |
CBRL_API_KEY |
API key for cloud mode | – |
CBRL_PROJECT_ID |
Project ID for cloud mode | – |
Connecting
Section titled “Connecting”The fastest path is the setup command, which writes the config for you:
ctxbrew mcp setup --agent claude-code # or: cursor | windsurf | codex | orca | genericctxbrew mcp serve # stdio serverOr add the server to your MCP client configuration by hand. The package
is not yet on npm (publish pending) — run the server from a source
checkout of the repository. Claude Code (.claude/settings.json):
{ "mcpServers": { "contextbrew": { "command": "bun", "args": ["/path/to/contextbrew/apps/mcp/src/index.ts"], "env": { "CBRL_PROJECT_ROOT": "/path/to/project" } } }}Cursor (.cursor/mcp.json) uses the same shape with cloud-mode env vars (CBRL_API_URL + CBRL_PROJECT_ID); Windsurf takes the local-mode shape. When the package publishes, the bun <path> command can swap for npx -y @contextbrew/mcp; until then, run it from source.
Tool groups
Section titled “Tool groups”Per-format queries (read-only)
Section titled “Per-format queries (read-only)”Parsed AST access to every authored model. Results are cached after first parse.
| Tool | Reads |
|---|---|
get_domain_model |
DDD — aggregates, properties, invariants, domain events, value objects |
get_requirements / query_cbrl |
CBRL — requirements with acceptance criteria and test cases |
query_usm |
USM — personas, stories, releases, acceptance criteria |
query_scm |
SCM — screens, navigations, flows |
query_dsm |
DSM — tables, columns, constraints, indexes |
query_c4 |
C4 — persons, systems, containers, components, relationships, views |
query_sim |
SIM — system contexts, dependency edges, API/event/db contracts |
query_absl |
ABSL — agents, trust tiers, capabilities, guardrails, memory policy |
query_context_map |
Context map — bounded contexts and typed integration-pattern edges |
query_esdm |
ESDM — commands, events, read models, policies, process managers |
query_acm |
ACM — roles, screen policies, predicates, cross-model links |
export_c4_diagram |
Render C4 as Mermaid C4, Structurizr workspace, or C4-PlantUML |
Authoring (write path)
Section titled “Authoring (write path)”One tool maps the five authoring verbs to the same create-ops the Studio palette runs, validating against the live model (duplicate names, missing persona/policy, next-free id) and saving through the platform write path. Invalid arguments return warnings and write nothing.
author { verb: "specify", arguments: "As a traveler, ..." } → USM user storyauthor { verb: "aggregate", arguments: "Payment" } → DDD aggregateauthor { verb: "screen", arguments: "Flight Search" } → SCM screenauthor { verb: "table", arguments: "bookings" } → DSM tableauthor { verb: "rule", arguments: "..." } → ACM access ruleThe author tool takes { verb, arguments, target? }. Complementing it, per-format <format>_update_node tools update one existing node (whitelisted fields: name, description; update-only), returning structured errors for rejected patches.
Projects & recipes
Section titled “Projects & recipes”| Tool | Description |
|---|---|
list_projects / list_recipes / get_recipe |
Discover projects; list recipes; read the full manifest, state, work items, and linked requirements |
export_recipe |
Export a recipe as a pasteable prompt (markdown, json, claude-mdc, cursorrule, copilot, plain-text, skill-md) |
generate_tests |
Generate test files from spec models — vitest, gherkin, navigation, route, schema, migration |
run_tests / check_completeness / report_result |
Run a recipe’s suite, read coverage metrics, report implementation outcome |
mark_implemented |
Transition a recipe to done through the state machine; records a spec.implemented ledger event — a witness, not verification |
trigger_generation / get_generation_status / compare_generations |
Hosted generation from the agent (cloud mode) |
Cross-model intelligence
Section titled “Cross-model intelligence”| Tool | Description |
|---|---|
search |
Cross-model search across all spec models — read-only, nothing invented |
get_traceability |
Traceability matrix, coverage metrics, cross-model consistency |
get_freshness |
Per-file fresh/aging/stale scoring from the churn map — zero AI tokens |
query_hotspots |
Intent hotspots from DDD aggregates + churn |
cbt_resolve |
Resolve a CBT intent tag to its five-model spec refs + drift status |
brew_stale / brew_why |
Brew Ledger staleness and causal-chain replay |
distill |
Compress long command output (lines, stack traces, repeats) |
Example: search
Section titled “Example: search”search takes { query } and matches it (case-insensitive substring) against DDD aggregates, invariants, value objects, and domain events; CBRL requirements (including involvedAggregates and linkedStories); USM user stories; SCM screens; and DSM tables. It is read-only and invents nothing — every result cites the model, node type, and id it came from:
{ "query": "booking", "totalResults": 3, "results": [ { "model": "ddd", "type": "aggregate", "id": "Booking", "name": "Booking" }, { "model": "usm", "type": "user-story", "id": "US-001", "name": "Create a booking", "context": "persona: Traveler" }, { "model": "dsm", "type": "table", "id": "bookings", "name": "bookings", "context": "aggregate: Booking" } ]}Each result carries model (ddd | cbrl | usm | scm | dsm), a type specific to that model, the node id, a human name, and — where the match has one — a context snippet (an invariant expression, a requirement description, a screen route, a table’s aggregate). Results are deduplicated by model:type:id.
Spec VCS
Section titled “Spec VCS”| Tool | Description |
|---|---|
vcs_branch / vcs_commit |
List or create zero-copy spec branches; commit model snapshots |
vcs_diff |
Semantic diff between branches or commits — change classes and breaking shapes, not line diffs |
vcs_merge |
Merge spec branches; conflicts return a structured report (DDD→USM→CBRL→SCM→DSM order) |
get_spec_versions / preview_spec_change / promote_spec_version |
Read draft/approved versions, rehearse a change with zero writes, promote with optimistic concurrency |
Task orchestration
Section titled “Task orchestration”The K8s-for-agents loop — poll, claim, execute, report:
| Tool | Description |
|---|---|
poll_tasks |
List available orchestration tasks matching filters (status, priority, recipe, sprint) |
claim_task |
Atomically claim a task and receive its work envelope |
get_task_detail |
Inspect a work envelope without claiming |
submit_result |
Submit the execution outcome (completed/failed) |
heartbeat |
Renew a claim to prevent expiration |
Workflow, review & repair (visual context v2)
Section titled “Workflow, review & repair (visual context v2)”The agent half of the accountability loop over a connected service — read runtime truth, submit immutable intents, reconcile receipts. The service decides everywhere: nothing here self-approves, and a fact the service did not report is unavailable, never guessed.
| Tool | Description |
|---|---|
get_workflow_context |
Read one workflow target’s runtime context — selected vs pinned template, slots, coverage, the Session and its fence, the capabilities resolved for the calling actor |
run_workflow_operation |
Invoke one supported workflow operation (repair, verification, consultation) through the same source operation the GUI uses; template administration is refused (template_administration_forbidden) |
get_object_review / get_object_representations |
Read the saved assessment of one native object (revision judged, policy, effective status with reasons) and its typed cross-model links |
submit_object_review |
Submit one strict v2 review command as an immutable intent — a non-interactive principal is refused (human_judgment_required), a stale inspection as stale_revision; never records an approval on its own |
get_review_command |
Read a review receipt by its ORIGINAL command id — the way to reconcile an unknown outcome |
submit_native_repair |
Submit one strict native repair intent (add_back_action) as an immutable body — the service’s strict parser is the only gate; the receipt is a NATIVE-SAVE receipt, never a definition-review approval |
get_native_repair_command |
Reconcile a native repair by its ORIGINAL command id — unknown means the receipt is not (yet) visible; never resubmit with a fresh command id |
transition_status / transition_reconcile |
The VOIT transition journal: a run’s durable projection (known-unknown steps + next action); reconcile interrupted steps against ACTUAL candidate state via declared probes — ambiguity refuses replay |
Debug & observability
Section titled “Debug & observability”| Tool | Description |
|---|---|
get_error_context |
Mini-recipe (bug-as-failing-test) for an error: reproduction, contract, scope, done-gate |
find_similar_errors / trace_flow / get_state_envelope |
Similar errors, event-sequence reconstruction for a trace id, declared state machine for a slice |
ingest_external_evidence |
Ingest Sentry / OpenTelemetry feeds as observed evidence |
get_raci / promote_observed_to_declared |
Live RACI assignments; promote observed-and-reached states into the declared spec |
Governance, memory & navigator
Section titled “Governance, memory & navigator”| Tool | Description |
|---|---|
get_change_envelope / list_envelopes |
The five governance answers for a recorded change envelope, from its hash alone |
record_decision / get_decision_timeline |
Capture a one-line decision (proposed by default); read the memory back in order |
navigator_artifacts / navigator_health / navigator_trace |
The 5-layer navigator index: artifacts, health scores, cross-layer tracing |
acm_matrix / acm_audit_log / acm_check_coverage |
The ACM projections: role × screen matrix, audit trail, completion-gate coverage |
Resources
Section titled “Resources”48 resources expose the raw models, per-format semantics records, manuals,
and the approved projection — for example ctxbrew://project/local/<fmt>
(one per authored model family), ctxbrew://semantics/<model>/<version>
(the durable + code + test + docs surfaces a model produces), and
ctxbrew://approved/summary (recipes done\|verified, USM stories
implemented\|tested\|verified, each with a content hash). The full URI
table lives in the repo’s
apps/mcp/README.md.
Prompts
Section titled “Prompts”| Name | Description |
|---|---|
implement_recipe |
Guided prompt for implementing a recipe with full spec context |
review_recipe |
Guided prompt for reviewing recipe implementation quality |
cbrl_specify |
Specify a requirement in CBRL with grammar and traceability guidance |
cbrl_plan |
Plan recipe work from requirements and coverage gaps |
cbrl_converge |
Guide implementation through the verification and provenance loop |
cbrl_audit |
Audit spec drift and trace findings to their evidence |
Next Steps
Section titled “Next Steps”- CLI Reference for the command-line surface, including
ctxbrew mcp setup - Import & Export for the model interop matrix
- The full tool registry:
apps/mcp/README.md
