MCP server
ayida mcp starts an MCP server over stdio, so assistants can model
an existing system from its code and infrastructure, or design a new one conversationally. It learns
the language, reads the architecture, asks it questions, compares revisions, edits the HCL source
and renders it, safely, through nine tools.
Setup
Install ayida, then add it to your client’s MCP configuration.
For Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS,
%APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"ayida": {
"command": "ayida",
"args": ["mcp", "--project", "/path/to/your/architecture"]
}
}
}For Claude Code:
claude mcp add ayida -- ayida mcp --project /path/to/your/architectureIf you used loko before, remove its server first with claude mcp remove loko.
Tools
The server registers nine tools:
| Tool | Direction | What it does |
|---|---|---|
schema | read | Describes the language: every block, attribute and allowed value |
describe | read | Explains the compiled architecture |
query | read | Answer graph questions (dependents, paths, coupling, flows) and list views, elements and relationships |
validate | read | Compile and report diagnostics |
diff | read | Compare two revisions, or a revision with the files on disk, with each change’s blast radius |
apply_edit | write | Edit the HCL source, compiling before anything is written |
move | write | Move or rename elements, rewriting every reference |
fmt | write | Canonically format every *.ayida.hcl file |
build | write | Render diagrams, markdown and a site into a directory in the project |
schema, describe, query, validate and diff read; apply_edit, move and fmt edit the
HCL source; build renders. Writes touch *.ayida.hcl files only (and build its output directory).
Every edit compiles before it is written, and saves all-or-nothing, so a broken reference never
reaches disk. Change the architecture through the tools rather than editing files directly.
Output defaults to TOON, which roughly halves the size of tabular answers
such as query results. Pass format: "json" to any tool for JSON instead.
Working with the tools
- Learn the language, then read. Call
schemaonce, thendescribe; every read returns arevision. In an empty directory,describereturns a bootstrap: the smallest valid project declaration and a ready-to-sendapply_editrequest that creates it. - Quote the revision when you write.
apply_edit,moveandfmttakebase_revision. If a file the write would change has been modified since that read, the write is refused asstale_revisionand the newer change is kept — read again and retry. Each successful write returns the new revision. - Preview when unsure.
preview: truereturns unified diffs and writes nothing. - Batch related changes.
apply_edittakes up to 100 edits; they apply in order, compile once, and save all-or-nothing.
Write results report only what the change caused: diagnostics_added, diagnostics_removed and
a count of the unchanged ones. The diffs mark lines that changed only in whitespace separately.
Pass diagnostics: "all" and diff: "exact" for the full lists.
Diagnostics in every result are compact by default (severity, code, detail, address and
at); pass ranges: "full" for full source ranges. Every describe and schema result also
carries server_version, and describe carries root and files, so an assistant can detect a
stale server or a --project pointed somewhere unexpected before an edit lands.
Diffing revisions
diff gives the same changes as ayida diff. With no arguments it
compares HEAD with the files on disk. from and to take a commit, branch or tag, and
from_export takes a JSON export inside the project root. The compact result gives from, to
and the counts per class, then one row per change:
→ diff {"from": "main"}
from: main (d33935a)
to: worktree
counts:
added: 1
removed: 0
renamed: 1
rewired: 1
attribute_changed: 1
rebound: 0
changes[#4]{class,address,old,summary,blast}:
added,container.dlq_worker,"","",1
renamed,container.payments_api,container.api,"",2
rewired,container.payments_api.uses.orders,"","target: container.orders_db -> container.orders_aurora",2
attribute_changed,container.worker,"","system: system.payments -> system.ledger",0blast counts the elements that depend on the change. detail: "full" returns the
ayida diff --format json shape, with the blast-radius addresses.
Refusals
A refusal is a normal tool result with ok: false, and nothing is written. The reasons are
compile_errors, stale_revision, dangling_references (consider cascade: true),
address_in_use, not_found, invalid_edit, path_refused, project_exists and no_project.
Command options
ayida mcp --project /path/to/your/architecture| Flag | Type | Default | Description |
|---|---|---|---|
--project, -p | string | . | The architecture the tools read and edit. MCP clients usually start ayida from another directory, so set it |
--env | string | "" | Set an environment variable (KEY=VALUE) for the server |