arch-mcp
This is a read-only MCP server that builds an architecture graph of a workspace and answers dependency, reachability, impact, test, and snapshot-diff questions.
Check workspace status: detected stacks, git info, graph index coverage, and adapter availability (
arch_status).Capture a summary or full architectural graph snapshot with a
snapshot_id(arch_snapshot).Search graph nodes by case-insensitive substring, filtered by kind such as file, module, symbol, table, API, config, doc, service, or container (
search).Inspect one node's incoming and outgoing edges, optionally including type-only edges (
focus).Find reverse reachability: which nodes depend on a target within a depth limit (
reaches).Compute transitive dependents of changed files (
impact) and identify test files affected by those changes (affected_tests).Diff two graph refs—
current, gitHEAD, or asnapshot_id—to see added/removed nodes and edges (arch_diff).Use workspace discovery from the current directory and a configurable response byte budget (
max_bytes); all tools are read-only.
Parses and indexes C++ source files into the architecture graph for dependency, impact, and affected-test analysis.
Indexes Dockerfiles and the container images they build as graph nodes, supporting dependency and deployment impact analysis.
Reads repository Git metadata and compares graph snapshots between Git refs for diffing changes.
Detects Gradle projects via settings.gradle and build.gradle manifests when determining workspace roots.
Parses GraphQL API contracts into API operation nodes and reference edges for architecture analysis.
Parses and indexes JavaScript source files and import relationships into the architecture graph.
Parses and indexes Kotlin source files into the architecture graph for dependency and impact analysis.
Parses Kubernetes configs and workloads, modeling deployment relationships to container images.
Indexes Markdown documents as documentation nodes and reference targets in the repository graph.
Parses and indexes PHP source files into the architecture graph for dependency and impact analysis.
Parses PostgreSQL DDL and SQL statements, modeling tables, views, reads, and writes in the graph.
Parses and indexes Python source files into the architecture graph for dependency and impact analysis.
Parses and indexes Ruby source files into the architecture graph for dependency and impact analysis.
Parses and indexes Rust source files into the architecture graph for dependency and impact analysis.
Parses Swagger/OpenAPI API contracts into API operation nodes for architecture and impact analysis.
Parses Terraform resources behind a flag, adding infrastructure service nodes to the graph.
Parses and indexes TypeScript source files and import relationships into the architecture graph.
Indexes CI YAML configuration files as configuration nodes for infrastructure and dependency analysis.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@arch-mcp what does changing src/index.ts break?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
arch-mcp
Know what your change breaks before you write it

Measured on this repository on 2026-11-18: impact for three changed files answers in 927 bytes, about 232 tokens, and names nine dependent files. Reading those nine files by hand costs 103,550 bytes over 2,074 lines, about 25,888 tokens, so one answer costs roughly 1/112 of that context. Tokens are bytes divided by four; the --json envelope for the same call is 7,725 bytes because it also carries coverage and adapter status. The graph behind the answer holds 162 modules and 624 import edges.
arch-mcp is an MCP server over stdio. It indexes a workspace into a graph of files, modules, symbols, database tables, API contracts, container and CI files, then answers questions about that graph: what depends on this file, which tests a change touches, what two snapshots differ by.
Features
Know what a change breaks. impact returns the transitive dependents of the files you changed, affected_tests narrows that to test files (src/index.ts:93-121).
One graph across stacks. 25 adapters read JavaScript/TypeScript, Python, nine more languages through wasm grammars, SQL, ORM schemas and calls (Prisma, JPA, SQLAlchemy, Drizzle), API contracts, manifests, Dockerfile, Kubernetes, CI YAML, Markdown and SCIP indexes (src/core/adapters/registry.ts:71-102). On this repository 20 of them report ok and five absent.
Answers state their own coverage. Every response carries index.coverage and index.kinds, so you can tell a missing edge from a missing adapter (src/core/envelope.ts:59, src/core/envelope.ts:162-173).
Your repository stays untouched. The server only reads: the cache lives in %LOCALAPPDATA%\arch-mcp\cache\<sha1(repo)> and nothing is written back (src/cache.ts:8-11).
Responses respect a byte budget. max_bytes defaults to 65536 with a hard cap of 1048576; a truncated answer always carries truncated: true and a hint (src/config.ts:43-45).
Related MCP server: UCN
What it sees
Every node is addressed as kind:path#symbol in repo-relative POSIX form (src/core/adapters/types.ts:2).
Nodes (11)
Kind | What it is |
| A source file or manifest on disk |
| An importable module, one per source file in the tree-sitter pipeline |
| A dependency: a manifest entry, a container image, or a CI action |
| A function, class or type declaration found by tree-sitter or SCIP |
| A SQL table |
| A SQL view |
| One API operation from an OpenAPI, Swagger, proto, GraphQL, AsyncAPI contract or a code route (Express, NestJS, Spring, FastAPI/Flask) |
| A configuration object: a CI file, a Kubernetes config referenced by |
| A Markdown document |
| A deployable unit: an API service, a Kubernetes workload, a Terraform resource |
| A Dockerfile or the image it builds |
Source: src/core/adapters/types.ts:5-16.
Edges (10)
Edge | In plain words | Emitted today |
| File A uses file B | yes ( |
| Function A calls function B (a callee outside the file resolves to an imported or unique symbol) | yes ( |
| SQL or ORM: a table or view is read (Prisma/Drizzle in TS/JS, SQLAlchemy in Python, JPA | yes ( |
| SQL or ORM: a table is written by DML or an ORM call; a SQL | yes ( |
| An API operation, an infrastructure file, a document, or a package dependency points at an object | yes ( |
| A Kubernetes workload deploys an image | yes ( |
| Class or interface inheritance | yes ( |
| Interface implementation | yes ( |
| Configuration of another object | yes ( |
| A test covers a target | yes ( |
extends and implements targets are resolved after the merge pass: same file first, then files the source imports, then a unique name across the graph; an ambiguous or unknown target drops the edge. The same resolution serves calls: a callee outside the file is emitted as pending:<file>#<name> and resolves to the imported or unique symbol, with meta.derived_from="syntax". Call precision is conservative for member calls: self/this (meta.call_scope="self") resolves only to a method of the current class; a call through an object (meta.call_scope="member") resolves only when the object's type is locally known — a variable/field/parameter declared in the same file (type annotation, new, composite literal or constructor call) or a class-name receiver such as Config.Map(); the method is then looked up in that type (same file → imported files → a unique type name), otherwise the edge is dropped, so BCL/extension names (services.BuildServiceProvider(), stack.Push(), typeof(x).MakeGenericType(), db.Users.Count(), LINQ/extension helpers) no longer shadow a unique method name (meta.member_type carries the type). Python/Ruby/PHP member calls without self/this are dropped — the language gives no local type; a generic callee keeps the method name and ignores type arguments (Config.Map<A, B>() → Map); a calls edge whose target is declared in an interface carries meta.target_kind="interface". tests edges are derived from imports edges whose source is a test file (rules: *.test.*, *.spec.*, __tests__/, test_*.py, *_test.py, tests/, src/test/java/**/*Test.java, *Test.kt, *Tests.cs, *_test.go, Rust files with #[test]/#[cfg(test)], *Test.php, *_spec.rb, spec/), so one import yields two edges (imports and tests); configures is emitted next to the references edge of the same Kubernetes manifest.
Coverage you can trust
The server never claims a complete picture it cannot back up.
Each response carries
index.coveragewithfiles_seen,parsedandunsupported, plusindex.kindswith the status of every edge kind (src/core/envelope.ts:59,src/core/envelope.ts:171-173).coverage.files_seenis the raw module count reported by the adapters;graph.edge_countcountsimportsedges only (R6b), whilegraph.edgesand snapshots carry every kind with its owntype(nounknownforcalls/tests).An empty graph is reported as
index.state = "partial", not as an error (src/core/envelope.ts:162-171).Files a parser could not handle are listed by name in
coverage.unsupported, and an adapter that failed turns the matching edge kind intounsupportedinstead ofno_matches(src/core/envelope.ts:130-154).A kind with no emitters at all shows up as
not_emitted(src/core/envelope.ts:130-132).
Supported layers: JavaScript/TypeScript, Python, nine languages through wasm tree-sitter grammars (C, C++, C#, Go, Java, Kotlin, PHP, Ruby, Rust), SQL (DML plus PostgreSQL DDL), API contracts (OpenAPI, Swagger, proto, GraphQL, AsyncAPI), Dockerfile, Kubernetes, CI YAML, Terraform behind a flag, Markdown, and SCIP indexes.
The invariants are covered by tests/envelope.test.mjs and tests/kinds.test.mjs; tests/ holds 57 test files, and the suite ran 440 tests with 0 failures on 2026-11-17 (package.json:27).
Quick start
The npm package is published as arch-mcp 0.1.0; this checkout builds 0.6.0 from source.
git clone https://github.com/Klaus101-ai/arch-mcp.git
cd arch-mcp
npm install && npm run build && npm run bootstrap
node dist\cli.mjs impact --workspace . --changed src/core/envelope.ts --jsonnpm install pulls runtime and dev dependencies. npm run build writes dist/server.mjs, dist/cli.mjs and dist/lib.mjs with esbuild. npm run bootstrap installs the pinned toolchain (dependency-cruiser 18.7.0) into ./toolchain and is idempotent. The last command answers what changing src/core/envelope.ts breaks; npm test runs the node test suite (package.json:24, package.json:26, package.json:27).
Connect your MCP client
The server speaks stdio through dist/server.mjs. An opencode v2 config entry looks like this:
{
"mcp": {
"servers": {
"arch-mcp": {
"type": "local",
"command": ["node", "<path-to>/arch-mcp/dist/server.mjs"]
}
}
}
}Replace the path with your own checkout. The MCP layer is thin: the tool contract sits in src/index.ts:16-153 and calls run through src/server_core.ts (src/index.ts:155-159).
Tools
Tool | Arguments | Returns |
|
| Stacks, git info, index coverage, adapters |
|
| Graph plus |
|
| Graph nodes matching a case-insensitive substring |
|
| Incoming and outgoing edges of one node, |
|
| Reverse reachability: who depends on the target, |
|
| Transitive dependents of changed files |
|
| Test files depending on the change; an empty result carries a |
|
| Added and removed nodes and edges between two refs |
|
| Architecture rules: |
Source: src/index.ts:16-153.
Response envelope
{
"ok": true,
"workspace": "E:/work/my-service",
"root_used": "E:/work/my-service",
"roots": ["E:/work/my-service"],
"schema_version": 10,
"index": {
"state": "ready",
"progress": { "percent": 100, "complete": true },
"coverage": { "files_seen": 226, "parsed": 226, "unsupported": [] },
"adapters": [{ "name": "git", "status": "ok", "version": null }],
"missing": []
},
"data": {},
"truncated": false,
"_meta": { "provenance": { "command": "arch_status", "cwd": "E:/work/my-service", "ts": "…", "cached": false, "exit_code": 0 } }
}Failures come back as {"ok": false, "error": {"code", "message", "hint", "candidates"}} with one of the codes WORKSPACE_NOT_FOUND, NODE_NOT_FOUND, AMBIGUOUS_NODE, INVALID_ARGUMENT, ADAPTER_UNAVAILABLE, INDEX_BUILDING, BUDGET_EXCEEDED, SNAPSHOT_NOT_FOUND, EXTERNAL_TOOL_FAILED (src/core/errors.ts:2-11, src/core/errors.ts:27).
An empty graph gives index.state = "partial" (src/core/envelope.ts:162-171). An answer over the byte budget carries truncated: true and a hint that says to raise max_bytes (src/tools/get_graph.ts:40-59).
index.kinds
index.kinds always holds ten entries in EdgeKind order. Each entry has kind, status, edges, confidence, confidence_min and emitters (src/core/envelope.ts:30, src/core/envelope.ts:100-127). status is one of:
emitted: edges exist;no_matches: no edges, and every emitter for that kind ran;unsupported: no edges, and at least one emitter failed;not_emitted: the kind has no emitters in the registry at all (src/core/envelope.ts:130-154).
The invariant sum(kinds.edges) == graph.edges.length is checked by tests/kinds.test.mjs.
Only index.state = "building" breaks the rule of ten entries: a cold arch_status answers immediately with empty kinds, adapters and missing, zero coverage and data.graph = null, while the index builds in the background (src/core/envelope.ts:182-197, src/tools/get_graph.ts:429-443).
Workspace discovery
workspace is optional. A .git directory anywhere above the working directory wins and is returned at once. Otherwise the server walks up to the nearest manifest (package.json, pyproject.toml, requirements.txt, settings.gradle*, build.gradle*) or to a directory with at least three source files. Markdown, JSON and YAML files do not make a root. No root means WORKSPACE_NOT_FOUND (src/core/workspace.ts:7-12, src/core/workspace.ts:105-112, src/core/workspace.ts:152-163).
A container without its own root resolves into child roots: the envelope reports roots[] and root_used. ARCH_MCP_ALLOWED_ROOTS turns discovery into an allowlist, and a path outside it answers WORKSPACE_NOT_FOUND (src/core/workspace.ts:179-190, src/core/workspace.ts:228-244).
Adapters
All 25 adapters are built in and register at module load, so index.adapters reflects the registry at runtime (src/core/adapters/registry.ts:71-102). Run against this repository on 2026-11-13, arch_status reports 20 adapters ok and five absent. An adapter with no matching files reports absent and stays out of index.adapters and missing[] (src/core/envelope.ts:115-117). A broken grammar or ABI mismatch lands in missing[] with state: partial while the core keeps answering (src/core/envelope.ts:150-173).
Adapter | Formats | Precision | What it adds |
| SCIP | semantic |
|
| git repository | manifest | HEAD and status metadata; no edges |
| JavaScript/TypeScript | syntax | import edges, type-only ones included; a test file also gets |
| OpenAPI/Swagger, AsyncAPI, GraphQL SDL, | syntax |
|
| CI YAML | syntax |
|
| Docker Compose ( | syntax |
|
| Dockerfile | syntax |
|
| Markdown | syntax |
|
|
| syntax |
|
| Kubernetes YAML | syntax |
|
| TOML/JSON manifests | manifest |
|
|
| syntax |
|
| SQL DML, PostgreSQL DDL | syntax |
|
| Terraform HCL | syntax |
|
| C | syntax |
|
| C++ | syntax | same plus |
| C# | syntax | same plus |
| Go | syntax | same; Go has no inheritance, so no |
| Java | syntax | same plus |
| Kotlin | syntax | same plus |
| PHP | syntax | same plus |
| Python | syntax |
|
| Ruby | syntax | same as the generic languages plus |
| Rust | syntax | same plus |
| JavaScript/TypeScript | syntax |
|
Routes from code are extracted from AST literals only: Express app|router.<verb>('<path>', handler), NestJS @Controller('<base>') plus @Get('<path>'), Spring @RequestMapping('<base>') plus @GetMapping('<path>'), FastAPI/Flask @app|@bp|@router.get('<path>'). Template/f-strings, path variables (@app.get(path_var)) and path arrays (@GetMapping({"/vets"})) are not supported and produce no node; a route whose handler symbol is not found still gets the api node but no edge.
Third-party licenses per dependency are listed in THIRD_PARTY_NOTICES.md; grammars/LICENSE holds the grammar provenance and grammars/SHA256SUMS the binary hashes.
Type-only dependencies
Edges whose dependencyTypes contain type-only get meta.type_only = true. focus, reaches, impact and affected_tests exclude them unless you pass include_type_only: true. Collecting them needs depcruiser with options.parser = tsc, otherwise import type statements never reach the graph (src/adapters/depcruiser.ts:77-83).
The generated config is per repository and lives in the repository's own cache directory (<cache>/<repo-sha1>/depcruise.config.json); when the repository has a tsconfig.json (or tsconfig.base.json) at its root, the config carries options.tsConfig.fileName as an absolute path, so monorepo alias imports resolved through tsconfig paths keep their edges (src/adapters/depcruiser.ts:86-160). The tsconfig path also joins the cache key.
Architecture rules (arch_check)
arch_check runs five rule groups over the graph: cycles, layers, forbidden, required and db. Rules live in <workspace>/.arch/rules.json (or a path passed in rules); without that file the default is {"cycles":{"enabled":true}} and checked.rules_source is "default". An unreadable file or invalid JSON yields INVALID_ARGUMENT with a hint.
{
"layers": [
{ "name": "domain", "match": ["src/domain/**"], "allow": ["domain"] },
{ "name": "ui", "match": ["src/ui/**"], "allow": ["ui"] }
],
"forbidden": [
{ "from": "src/ui/**", "to": "src/db/**", "reason": "ui must not import db directly" },
{ "from": "symbol:tests/**", "to": "table:*", "kind": "writes", "name": "no-db-writes" },
{ "from": "symbol:src/**", "to": "symbol:src/**", "kind": ["calls", "reads"], "name": "no-symbol-cross" }
],
"required": [
{ "match": "api:**", "kind": "references", "to": "symbol:**", "min": 1, "name": "api-has-handler" },
{ "match": "view:**", "kind": "reads", "direction": "in", "min": 1, "name": "view-is-read" }
],
"cycles": { "enabled": true },
"db": { "enabled": true }
}cycles— strongly connected components (Tarjan) overimportsedges; a component with more than one node, or a self-loop, becomes one violation.layers— for everyimportsedge, the target layer must be listed in the source layer'sallow; else a violation. A node matches the first layer whosematchglobs hit its repo-relative path.forbidden— for every edge of the rule's kind whose source matchesfromand target matchesto(globs:**,*,?), one violation withreasonin the message.kind— one edge kind or a list:imports,calls,reads,writes,references,configures,deploys,tests,extends,implements. Withoutkindthe rule checksimportsonly, as before; an unknown kind, an empty list or a non-string entry isINVALID_ARGUMENT.name— optional unique rule name (^[A-Za-z0-9_.-]{1,64}$); the violationrulebecomesforbidden:<name>, so two rules can cover one edge and keep separate baseline keys. A duplicate or malformed name isINVALID_ARGUMENT.Globs match node IDs as they are: file paths,
symbol:src/a.ts#f,table:users,api:GET:/pets.*stays inside one segment (api:*does not matchapi:GET:/pets),**spans segments.
required— the opposite direction: every node matchingmatchmust carry at leastminedges ofkindwhose counterpart matchesto. A node with fewer distinct counterparts is a violationrequired:<name>(orrequiredwithout aname) that lists the node innodes, the matching edges inedgesand their files infiles;messagereports how many were found and how many are required. Amatchthat hits no node produces no violations at all.kind— a single edge kind from the same ten-value list asforbidden; an unknown kind isINVALID_ARGUMENT.direction—"out"(default: the node is the edge source, the counterpart is the target) or"in"(the node is the target, the counterpart is the source).to— optional counterpart glob, default**.min— how many distinct counterparts are required; an integer from 1 to 100, default 1.0,101,1.5or a non-number isINVALID_ARGUMENT.name— optional unique name (^[A-Za-z0-9_.-]{1,64}$, unique amongrequiredrules); a duplicate or malformed name isINVALID_ARGUMENT.undeterminededges are not counted, type-only edges are (meta.undetermined,meta.type_only), as inforbidden.
db— database name checks, off unless"db": {"enabled": true}(an object with a mandatory booleanenabled; anything else isINVALID_ARGUMENT). All checks spantable:*andview:*nodes.db:alias— one bare name exists both with and without a schema:table:usersandtable:public.usersare the same table written two ways. A group (kind + bare name) of two or more distinct IDs where at least one carries no schema becomes one violation;nodeslists every ID of the group,kindistableorview,edges/filesare empty. This is a heuristic on bare names, not catalog introspection:table:a.usersandtable:b.usersstay two different tables, and two schemas without a schema-less ID (public.users+stage.users) are not an alias.db:bad-name— the bare name is not a table name: it contains((the adapter parsed an expression, e.g.view:public.count(x)) or its upper case is a SQL word from the fixed list (SELECT,FROM,WHERE,JOIN,LEFT,RIGHT,INNER,OUTER,FULL,CROSS,ON,GROUP,ORDER,BY,HAVING,LIMIT,OFFSET,UNION,ALL,AND,OR,NOT,NULL,IS,IN,EXISTS,CASE,WHEN,THEN,ELSE,END,AS,WITH,VALUES,SET,UNNEST,GENERATE_SERIES), e.g.table:public.SELECT. One violation per ID,nodesholds that ID only.db:column— a column of areadslineage pair (meta.columns) or of awritesedge (meta.writtenColumns) is not declared by the table. Eachfromof a lineage pair is read from the right: the last segment is the column, the one before it the table, the rest the schema; two segments trytable:public.<table>first and thentable:<table>, one segment and four or more (a dot inside a column name) are skipped. Awritescolumn already carries a bare name and is checked against the edge target. The comparison against the declaredcolumnsignores case; a table without declared columns (or a table missing from the graph) is not checked and the column is not counted. A miss becomes one violation withkind: "table",nodes: [tableId], emptyedges/files;messagesayscolumn …for reads andwritten column …for writes; duplicates collapse by(tableId, lower(column)), also across edges.db:fk— a foreign-key edge (meta.fk) points at a table node that exists only as a placeholder:inferred(referenced but never declared) orstub(sqlglot bridge node). One violation per FK,kind: "table",nodessorted[source, target], emptyedges/files. Very long SQL is not introspected: the check reads the graph, not the database.db:fk-column— a foreign-key edge carries columns (meta.fkColumns{from, to}, filled from inlineREFERENCES t (col)and table-levelFOREIGN KEY (a, b) REFERENCES t (x, y)) and a column is not declared on its side: everyfromcolumn must exist in the source table, everytocolumn in the target table. A table missing from the graph or a side without columns is skipped. One violation per missing column,kind: "table",nodes: [source, target], emptyedges/files;messagenames the column and the side (sourceortarget).Limits: the checks read what the adapters declared — a table declared in another schema is not found by a two-segment reference, and a foreign key without a column list (
REFERENCES t) has nofkColumns, sodb:fk-columnskips it. Columns added viaALTER TABLE ... ADD COLUMNare invisible to the adapter (onlyCREATE TABLEis parsed), so a write to such a column yieldsdb:column— a known limitation; ALTER parsing is planned for the next slice.meta.fkColumns,meta.writtenColumnsand the node-levelprimary_keylive in the full graph only:get_graph,arch_snapshotand stored snapshots have them stripped, likemeta.columns.
undetermined— an unresolved bare import (depcruiserdependencyTypescontainsundetermined) keeps itsimportsedge but is not checked incycles/layers/forbidden/required: itsresolvedpoints at the file itself and acircularflag on it is an artifact, not a cycle (meta.undetermined, wave F).
Result: {ok, violations:[{rule, kind, message, nodes[], edges[], files[]}], checked:{files, edges, rules_source, db:{tables, views, columnPairs, fkEdges}}}; violations are sorted by rule, then nodes/edges, so repeated runs are identical (src/tools/arch_check.ts). checked.db is always present: tables/views count the table:* and view:* nodes regardless of db.enabled; columnPairs counts the distinct (tableId, lower(column)) pairs actually compared (reads lineage pairs plus columns written by writes edges) and fkEdges the foreign keys whose target is in the graph — both are 0 when db is off or the graph carries no check metadata.
kind in a violation is the edge kind that matched (imports, writes, calls, …), not the rule group; for db violations it is table or view. checked.edges counts the imports pairs (always) plus, once per kind, the unique (source, target, kind) edges of every kind named by an active forbidden or required rule; each kind counts once, duplicates collapse, and imports in a required rule adds nothing.
Baseline gate
Accepted violations can be recorded in a baseline file and passed as baseline (absolute or workspace-relative path). The format is either the full output of check --json (the array is taken from data.violations) or a plain {"violations":[...]} object; every record needs a string rule, while nodes, edges and files are optional and coerced to arrays. A missing file, invalid JSON, a record without rule, a non-array nodes/edges or a file over 10 MB yields INVALID_ARGUMENT (CLI exit 2).
node dist/cli.mjs check --workspace . --json > .arch/baseline.json
node dist/cli.mjs check --workspace . --baseline .arch/baseline.jsonWith a baseline the response gains new_violations[] and baseline{source, total, new, resolved, gate_ok}:
the comparison key is
ruleplus sortednodesplus sortededges, so node and edge order never changes a match (violationKey);the difference is a multiset difference per key:
new = max(0, current − baseline)for each key,resolvedis what is left over from the baseline. Duplicates therefore compare per key, not by totals;okkeeps its old meaning — "no violations at all" — whilegate_okistruewhen there are no new ones; the CLI exits 1 only whenbaseline.gate_ok === false, so stale entries and a passing baseline exit 0;the baseline is tied to the rule set: after changing
.arch/rules.jsonthe keys of the affected violations change, so regenerate the baseline. A stale baseline is safe — worst case it hides nothing (resolvedgrows) or the old entries no longer match;total/new/resolved/gate_okare scalars computed before truncation, so atruncatedresponse still carries a correct exit code; onlyviolationsandnew_violationsare shortened;nothing is written back to the repository: the file is produced by you (
check --json > .arch/baseline.json) and read read-only.arch_diff.fromis a different feature — a graph comparison ref (git HEAD,currentorsnapshot_id), not a list of accepted violations.
Snapshots and arch_diff
arch_snapshot computes snapshot_id = SHA256(graph JSON + git HEAD + adapter versions) and stores the snapshot in the cache. arch_diff compares two refs: current, git HEAD (a hex string of 7 to 39 characters, an ambiguous prefix yields AMBIGUOUS_NODE with candidates), or a snapshot_id. A missing snapshot yields SNAPSHOT_NOT_FOUND, a malformed ref yields INVALID_ARGUMENT; arbitrary git revisions such as HEAD~1 are v1.1 (src/core/snapshots.ts:11-12, src/core/snapshots.ts:136-139, src/core/snapshots.ts:171-175).
CLI
node dist/cli.mjs <status|snapshot|search|focus|reaches|impact|affected-tests|diff|check> [--workspace <path>] [--json]
node dist/cli.mjs check [--workspace <path>] [--rules <path>] [--baseline <path>] [--json]
node dist/cli.mjs bootstrapOptions include --json, --scope, --query, --kind, --node, --target, --changed, --limit, --max-depth, --depth, --max-bytes, --include-type-only, --from, --to, --rules and --baseline. Exit codes: 0 on success, 1 on a contract error, 2 on a usage error (src/cli.ts:8-26, src/cli.ts:155-187). For check the codes are 0 (clean), 1 (violations found, output still carries the envelope) and 2 (rules or input error); with --baseline the code is 1 only when baseline.gate_ok === false, otherwise 0, and errors stay 2 (src/cli.ts, check branch). Without ARCH_MCP_MAX_RESPONSE_BYTES the budget is 65536, and status prints the line budget: 65536 (src/cli.ts:135).
Sample call arguments:
{ "name": "impact", "arguments": { "workspace": "E:\\work\\my-service", "changed": ["server/src/limits.ts"], "depth": 3 } }
{ "name": "affected_tests", "arguments": { "workspace": "E:\\work\\my-service", "changed": ["server/src/limits.ts"] } }
{ "name": "arch_check", "arguments": { "workspace": "E:\\work\\my-service" } }Configuration
Variable | Default | Meaning |
|
| Stack filter: |
|
| Timeout for every external process |
|
| Response budget, cap |
| not set | Workspace allowlist separated by |
|
| Cache root override for graphs and snapshots |
| off |
|
| off | Installs the toolchain automatically when missing |
|
| wasm grammar directory override |
| not set | Directory or |
| not set | Indexer command template with |
| off |
|
| off |
|
|
| Interpreter for the sqlglot bridge |
|
| Bridge path override; the file content joins the cache key |
| not set | Extra directory names to skip, at any depth, comma separated (example: |
Most variables are read in src/config.ts:42-70; the root allowlist is read in src/core/workspace.ts:179.
Ignored directories
One list, src/core/ignore.ts, is shared by the file walkers, the depcruiser run and the non-git cache signature: node_modules, .git, dist, build, coverage, .next, out, target, .turbo, toolchain, vendor, venv, .venv, .tox, __pycache__, .mypy_cache, .pytest_cache, .ruff_cache. Names are matched at any depth and case-insensitively on Windows, so BUILD/, DIST/ and Out/ are skipped as well.
ARCH_MCP_IGNORE extends that base and never shrinks it. The same set is compiled into the single --exclude regex of dependency-cruiser (one argument: the CLI option has no collect, so repeated flags keep only the last one — bin/dependency-cruiser.mjs:69), and node_modules is always part of it (without it depcruiser runs out of memory on repositories that vendor dependencies).
What v1 does not do
Run your code. No tests, builds or scripts from the repository; external processes go through one runner, and the trusted core uses git read-only and depcruise (
src/core/exec.ts:5-12).Generate a SCIP index by default. The adapter reads a ready index; an external indexer runs only with
ARCH_MCP_SCIP_INDEXERandARCH_MCP_ALLOW_EXEC=1(src/config.ts:67-70).Write into the repository. Tools only read the workspace; the cache and snapshots stay outside it (
src/cache.ts:8-11).Diff arbitrary git revisions.
arch_diffcoverscurrent,HEADandsnapshot_id(src/core/snapshots.ts:171-175).Drive the Terraform CLI. The adapter parses HCL through
@cdktf/hcl2json; noplan,validateorapplycall is made (src/adapters/infra/terraform.ts:2-3,src/adapters/infra/terraform.ts:78).Exact inheritance resolution.
extends/implementstargets are matched heuristically: same file, then files the source imports, then a unique name across the graph; an ambiguous target drops the edge and no compiler-grade type resolution is attempted (src/core/adapters/resolve.ts:1-14).Inheritance for Go and C. There is none: neither language has inheritance. C# is decided heuristically by the target symbol (an interface declaration carries
meta.kind=interface); Rust readsimpl Trait for Struct. SCIP contributesimplementsonly: the index schema has noextendsrelationship.Merging Compose overrides.
docker-compose.override.ymland other Compose variants are parsed as independent files: services are not merged with the base file, so an override adds its ownservice:compose/<name>entries (src/adapters/infra/compose.ts:1-14).Annotation path arrays. Host-mount path lists of the form
a:/b,c:/dare not split into separate entries (planned for a later wave); a Compose file that points a service at.envvalues only contributes variable names, never values.
ORM edges come only from explicit evidence: a Prisma model / pgTable() / __tablename__ / @Entity declaration or a JPA EntityManager field type. Dynamic table names (env() in @@map, computed strings), a receiver of unknown type and a model declared in another file produce no reads/writes edge.
Notes and limits
Cache key. Git HEAD, mtimes of changed files, toolchain version, config hashes (including the ignore signature
ignore), the depcruiser parser mode and the repo-relativetsconfigpath, the adapter signature,GRAPH_SCHEMA_VERSIONand the package version (src/cache.ts:104-152,src/tools/get_graph.ts:137-160). A non-git workspace is keyed by a sha256 signature over the concatenatedpath\tsha256(content)lines of every file outside the ignore base, so replacing a file with same-length content and restoring its mtime still invalidates the cache (src/cache.ts:200-247). ChangingARCH_MCP_IGNOREchanges the key, so a git-cache entry built with another ignore set is not reused.Build artifacts stay out.
.next/,dist/,build/,out/,coverage/and the rest of the ignore base are skipped by the walkers, the depcruiser run and the cache signature alike, so their content neither enters the graph nor invalidates the cache (src/core/ignore.ts:1-30).Server version.
initializereportsserverInfo.versionfrompackage.json(packageVersion(),src/cache.ts:49-66) —0.6.0for this release (src/index.ts:11-13).Schema versions.
SCHEMA_VERSION = 10moves with the response shape,GRAPH_SCHEMA_VERSION = "graph-18"only with the graph or cache entry content/shape (src/core/envelope.ts:15-19,src/cache.ts:60). 0.6.0 changed the SQL graph content —referencesedges gainedmeta.fkColumns,writesedgesmeta.writtenColumns, table nodes fillprimary_keyfrom inline keys — so the graph moved 17 → 18 while the response shape stayed the same andschema_versionremains 10. 0.5.0 addedarch_checkdb:column/db:fkand thechecked.db{columnPairs, fkEdges}counters, soschema_versionwent 9 → 10; the graph and its cache entries were unchanged. 0.4.0 added thearch_checkrequiredanddbfamilies, so the response gainedchecked.db{tables, views}andschema_versionwent 8 → 9. 0.3.2 added the baseline block (new_violations,baseline), which moved 7 → 8 the same way.Test files and the graph. A test file that imports a target gets two edges to it:
importsandtests.focuson the target shows both, so a target covered by one test reportscounts.incoming = 2. Both kinds run in a cold build after the adapter deltas merge;extends/implementstargets are resolved before the cache entry andindex.kindscounters are computed (src/tools/get_graph.ts:504,src/core/adapters/resolve.ts:52-60).Single flight. Identical concurrent calls share one run (
src/tools/get_graph.ts:308-423); a cache hit marks the evidence command with a(cached)suffix and setsprovenance.cached(src/tools/get_graph.ts:361,src/provenance.ts:31).Non-blocking build. The tree-sitter pipeline yields to the event loop every eight files, so a cold
arch_statusanswers within seconds and the graph builds in the background (src/core/adapters/tree-sitter/generic.ts:165,src/tools/get_graph.ts:442-443).
License
MIT (LICENSE:1-3). Third-party components and their licenses are listed in THIRD_PARTY_NOTICES.md.
Available Tools
8 toolsaffected_testsA
Test files transitively depending on changed files (type-only excluded by default). Read-only.
Inputs: changed (required), max_bytes, workspace, include_type_only.
arch_diffA
Diff two snapshots (current | git HEAD | snapshot_id): added/removed nodes and edges. Read-only.
Inputs: to (required), from (required), max_bytes, workspace.
arch_snapshotB
Architectural snapshot: stacks, git, graph and snapshot_id (scope=summary|full). Read-only.
Inputs: scope, max_bytes, workspace.
arch_statusB
Workspace status: detected stacks, git info, graph index coverage and adapter availability. Read-only.
Inputs: max_bytes, workspace.
focusA
Incoming and outgoing edges of one node with types; sqlglot lineage edges additionally carry columns (from/to pairs), stripped from get_graph/arch_snapshot. Type-only edges excluded unless include_type_only=true. Read-only.
Inputs: node (required), limit, max_bytes, workspace, +1 more.
impactB
What a change affects: transitive dependents of changed files within depth (type-only excluded by default). Read-only.
Inputs: changed (required), depth, max_bytes, workspace, +1 more.
reachesB
Reverse reachability: which nodes depend on target within max_depth. Read-only.
Inputs: target (required), max_bytes, max_depth, workspace, +1 more.
searchB
Search graph nodes by case-insensitive substring (kind=file|dir|test|all|module|package|symbol|table|view|api|config|doc|service|container). Read-only.
Inputs: query (required), kind, max_bytes, workspace.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Most tools have distinct roles, but reaches, impact, and affected_tests all express reverse-dependency/reachability queries and can be confused. Descriptions clarify the differences (generic depth vs changed-file impact vs tests only), but the boundaries are not fully crisp.
All names are snake_case and readable, but the set mixes an arch_ prefix on only some tools and mixes verb-style names (search, focus, reaches) with noun-style names (impact, affected_tests, arch_diff). No predictable verb_noun convention is followed.
Eight tools is well within the typical 3-15 range and the surface is focused on read-only architecture graph analysis. Each tool corresponds to a distinct query shape, so the count is appropriate.
The read-only architecture-analysis surface is broadly covered: status, snapshots, search, edge inspection, reverse reachability, impact, test impact, and diff. A minor gap is the lack of a general get_graph or node-detail tool (focus explicitly references get_graph, which is absent), though arch_snapshot may fill part of that role.
Maintenance
Related MCP Connectors
Ask a codebase what calls what: search, blast radius, paths between symbols, and diffs.
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Ask who calls a route, what a change breaks or who reads a field, across a system's repos.
Build, test and cache insights for Xcode, Gradle and Bazel projects, for coding agents.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents and reviewers to query a deterministic code dependency graph for callers, routes, pages, tables, and config with file:line evidence instead of grepping. One server can serve many indexed graphs, supporting cross-repository impact analysis.96 PyPI3MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents and terminal users to query codebases for callers, impact, tests, dependencies, and refactor previews using static AST analysis, with every match accounted for and uncertain relationships clearly marked.650 npm2MIT
- AlicenseNot gradedqualityBmaintenanceExposes three read-only tools—impact, explain, and report—so an agent can query a prebuilt local DuckDB graph of a codebase to find the transitive reverse-dependencies of a symbol or file, inspect a symbol's structural neighbourhood, and introspect the index itself. Runs over stdio or Streamable HTTP, always read-only, with no external service.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to query a local code graph over stdio, so they can see what a Git change may affect, find related tests, routes and nodes, and cite evidence paths — read-only and fully on-machine.MIT