@decantr/mcp-server 3.0.2 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -122,53 +122,41 @@ MCP tools are only available in Continue.dev agent mode.
122
122
 
123
123
  ## Key Tools
124
124
 
125
- The server exposes Decantr vocabulary, context, benchmark, and verification tools. Highlights:
125
+ The server exposes a hard 8-tool MCP surface. Pass an `action` to select the routed behavior:
126
126
 
127
127
  | Tool | Description | Example Input |
128
128
  |------|-------------|---------------|
129
- | `decantr_create_essence` | Generate an Essence spec skeleton from a project description | `{ "description": "SaaS dashboard with analytics and billing", "framework": "react" }` |
130
- | `decantr_read_essence` | Read the current `decantr.essence.json` from the working directory | `{}` or `{ "path": "./custom.essence.json" }` |
131
- | `decantr_validate` | Validate an Essence file against the schema and guard rules | `{ "path": "./decantr.essence.json" }` |
132
- | `decantr_search_registry` | Search official/community vocabulary for patterns, archetypes, themes, and shells | `{ "query": "kanban", "type": "pattern" }` |
133
- | `decantr_resolve_pattern` | Get full pattern details: layout spec, components, presets, code examples | `{ "id": "data-table", "preset": "product" }` |
134
- | `decantr_resolve_archetype` | Get archetype details: default pages, layouts, features, suggested theme | `{ "id": "saas-dashboard" }` |
135
- | `decantr_resolve_blueprint` | Get a full app composition with page structure and personality traits | `{ "id": "ecommerce" }` |
136
- | `decantr_suggest_patterns` | Given a page description plus optional route/source excerpt, get ranked pattern suggestions | `{ "description": "recipe feed with avatars and infinite scroll", "route": "/feed" }` |
137
- | `decantr_check_drift` | Check if generated code violates the design intent in the Essence spec | `{ "page_id": "overview", "components_used": ["Card", "LineChart"], "theme_used": "auradecantism" }` |
138
- | `decantr_get_execution_pack` | Read compiled scaffold, section, page, review, or mutation execution packs, with hosted fallback when local context is missing | `{ "pack_type": "page", "id": "overview", "format": "json" }` |
139
- | `decantr_get_project_state` | Read a compact typed summary of Essence, generated packs, graph artifacts, capsule source-handle bounds, source artifacts available for file impact, local snapshot history, typed diff counts, local law, behavior obligations, style bridge, stable diagnostic catalog, and recommended next tools | `{ "project_path": "apps/web" }` |
140
- | `decantr_prepare_task_context` | Resolve compact route/task context, task-ranked typed route graph, optional graph-shaped changed-file impact, authority lane, local law, behavior obligations, style bridge mappings, and evidence before editing a Brownfield, Hybrid, or Essence route | `{ "project_path": "apps/web", "route": "/feed", "task": "improve recipe card loading" }` |
141
- | `decantr_get_contract_capsule` | Read the cache-friendly Contract capsule generated by `decantr graph`, including bounded SourceArtifact paths that can be reused as `file_path` handles | `{ "project_path": "apps/web" }` |
142
- | `decantr_get_graph_snapshot` | Read graph metadata with snapshot-history status and typed diff counts, a compact local history index, a route-scoped graph subgraph, node or source-file impact context, task-aware ranked context, a specific history snapshot, or a typed diff between local snapshots | `{ "project_path": "apps/web", "file_path": "src/app/page.tsx", "task": "edit source" }` |
143
- | `decantr_query_graph` | Query current or historical graph nodes, source files, payload fields, relations, and optional node-impact context without reading the full snapshot | `{ "project_path": "apps/web", "snapshot_id": "current", "file_path": "src/app/page.tsx", "include_impact": true }` |
144
- | `decantr_traverse_graph` | Traverse the current or historical typed graph from one or more node IDs or a source file by relation, direction, and depth | `{ "project_path": "apps/web", "snapshot_id": "current", "file_path": "src/app/page.tsx", "direction": "in", "relations": ["NODE_DERIVED_FROM_SOURCE"] }` |
145
- | `decantr_compile_execution_packs` | Compile a hosted execution-pack bundle from a local or inline essence document | `{ "path": "./decantr.essence.json", "namespace": "@official" }` |
146
- | `decantr_audit_project` | Run the schema-backed Decantr project audit against essence and compiled packs, with hosted fallback when local pack artifacts are missing | `{ "namespace": "@official" }` |
147
- | `decantr_critique` | Critique a file against the compiled review contract, with hosted fallback when local review packs are missing | `{ "file_path": "./src/pages/Overview.tsx", "namespace": "@official" }` |
148
- | `decantr_get_findings` | Return typed Project Health findings with stable codes, repair IDs, graph anchors, and optional repair prompts | `{ "project_path": "apps/web", "code": "TOKEN010" }` |
149
- | `decantr_get_repair_plan` | Return a structured repair plan for a finding with repair ID, graph anchor, optional impact context, action payload, evidence, read targets, constraints, and rerun commands | `{ "project_path": "apps/web", "code": "TOKEN010" }` |
150
- | `decantr_get_evidence_bundle` | Generate the local privacy-redacted Evidence Bundle for a project, including graph anchors and graph artifact provenance when `.decantr/graph` exists | `{ "project_path": "apps/web" }` |
151
- | `decantr_workspace_health` | Discover Decantr projects and return aggregate workspace health | `{ "workspace_root": ".", "max_projects": 100 }` |
152
- | `decantr_get_repair_prompt` | Return the scoped repair prompt for a health finding | `{ "finding_id": "assertion-contract-context-pack-manifest" }` |
153
- | `decantr_run_health_loop` | Run health, evidence, and next repair prompt in one local agent loop | `{ "project_path": "apps/web" }` |
154
- | `decantr_get_showcase_benchmarks` | Read the audited showcase corpus manifest, shortlist, or verification report | `{ "view": "verification" }` |
129
+ | `decantr_project` | Read local project state and workspace health | `{ "action": "state", "project_path": "apps/web" }` |
130
+ | `decantr_contract` | Read Essence, validate, check drift, generate a skeleton, or read the Contract capsule | `{ "action": "validate", "path": "./decantr.essence.json" }` |
131
+ | `decantr_context` | Read scaffold, section, page, task, and execution-pack context | `{ "action": "task", "project_path": "apps/web", "route": "/feed", "task": "improve recipe card loading" }` |
132
+ | `decantr_graph` | Read graph snapshots, query graph nodes/edges, or traverse graph relations | `{ "action": "query", "project_path": "apps/web", "file_path": "src/app/page.tsx", "include_impact": true }` |
133
+ | `decantr_registry` | Search and resolve hosted registry content, benchmarks, and execution packs | `{ "action": "resolve_pattern", "id": "data-table", "preset": "product" }` |
134
+ | `decantr_verify` | Run audit, critique, findings, evidence, or health-loop reads | `{ "action": "critique", "file_path": "./src/pages/Overview.tsx" }` |
135
+ | `decantr_repair` | Return typed findings, repair plans, repair prompts, and repair loop guidance | `{ "action": "repair_plan", "project_path": "apps/web", "code": "TOKEN010" }` |
136
+ | `decantr_contract_write` | Explicit write surface for accepting drift or mutating Essence v4 | `{ "action": "update_essence", "operation": "add_feature", "payload": { "feature": "billing" } }` |
155
137
 
156
138
  For the broader product surface and support policy, see the root Decantr docs and package support matrix.
157
139
 
140
+ For Decantr 3 assistant prompt migration, see the MCP migration guide: https://decantr.ai/reference/mcp-migration.md.
141
+
158
142
  ## Security And Permissions
159
143
 
160
- The MCP server reads Decantr files, including `.decantr/graph` typed graph artifacts, and selected project files from the active workspace. Write access is limited to explicit write tools such as `decantr_update_essence` and `decantr_accept_drift`, and paths are contained to the active workspace root.
144
+ The MCP server reads Decantr files, including `.decantr/graph` typed graph artifacts, and selected project files from the active workspace. Write access is limited to the explicit `decantr_contract_write` tool with `accept_drift` and `update_essence` actions, and paths are contained to the active workspace root.
161
145
 
162
146
  Registry and pack-resolution tools may call the configured Decantr API. Source upload fallbacks for hosted critique/audit are disabled unless the tool call explicitly passes `allow_hosted_upload: true`. The MCP server does not emit Decantr telemetry. See [security permissions](https://decantr.ai/reference/security-permissions.md).
163
147
 
164
148
  ## Compatibility
165
149
 
166
- `@decantr/mcp-server` is stable in the `2.x` line for the documented MCP tool surface.
150
+ `@decantr/mcp-server` is stable in the Decantr 3 line for the documented MCP tool surface.
167
151
 
168
152
  - new tools may be added in compatible releases
169
153
  - existing documented tool names and envelopes should not break without a major version
170
154
  - breaking changes to established tool contracts require a major version and migration note
171
155
 
156
+ ### 3.4 Tool Surface Migration
157
+
158
+ Decantr 3.4 consolidates legacy MCP tool names into the eight action-based tools above. For example, `decantr_get_project_state` becomes `decantr_project` with `{ "action": "state" }`, `decantr_get_graph_snapshot` becomes `decantr_graph` with `{ "action": "snapshot" }`, and the legacy write tools become `decantr_contract_write` with `{ "action": "accept_drift" }` or `{ "action": "update_essence" }`.
159
+
172
160
  ## How It Works
173
161
 
174
162
  An Essence spec (`decantr.essence.json`) captures your design intent -- archetype, theme, page structure, patterns, and guard rules -- in a single declarative file. The MCP server exposes this spec and the Decantr registry to your AI assistant, giving it concrete layout specs, component lists, and visual treatments instead of relying on the model's generic training data. The result is generated code that follows a coherent design system, and drift detection that catches deviations before they ship.
@@ -179,24 +167,13 @@ An Essence spec (`decantr.essence.json`) captures your design intent -- archetyp
179
167
 
180
168
  The AI assistant calls these tools behind the scenes:
181
169
 
182
- 1. `decantr_create_essence` -- generates a spec skeleton matched to the `saas-dashboard` archetype
183
- 2. `decantr_resolve_archetype` -- pulls default pages, layouts, and features for a SaaS dashboard
184
- 3. `decantr_suggest_patterns` -- recommends `kpi-grid`, `chart-grid`, `data-table`, and `form-sections` for the described pages
185
- 4. `decantr_resolve_pattern` -- fetches layout specs and component lists for each pattern
186
- 5. `decantr_get_execution_pack` -- loads the compiled scaffold/page/review packs as the task contract, falling back to hosted compilation when local pack artifacts are missing
187
- 6. `decantr_get_project_state` -- checks Essence, packs, graph readiness, capsule source-handle bounds, source artifacts available for file impact, local snapshot history, typed diff counts, local law, accepted behavior obligations, stable diagnostic codes, and the next useful tool calls
188
- 7. `decantr_prepare_task_context` -- resolves route-local Brownfield/Hybrid context, task-ranked typed route graph context, graph-shaped changed-file impact when changed files resolve to SourceArtifact nodes, active authority, accepted local law, accepted behavior obligations, accepted style bridge mappings, visual evidence, and theme inventory before editing an existing app
189
- 8. `decantr_get_contract_capsule` -- loads the compact Contract graph capsule, including the bounded SourceArtifact path index, when `.decantr/graph` exists
190
- 9. `decantr_get_graph_snapshot` -- reads graph metadata, snapshot-history status, optional compact history, typed diff counts, route-scoped graph nodes/edges with optional task-aware ranking, impact graph nodes/edges through `node_id` or `file_path`, specific history snapshots through `snapshot_id`, and local snapshot diffs through `compare_to`
191
- 10. `decantr_query_graph` and `decantr_traverse_graph` -- answer typed follow-up questions against current or historical snapshots, such as which pages use a route, component, token, source file, rule, or diagnostic code; `decantr_query_graph` can include an impact subgraph for matched node IDs or a `file_path` SourceArtifact so agents can inspect blast radius before changing a component, token, rule, finding, or source artifact, and `decantr_traverse_graph` can resolve `file_path` into the SourceArtifact start node for relation walks
192
- 11. `decantr_compile_execution_packs` -- compiles the hosted pack bundle when the task needs a fresh remote contract from the essence document
193
- 12. `decantr_check_drift` -- validates the generated code against the Essence spec before presenting it
194
- 13. `decantr_critique` -- critiques a specific file, falling back to the hosted verifier when the local review pack is missing
195
- 14. `decantr_audit_project` -- runs the stronger project-level audit once the implementation is in place
196
- 15. `decantr_get_findings` -- returns compact typed findings with diagnostic codes, repair IDs, and optional prompts
197
- 16. `decantr_get_repair_plan` -- returns typed repair actions, graph anchors, optional graph impact context, evidence, read targets, preserve/avoid constraints, and rerun commands
198
- 17. `decantr_get_evidence_bundle` -- returns the local evidence bundle, graph anchors, and graph artifact provenance for the AI repair loop
199
- 18. `decantr_get_repair_prompt` -- gives the assistant exact finding evidence, constraints to preserve, and commands to rerun
170
+ 1. `decantr_contract` with `create_essence`, `validate`, or `check_drift` actions to generate and verify the contract
171
+ 2. `decantr_registry` with `resolve_archetype`, `suggest_patterns`, `resolve_pattern`, or `compile_execution_packs` actions to fetch vocabulary and packs
172
+ 3. `decantr_context` with `execution_pack` or `task` actions to load the compact task contract before editing
173
+ 4. `decantr_project` with `state` to check Essence, packs, graph readiness, local law, diagnostics, and next useful action calls
174
+ 5. `decantr_contract` with `capsule` and `decantr_graph` with `snapshot`, `query`, or `traverse` to read typed graph context
175
+ 6. `decantr_verify` with `critique`, `audit_project`, or `evidence_bundle` to produce local evidence; hosted upload remains opt-in with `allow_hosted_upload: true`
176
+ 7. `decantr_repair` with `findings`, `repair_plan`, or `repair_prompt` to enter a scoped evidence-backed repair loop
200
177
 
201
178
  The AI now generates code with the right layout structure, correct components, and consistent styling, then gets a scoped evidence-backed repair loop instead of a generic guess.
202
179
 
package/dist/bin.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-PFLHZF35.js";
2
+ import "./chunk-BXY4AIGA.js";
@@ -8,7 +8,7 @@ import { execFileSync } from "child_process";
8
8
  import { createHash } from "crypto";
9
9
  import { existsSync, readdirSync, readFileSync } from "fs";
10
10
  import { readFile as readFile2 } from "fs/promises";
11
- import { basename as basename2, dirname as dirname2, isAbsolute as isAbsolute2, join as join2, relative as relative2 } from "path";
11
+ import { basename as basename2, dirname as dirname2, isAbsolute as isAbsolute2, join as join2, relative as relative2, resolve as resolve2 } from "path";
12
12
  import {
13
13
  buildGraphImpactContext,
14
14
  buildGraphRouteContext,
@@ -670,9 +670,10 @@ function buildTaskTypedGraphContext(projectRoot, route, task = "", changedFiles
670
670
  function changedFilesForTask(projectRoot) {
671
671
  const changed = /* @__PURE__ */ new Set();
672
672
  try {
673
+ const gitRoot = gitTopLevelForTask(projectRoot) ?? projectRoot;
673
674
  for (const args of [
674
- ["diff", "--name-only"],
675
- ["diff", "--name-only", "--cached"]
675
+ ["diff", "--name-only", "--relative"],
676
+ ["diff", "--name-only", "--relative", "--cached"]
676
677
  ]) {
677
678
  const output = execFileSync("git", args, {
678
679
  cwd: projectRoot,
@@ -681,13 +682,38 @@ function changedFilesForTask(projectRoot) {
681
682
  });
682
683
  for (const entry of output.split(/\r?\n/)) {
683
684
  const file = entry.trim();
684
- if (file) changed.add(file);
685
+ const projectFile = changedFileForProject(projectRoot, gitRoot, file);
686
+ if (projectFile) changed.add(projectFile);
685
687
  }
686
688
  }
687
689
  } catch {
688
690
  }
689
691
  return [...changed].sort();
690
692
  }
693
+ function gitTopLevelForTask(projectRoot) {
694
+ try {
695
+ return execFileSync("git", ["rev-parse", "--show-toplevel"], {
696
+ cwd: projectRoot,
697
+ encoding: "utf-8",
698
+ stdio: ["ignore", "pipe", "ignore"]
699
+ }).trim();
700
+ } catch {
701
+ return null;
702
+ }
703
+ }
704
+ function changedFileForProject(projectRoot, gitRoot, file) {
705
+ if (!file) return null;
706
+ const absoluteProjectRoot = resolve2(projectRoot);
707
+ const candidateAbsoluteFiles = isAbsolute2(file) ? [file] : [join2(absoluteProjectRoot, file), join2(gitRoot, file)];
708
+ for (const absoluteFile of candidateAbsoluteFiles) {
709
+ const projectRelative = relative2(absoluteProjectRoot, absoluteFile).replace(/\\/g, "/");
710
+ if (!projectRelative || projectRelative.startsWith("../") || projectRelative === "..") {
711
+ continue;
712
+ }
713
+ return projectRelative;
714
+ }
715
+ return null;
716
+ }
691
717
  function impactedRoutesForFiles(projectRoot, files) {
692
718
  const analysis = readJsonIfExists(join2(projectRoot, ".decantr", "analysis.json"));
693
719
  const routeEntries = analysis?.routes?.routes ?? [];
@@ -1249,7 +1275,7 @@ function mcpCommandsForFinding(source) {
1249
1275
  case "graph":
1250
1276
  return ["decantr graph", "decantr health --evidence"];
1251
1277
  case "interaction":
1252
- return ["decantr check --strict", "decantr health"];
1278
+ return ["decantr verify --brownfield --local-patterns", "decantr verify --evidence"];
1253
1279
  case "pack":
1254
1280
  return [
1255
1281
  "decantr refresh",
@@ -1787,894 +1813,152 @@ async function getMcpWorkspaceHealth(args) {
1787
1813
  projects
1788
1814
  };
1789
1815
  }
1790
- var TOOLS = [
1791
- // 1. decantr_read_essence — local read
1792
- {
1793
- name: "decantr_read_essence",
1794
- title: "Read Essence",
1795
- description: "Read and return the current Essence v4 decantr.essence.json file from the working directory. Optionally filter by layer (dna, blueprint, or full).",
1796
- inputSchema: {
1797
- type: "object",
1798
- properties: {
1799
- path: {
1800
- type: "string",
1801
- description: "Optional path to essence file. Defaults to ./decantr.essence.json."
1802
- },
1803
- layer: {
1804
- type: "string",
1805
- enum: ["dna", "blueprint", "full"],
1806
- description: "For Essence v4 files: return only the specified layer. Defaults to full."
1807
- }
1808
- }
1809
- },
1810
- annotations: READ_ONLY
1811
- },
1812
- // 2. decantr_validate — local read
1813
- {
1814
- name: "decantr_validate",
1815
- title: "Validate Essence",
1816
- description: "Validate an Essence v4 decantr.essence.json file against the schema and guard rules, reporting DNA vs Blueprint violations separately.",
1817
- inputSchema: {
1818
- type: "object",
1819
- properties: {
1820
- path: {
1821
- type: "string",
1822
- description: "Path to essence file. Defaults to ./decantr.essence.json."
1823
- }
1824
- }
1825
- },
1826
- annotations: READ_ONLY
1827
- },
1828
- // 3. decantr_search_registry — network
1829
- {
1830
- name: "decantr_search_registry",
1831
- title: "Search Vocabulary",
1832
- description: "Search Decantr official/community vocabulary for patterns, archetypes, themes, and shells.",
1833
- inputSchema: {
1834
- type: "object",
1835
- properties: {
1836
- query: { type: "string", description: 'Search query (e.g. "kanban", "neon", "dashboard")' },
1837
- type: { type: "string", description: "Filter by type: pattern, archetype, theme, shell" },
1838
- sort: { type: "string", description: "Optional sort: recommended, recent, or name." },
1839
- recommended: { type: "boolean", description: "When true, only return recommended items." },
1840
- source: {
1841
- type: "string",
1842
- description: "Optional intelligence source filter: authored, benchmark, or hybrid."
1843
- }
1844
- },
1845
- required: ["query"]
1846
- },
1847
- annotations: READ_ONLY_NETWORK
1848
- },
1849
- // 4. decantr_resolve_pattern — network
1850
- {
1851
- name: "decantr_resolve_pattern",
1852
- title: "Resolve Pattern",
1853
- description: "Get full pattern details including layout spec, components, presets, and code examples.",
1854
- inputSchema: {
1855
- type: "object",
1856
- properties: {
1857
- id: { type: "string", description: 'Pattern ID (e.g. "hero", "data-table", "kpi-grid")' },
1858
- preset: { type: "string", description: 'Optional preset name (e.g. "product", "content")' },
1859
- namespace: { type: "string", description: 'Namespace (default: "@official")' }
1860
- },
1861
- required: ["id"]
1862
- },
1863
- annotations: READ_ONLY_NETWORK
1864
- },
1865
- // 5. decantr_resolve_archetype — network
1866
- {
1867
- name: "decantr_resolve_archetype",
1868
- title: "Resolve Archetype",
1869
- description: "Get archetype details including default pages, layouts, features, and suggested theme.",
1870
- inputSchema: {
1871
- type: "object",
1872
- properties: {
1873
- id: { type: "string", description: 'Archetype ID (e.g. "saas-dashboard", "ecommerce")' },
1874
- namespace: { type: "string", description: 'Namespace (default: "@official")' }
1875
- },
1876
- required: ["id"]
1877
- },
1878
- annotations: READ_ONLY_NETWORK
1879
- },
1880
- // 6. decantr_resolve_blueprint — network
1881
- {
1882
- name: "decantr_resolve_blueprint",
1883
- title: "Resolve Blueprint",
1884
- description: "Get a blueprint (app composition) with its archetype list, suggested theme, personality traits, and full page structure.",
1885
- inputSchema: {
1886
- type: "object",
1887
- properties: {
1888
- id: {
1889
- type: "string",
1890
- description: 'Blueprint ID (e.g. "saas-dashboard", "ecommerce", "portfolio")'
1891
- },
1892
- namespace: { type: "string", description: 'Namespace (default: "@official")' }
1893
- },
1894
- required: ["id"]
1895
- },
1896
- annotations: READ_ONLY_NETWORK
1897
- },
1898
- // 8. decantr_suggest_patterns — network
1899
- {
1900
- name: "decantr_suggest_patterns",
1901
- title: "Suggest Patterns",
1902
- description: "Given a page description, suggest appropriate patterns from the registry. Returns ranked pattern matches with layout specs and component lists.",
1903
- inputSchema: {
1904
- type: "object",
1905
- properties: {
1906
- description: {
1907
- type: "string",
1908
- description: 'Description of the page or section (e.g. "dashboard with metrics and charts", "settings form with toggles")'
1909
- },
1910
- route: {
1911
- type: "string",
1912
- description: 'Optional route context, for example "/feed" or "/settings".'
1913
- },
1914
- source_code: {
1915
- type: "string",
1916
- description: "Optional local source excerpt to rank against actual code evidence."
1917
- }
1918
- },
1919
- required: ["description"]
1920
- },
1921
- annotations: READ_ONLY_NETWORK
1922
- },
1923
- // 9. decantr_check_drift — local read
1924
- {
1925
- name: "decantr_check_drift",
1926
- title: "Check Drift",
1927
- description: "Check if code changes violate the design intent captured in the Essence v4 spec. Returns separate dna_violations and blueprint_drift with autoFixable flags.",
1928
- inputSchema: {
1929
- type: "object",
1930
- properties: {
1931
- path: {
1932
- type: "string",
1933
- description: "Path to essence file. Defaults to ./decantr.essence.json."
1934
- },
1935
- page_id: {
1936
- type: "string",
1937
- description: 'Page ID being modified (e.g. "overview", "settings")'
1938
- },
1939
- components_used: {
1940
- type: "array",
1941
- items: { type: "string" },
1942
- description: "List of component names used in the generated code. Checked against page layout patterns."
1943
- },
1944
- theme_used: { type: "string", description: "Theme id used in the generated code" }
1945
- }
1946
- },
1947
- annotations: READ_ONLY
1948
- },
1949
- // 10. decantr_create_essence — network (fetches archetype)
1950
- {
1951
- name: "decantr_create_essence",
1952
- title: "Create Essence",
1953
- description: "Generate a valid Essence v4 skeleton from a project description. Returns a sectioned decantr.essence.json template based on the closest matching archetype and blueprint.",
1954
- inputSchema: {
1955
- type: "object",
1956
- properties: {
1957
- description: {
1958
- type: "string",
1959
- description: 'Natural language project description (e.g. "SaaS dashboard with analytics, user management, and billing")'
1960
- },
1961
- framework: {
1962
- type: "string",
1963
- description: 'Target framework (e.g. "react", "vue", "svelte"). Defaults to "react".'
1964
- }
1965
- },
1966
- required: ["description"]
1967
- },
1968
- annotations: READ_ONLY_NETWORK
1969
- },
1970
- // 11. decantr_accept_drift — WRITE tool (NEW)
1971
- {
1972
- name: "decantr_accept_drift",
1973
- title: "Accept Drift",
1974
- description: "Resolve guard violations by accepting, scoping, rejecting, or deferring drift. For DNA violations, requires explicit confirmation. Updates the essence file or drift log.",
1975
- inputSchema: {
1976
- type: "object",
1977
- properties: {
1978
- violations: {
1979
- type: "array",
1980
- items: {
1981
- type: "object",
1982
- properties: {
1983
- rule: { type: "string" },
1984
- page_id: { type: "string" },
1985
- details: { type: "string" }
1986
- },
1987
- required: ["rule"]
1988
- },
1989
- description: "The violations to resolve."
1990
- },
1991
- resolution: {
1992
- type: "string",
1993
- enum: ["accept", "accept_scoped", "reject", "defer"],
1994
- description: "How to resolve: accept updates the essence, accept_scoped limits to a page, reject is a no-op, defer logs for later."
1995
- },
1996
- scope: { type: "string", description: "For accept_scoped: the page or section scope." },
1997
- path: {
1998
- type: "string",
1999
- description: "Path to essence file. Defaults to ./decantr.essence.json."
2000
- },
2001
- confirm_dna: {
2002
- type: "boolean",
2003
- description: "Required to be true when accepting DNA-layer violations."
2004
- }
2005
- },
2006
- required: ["violations", "resolution"]
2007
- },
2008
- annotations: WRITE_TOOL
2009
- },
2010
- // 12. decantr_update_essence — WRITE tool (NEW)
2011
- {
2012
- name: "decantr_update_essence",
2013
- title: "Update Essence",
2014
- description: "Mutate an Essence v4 file: add/remove/update pages, update DNA or blueprint fields, add/remove features. Older projects must run `decantr migrate --to v4` first.",
2015
- inputSchema: {
2016
- type: "object",
2017
- properties: {
2018
- operation: {
2019
- type: "string",
2020
- enum: [
2021
- "add_page",
2022
- "remove_page",
2023
- "update_page_layout",
2024
- "update_dna",
2025
- "update_blueprint",
2026
- "add_feature",
2027
- "remove_feature"
2028
- ],
2029
- description: "The mutation operation to perform."
2030
- },
2031
- payload: {
2032
- type: "object",
2033
- description: "Operation-specific payload. See tool docs for each operation."
2034
- },
2035
- path: {
2036
- type: "string",
2037
- description: "Path to essence file. Defaults to ./decantr.essence.json."
2038
- }
2039
- },
2040
- required: ["operation", "payload"]
2041
- },
2042
- annotations: WRITE_TOOL
2043
- },
2044
- // 13. decantr_get_scaffold_context — local read
2045
- {
2046
- name: "decantr_get_scaffold_context",
2047
- title: "Get Scaffold Context",
2048
- description: "Get the top-level scaffold context for the current project. Returns the scaffold task brief, scaffold overview, compiled scaffold execution pack, compiled review pack, and pack manifest when available. Falls back to hosted execution-pack compilation when local context artifacts are missing.",
2049
- inputSchema: {
2050
- type: "object",
2051
- properties: {
2052
- path: {
2053
- type: "string",
2054
- description: "Optional path to an essence file when using hosted fallback compilation. Defaults to ./decantr.essence.json."
2055
- },
2056
- namespace: {
2057
- type: "string",
2058
- description: 'Optional preferred public namespace for hosted fallback compilation. Defaults to "@official".'
2059
- }
2060
- }
2061
- },
2062
- annotations: READ_ONLY
2063
- },
2064
- // 14. decantr_get_section_context — local read
2065
- {
2066
- name: "decantr_get_section_context",
2067
- title: "Get Section Context",
2068
- description: "Get the self-contained context for a specific section of the project. Returns the richer section context file and, when available, the compiled section execution pack for a more compact contract-first view. Falls back to hosted execution-pack compilation when local pack artifacts are missing.",
2069
- inputSchema: {
2070
- type: "object",
2071
- properties: {
2072
- section_id: {
2073
- type: "string",
2074
- description: 'Section ID (archetype ID, e.g., "ai-chatbot", "auth-full", "settings-full")'
2075
- },
2076
- path: {
2077
- type: "string",
2078
- description: "Optional path to an essence file when using hosted fallback compilation. Defaults to ./decantr.essence.json."
2079
- },
2080
- namespace: {
2081
- type: "string",
2082
- description: 'Optional preferred public namespace for hosted fallback compilation. Defaults to "@official".'
2083
- }
2084
- },
2085
- required: ["section_id"]
2086
- },
2087
- annotations: READ_ONLY
2088
- },
2089
- // 15. decantr_get_page_context — local read
2090
- {
2091
- name: "decantr_get_page_context",
2092
- title: "Get Page Context",
2093
- description: "Get the route-local context for a specific page. Returns the compiled page execution pack plus its parent section pack and section context when available. Falls back to hosted execution-pack compilation when local pack artifacts are missing.",
2094
- inputSchema: {
2095
- type: "object",
2096
- properties: {
2097
- page_id: {
2098
- type: "string",
2099
- description: 'Page ID (for example "overview", "settings", or "home").'
2100
- },
2101
- path: {
2102
- type: "string",
2103
- description: "Optional path to an essence file when using hosted fallback compilation. Defaults to ./decantr.essence.json."
2104
- },
2105
- namespace: {
2106
- type: "string",
2107
- description: 'Optional preferred public namespace for hosted fallback compilation. Defaults to "@official".'
2108
- }
2109
- },
2110
- required: ["page_id"]
2111
- },
2112
- annotations: READ_ONLY
2113
- },
2114
- // 16. decantr_get_project_state — local read
2115
- {
2116
- name: "decantr_get_project_state",
2117
- title: "Get Project State",
2118
- description: "Read a compact typed summary of the active Decantr project: Essence version, routes, generated packs, typed graph artifacts, local law, style bridge, diagnostic catalog, and recommended next MCP tools.",
2119
- inputSchema: {
2120
- type: "object",
2121
- properties: {
2122
- project_path: {
2123
- type: "string",
2124
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2125
- }
2126
- }
2127
- },
2128
- annotations: READ_ONLY
2129
- },
2130
- // 17. decantr_prepare_task_context — local read
2131
- {
2132
- name: "decantr_prepare_task_context",
2133
- title: "Prepare Task Context",
2134
- description: "Resolve compact Brownfield/Essence task-time context for a route or page before editing. Returns route, section, page pack, directives, local law, behavior obligations, style bridge mappings, typed graph context, health evidence, and local screenshot references when available.",
2135
- inputSchema: {
2136
- type: "object",
2137
- properties: {
2138
- project_path: {
2139
- type: "string",
2140
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2141
- },
2142
- route: {
2143
- type: "string",
2144
- description: 'Route being edited, for example "/feed". Preferred when known.'
2145
- },
2146
- page_id: {
2147
- type: "string",
2148
- description: "Page ID when route is unknown."
2149
- },
2150
- task: {
2151
- type: "string",
2152
- description: "Short task description used to rank relevant patterns and context."
2153
- }
2154
- }
2155
- },
2156
- annotations: READ_ONLY
2157
- },
2158
- // 17. decantr_get_contract_capsule — local typed graph read
2159
- {
2160
- name: "decantr_get_contract_capsule",
2161
- title: "Get Contract Capsule",
2162
- description: "Read the Decantr typed Contract capsule generated by `decantr graph`. This is the compact, cache-friendly Contract summary agents should load near session start.",
2163
- inputSchema: {
2164
- type: "object",
2165
- properties: {
2166
- project_path: {
2167
- type: "string",
2168
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2169
- }
2170
- }
2171
- },
2172
- annotations: READ_ONLY
2173
- },
2174
- // 18. decantr_get_graph_snapshot — local typed graph read
2175
- {
2176
- name: "decantr_get_graph_snapshot",
2177
- title: "Get Graph Snapshot",
2178
- description: "Read the Decantr typed graph snapshot generated by `decantr graph`. By default returns snapshot metadata and available routes; pass route for a scoped route subgraph, include_history for a compact local timeline, or include_full for the full snapshot.",
2179
- inputSchema: {
2180
- type: "object",
2181
- properties: {
2182
- project_path: {
2183
- type: "string",
2184
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2185
- },
2186
- route: {
2187
- type: "string",
2188
- description: 'Optional route path, for example "/settings", to return a scoped subgraph.'
2189
- },
2190
- node_id: {
2191
- type: "string",
2192
- description: 'Optional graph node ID, for example "cmp:button" or "tkn:surface", to return dependency impact context.'
2193
- },
2194
- file_path: {
2195
- type: "string",
2196
- description: 'Optional project-relative source file path, for example "src/app/page.tsx", to return dependency impact context for its SourceArtifact node.'
2197
- },
2198
- snapshot_id: {
2199
- type: "string",
2200
- description: 'Optional graph snapshot id to read from .decantr/graph/snapshots. Use "current" or omit for graph.snapshot.json.'
2201
- },
2202
- compare_to: {
2203
- type: "string",
2204
- description: 'Optional snapshot id to diff against the selected snapshot. Use "current" for graph.snapshot.json.'
2205
- },
2206
- include_diff_ops: {
2207
- type: "boolean",
2208
- description: "Include diff operation details when compare_to is provided. Defaults to false."
2209
- },
2210
- limit: {
2211
- type: "number",
2212
- description: "Maximum diff operations or impact nodes to return. Defaults to 200, maximum 500."
2213
- },
2214
- include_full: {
2215
- type: "boolean",
2216
- description: "Return the full graph snapshot instead of metadata. Defaults to false."
2217
- },
2218
- include_history: {
2219
- type: "boolean",
2220
- description: "Include a compact index of local snapshot history entries from .decantr/graph/snapshots. Defaults to false."
2221
- },
2222
- task: {
2223
- type: "string",
2224
- description: "Optional task description used to boost matching nodes in route-scoped or impact ranked context."
2225
- }
2226
- }
2227
- },
2228
- annotations: READ_ONLY
1816
+ var CONSOLIDATED_TOOL_ACTIONS = {
1817
+ decantr_project: {
1818
+ state: "decantr_get_project_state",
1819
+ workspace_health: "decantr_workspace_health"
2229
1820
  },
2230
- // 19. decantr_query_graph — local typed graph read
2231
- {
2232
- name: "decantr_query_graph",
2233
- title: "Query Graph",
2234
- description: "Run a narrow typed query against the local Decantr graph snapshot generated by `decantr graph`. Use for direct node/type/relation lookups instead of reading the full graph.",
2235
- inputSchema: {
2236
- type: "object",
2237
- properties: {
2238
- project_path: {
2239
- type: "string",
2240
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2241
- },
2242
- snapshot_id: {
2243
- type: "string",
2244
- description: 'Optional snapshot id from local graph history, or "current". Defaults to current.'
2245
- },
2246
- node_ids: {
2247
- type: "array",
2248
- items: { type: "string" },
2249
- description: 'Optional exact graph node IDs to return, for example ["rt:/feed"].'
2250
- },
2251
- file_path: {
2252
- type: "string",
2253
- description: 'Optional project-relative source file path, for example "src/app/page.tsx", resolved to a SourceArtifact node selector.'
2254
- },
2255
- node_type: {
2256
- type: "string",
2257
- enum: [...GRAPH_NODE_TYPES],
2258
- description: 'Optional single node type selector, for example "Route" or "Component".'
2259
- },
2260
- node_types: {
2261
- type: "array",
2262
- items: { type: "string", enum: [...GRAPH_NODE_TYPES] },
2263
- description: "Optional node type selectors."
2264
- },
2265
- payload_key: {
2266
- type: "string",
2267
- description: 'Optional node payload key or dotted path filter, for example "code" for Finding nodes.'
2268
- },
2269
- payload_value: {
2270
- type: "string",
2271
- description: 'Optional exact stringified payload value used with payload_key, for example "COMP010".'
2272
- },
2273
- payload_contains: {
2274
- type: "string",
2275
- description: "Optional case-insensitive substring filter over the node payload JSON."
2276
- },
2277
- edge_src: {
2278
- type: "string",
2279
- description: "Optional edge source node ID selector."
2280
- },
2281
- edge_dst: {
2282
- type: "string",
2283
- description: "Optional edge destination node ID selector."
2284
- },
2285
- relation: {
2286
- type: "string",
2287
- enum: [...GRAPH_RELATIONS],
2288
- description: 'Optional single edge relation selector, for example "PAGE_COMPOSES_PATTERN".'
2289
- },
2290
- relations: {
2291
- type: "array",
2292
- items: { type: "string", enum: [...GRAPH_RELATIONS] },
2293
- description: "Optional edge relation selectors."
2294
- },
2295
- include_edges: {
2296
- type: "boolean",
2297
- description: "When querying nodes, include incident edges and their opposite endpoint nodes. Defaults to false unless edge selectors are present."
2298
- },
2299
- include_impact: {
2300
- type: "boolean",
2301
- description: "When querying nodes, also return the dependency impact context for the matched node IDs."
2302
- },
2303
- task: {
2304
- type: "string",
2305
- description: "Optional task description used to boost matching nodes in the impact ranking when include_impact is true."
2306
- },
2307
- limit: {
2308
- type: "number",
2309
- description: "Maximum nodes and edges to return. Defaults to 200, maximum 500."
2310
- }
2311
- }
2312
- },
2313
- annotations: READ_ONLY
1821
+ decantr_contract: {
1822
+ read_essence: "decantr_read_essence",
1823
+ validate: "decantr_validate",
1824
+ check_drift: "decantr_check_drift",
1825
+ create_essence: "decantr_create_essence",
1826
+ capsule: "decantr_get_contract_capsule"
2314
1827
  },
2315
- // 20. decantr_traverse_graph — local typed graph read
2316
- {
2317
- name: "decantr_traverse_graph",
2318
- title: "Traverse Graph",
2319
- description: "Traverse the local Decantr graph from one or more node IDs or a source file by relation, direction, and depth. Use for questions like which pages use this token or which graph nodes point at this source file.",
2320
- inputSchema: {
2321
- type: "object",
2322
- properties: {
2323
- project_path: {
2324
- type: "string",
2325
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2326
- },
2327
- snapshot_id: {
2328
- type: "string",
2329
- description: 'Optional snapshot id from local graph history, or "current". Defaults to current.'
2330
- },
2331
- from: {
2332
- type: "string",
2333
- description: 'Start node ID, for example "rt:/feed" or "tkn:color.primary".'
2334
- },
2335
- from_ids: {
2336
- type: "array",
2337
- items: { type: "string" },
2338
- description: "Optional start node IDs. Used when traversing from multiple anchors."
2339
- },
2340
- file_path: {
2341
- type: "string",
2342
- description: 'Optional project-relative source file path, for example "src/app/page.tsx", resolved to a SourceArtifact start node.'
2343
- },
2344
- relations: {
2345
- type: "array",
2346
- items: { type: "string", enum: [...GRAPH_RELATIONS] },
2347
- description: "Optional relation allow-list. When omitted, all relations are traversed."
2348
- },
2349
- direction: {
2350
- type: "string",
2351
- enum: ["out", "in", "both"],
2352
- description: "Traversal direction. Defaults to out."
2353
- },
2354
- depth: {
2355
- type: "number",
2356
- description: "Traversal depth. Defaults to 1, maximum 4."
2357
- },
2358
- limit: {
2359
- type: "number",
2360
- description: "Maximum nodes and edges to return. Defaults to 200, maximum 500."
2361
- }
2362
- }
2363
- },
2364
- annotations: READ_ONLY
1828
+ decantr_context: {
1829
+ scaffold: "decantr_get_scaffold_context",
1830
+ section: "decantr_get_section_context",
1831
+ page: "decantr_get_page_context",
1832
+ task: "decantr_prepare_task_context",
1833
+ execution_pack: "decantr_get_execution_pack"
2365
1834
  },
2366
- // 21. decantr_get_execution_pack — local read
2367
- {
2368
- name: "decantr_get_execution_pack",
2369
- title: "Get Execution Pack",
2370
- description: "Read compiled execution packs from .decantr/context. Returns the pack manifest by default, or a specific scaffold, review, mutation, section, or page pack in markdown, JSON, or both. Falls back to the hosted selected-pack surface for targeted reads when local pack artifacts are missing.",
2371
- inputSchema: {
2372
- type: "object",
2373
- properties: {
2374
- pack_type: {
2375
- type: "string",
2376
- enum: ["manifest", "scaffold", "review", "mutation", "section", "page"],
2377
- description: "Pack type to fetch. Defaults to manifest."
2378
- },
2379
- id: {
2380
- type: "string",
2381
- description: 'Required for section/page/mutation packs (for example "dashboard", "overview", or "modify").'
2382
- },
2383
- format: {
2384
- type: "string",
2385
- enum: ["json", "markdown", "both"],
2386
- description: "Return format for a specific pack. Defaults to both."
2387
- },
2388
- path: {
2389
- type: "string",
2390
- description: "Optional path to an essence file when using hosted fallback compilation. Defaults to ./decantr.essence.json."
2391
- },
2392
- namespace: {
2393
- type: "string",
2394
- description: 'Optional preferred public namespace for hosted fallback compilation. Defaults to "@official".'
2395
- }
2396
- }
2397
- },
2398
- annotations: READ_ONLY
1835
+ decantr_graph: {
1836
+ snapshot: "decantr_get_graph_snapshot",
1837
+ query: "decantr_query_graph",
1838
+ traverse: "decantr_traverse_graph"
2399
1839
  },
2400
- // 17. decantr_get_showcase_benchmarks — network read
2401
- {
2402
- name: "decantr_get_showcase_benchmarks",
2403
- title: "Get Showcase Benchmarks",
2404
- description: "Read the audited Decantr showcase corpus metadata. Returns the active manifest, shortlisted benchmark set, or the schema-backed shortlist verification report.",
2405
- inputSchema: {
2406
- type: "object",
2407
- properties: {
2408
- view: {
2409
- type: "string",
2410
- enum: ["manifest", "shortlist", "verification"],
2411
- description: "Which showcase benchmark view to return. Defaults to shortlist."
2412
- }
2413
- }
2414
- },
2415
- annotations: READ_ONLY_NETWORK
1840
+ decantr_registry: {
1841
+ search: "decantr_search_registry",
1842
+ resolve_pattern: "decantr_resolve_pattern",
1843
+ resolve_archetype: "decantr_resolve_archetype",
1844
+ resolve_blueprint: "decantr_resolve_blueprint",
1845
+ suggest_patterns: "decantr_suggest_patterns",
1846
+ showcase_benchmarks: "decantr_get_showcase_benchmarks",
1847
+ intelligence_summary: "decantr_get_registry_intelligence_summary",
1848
+ compile_execution_packs: "decantr_compile_execution_packs"
2416
1849
  },
2417
- // 18. decantr_get_registry_intelligence_summary — network read
2418
- {
2419
- name: "decantr_get_registry_intelligence_summary",
2420
- title: "Get Registry Intelligence Summary",
2421
- description: "Read the hosted schema-backed registry intelligence summary. Useful for checking overall intelligence/recommendation coverage without crawling every item.",
2422
- inputSchema: {
2423
- type: "object",
2424
- properties: {
2425
- namespace: {
2426
- type: "string",
2427
- description: 'Optional namespace to scope the summary to, for example "@official".'
2428
- }
2429
- }
2430
- },
2431
- annotations: READ_ONLY_NETWORK
1850
+ decantr_verify: {
1851
+ audit_project: "decantr_audit_project",
1852
+ critique: "decantr_critique",
1853
+ findings: "decantr_get_findings",
1854
+ evidence_bundle: "decantr_get_evidence_bundle",
1855
+ health_loop: "decantr_run_health_loop"
2432
1856
  },
2433
- // 19. decantr_compile_execution_packs — network read
2434
- {
2435
- name: "decantr_compile_execution_packs",
2436
- title: "Compile Execution Packs",
2437
- description: "Compile a hosted execution-pack bundle from an essence document using the public Decantr API. Reads the local essence file by default, or accepts an inline essence object.",
2438
- inputSchema: {
2439
- type: "object",
2440
- properties: {
2441
- path: {
2442
- type: "string",
2443
- description: "Optional path to an essence file. Defaults to ./decantr.essence.json when essence is not provided."
2444
- },
2445
- essence: {
2446
- type: "object",
2447
- description: "Optional inline essence document to compile instead of reading from disk."
2448
- },
2449
- namespace: {
2450
- type: "string",
2451
- description: 'Optional preferred public namespace for content resolution. Defaults to "@official".'
2452
- }
2453
- }
2454
- },
2455
- annotations: READ_ONLY_NETWORK
1857
+ decantr_repair: {
1858
+ findings: "decantr_get_findings",
1859
+ repair_plan: "decantr_get_repair_plan",
1860
+ repair_prompt: "decantr_get_repair_prompt",
1861
+ health_loop: "decantr_run_health_loop"
2456
1862
  },
2457
- // 20. decantr_audit_project — local read with hosted fallback
2458
- {
2459
- name: "decantr_audit_project",
2460
- title: "Audit Project",
2461
- description: "Audit the current project against the essence contract, guard rules, and compiled execution packs. Can fall back to the hosted verifier when local compiled pack artifacts are missing only when allow_hosted_upload is true. Returns a schema-backed project audit report.",
2462
- inputSchema: {
2463
- type: "object",
2464
- properties: {
2465
- path: {
2466
- type: "string",
2467
- description: "Optional path to the essence file for hosted fallback. Defaults to ./decantr.essence.json."
2468
- },
2469
- namespace: {
2470
- type: "string",
2471
- description: 'Optional preferred public namespace for hosted fallback. Defaults to "@official".'
2472
- },
2473
- dist_path: {
2474
- type: "string",
2475
- description: "Optional path to a local dist directory to snapshot for hosted runtime verification. Defaults to ./dist."
2476
- },
2477
- sources_path: {
2478
- type: "string",
2479
- description: "Optional path to a local source directory to snapshot for hosted source-level verification. For example `src` or `app`."
2480
- },
2481
- allow_hosted_upload: {
2482
- type: "boolean",
2483
- description: "Explicitly opt in to uploading local dist/source snapshots to the hosted verifier when local packs are missing. Defaults to false."
2484
- }
2485
- }
2486
- },
2487
- annotations: READ_ONLY_NETWORK
2488
- },
2489
- // 21. decantr_critique — local read with hosted fallback
2490
- {
2491
- name: "decantr_critique",
2492
- title: "Design Critique",
2493
- description: "Critique a file against the compiled review contract and Decantr verification heuristics. Can fall back to the hosted verifier when local review packs are missing only when allow_hosted_upload is true. Returns a schema-backed file critique report with scores, findings, and focus areas.",
1863
+ decantr_contract_write: {
1864
+ accept_drift: "decantr_accept_drift",
1865
+ update_essence: "decantr_update_essence"
1866
+ }
1867
+ };
1868
+ function consolidatedActionNames(name) {
1869
+ return Object.keys(CONSOLIDATED_TOOL_ACTIONS[name]);
1870
+ }
1871
+ function consolidatedTool(name, title, description, annotations) {
1872
+ return {
1873
+ name,
1874
+ title,
1875
+ description,
2494
1876
  inputSchema: {
2495
1877
  type: "object",
2496
1878
  properties: {
2497
- file_path: {
1879
+ action: {
2498
1880
  type: "string",
2499
- description: "Path to the component file to critique"
2500
- },
2501
- path: {
2502
- type: "string",
2503
- description: "Optional path to the essence file when using hosted fallback. Defaults to ./decantr.essence.json."
2504
- },
2505
- namespace: {
2506
- type: "string",
2507
- description: 'Optional preferred public namespace for hosted fallback. Defaults to "@official".'
2508
- },
2509
- treatments_path: {
2510
- type: "string",
2511
- description: "Optional path to treatments.css when using hosted fallback. Defaults to ./src/styles/treatments.css."
2512
- },
2513
- allow_hosted_upload: {
2514
- type: "boolean",
2515
- description: "Explicitly opt in to uploading the target source file to the hosted verifier when local review packs are missing. Defaults to false."
1881
+ enum: consolidatedActionNames(name),
1882
+ description: "Action to run through this consolidated Decantr MCP tool."
2516
1883
  }
2517
1884
  },
2518
- required: ["file_path"]
2519
- },
2520
- annotations: READ_ONLY_NETWORK
2521
- },
2522
- // 24. decantr_get_findings — local typed findings read
2523
- {
2524
- name: "decantr_get_findings",
2525
- title: "Get Findings",
2526
- description: "Return typed Project Health findings for the current Decantr project, with stable codes, repair IDs, graph anchors when available, and optional repair prompts.",
2527
- inputSchema: {
2528
- type: "object",
2529
- properties: {
2530
- project_path: {
2531
- type: "string",
2532
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2533
- },
2534
- severity: {
2535
- type: "string",
2536
- enum: ["error", "warn", "info"],
2537
- description: "Optional severity filter."
2538
- },
2539
- source: {
2540
- type: "string",
2541
- enum: [
2542
- "audit",
2543
- "assertion",
2544
- "browser",
2545
- "check",
2546
- "brownfield",
2547
- "design-token",
2548
- "style-bridge",
2549
- "graph",
2550
- "runtime",
2551
- "pack",
2552
- "interaction"
2553
- ],
2554
- description: "Optional finding source filter."
2555
- },
2556
- code: {
2557
- type: "string",
2558
- description: 'Optional stable diagnostic code filter, for example "TOKEN010".'
2559
- },
2560
- include_prompts: {
2561
- type: "boolean",
2562
- description: "Include full repair prompts on each finding. Defaults to false to keep context compact."
2563
- },
2564
- limit: {
2565
- type: "number",
2566
- description: "Maximum findings to return. Defaults to 50, maximum 200."
2567
- }
2568
- }
2569
- },
2570
- annotations: READ_ONLY
2571
- },
2572
- // 25. decantr_get_repair_plan — local structured repair loop
2573
- {
2574
- name: "decantr_get_repair_plan",
2575
- title: "Get Repair Plan",
2576
- description: "Return a typed repair plan for one Project Health finding: diagnostic code, repair ID, graph anchor, action payload, evidence, read targets, preserve/avoid constraints, rerun commands, and optional prompt text.",
2577
- inputSchema: {
2578
- type: "object",
2579
- properties: {
2580
- project_path: {
2581
- type: "string",
2582
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2583
- },
2584
- finding_id: {
2585
- type: "string",
2586
- description: "Optional finding id. Defaults to the first error or warning, then the first finding."
2587
- },
2588
- code: {
2589
- type: "string",
2590
- description: 'Optional stable diagnostic code selector, for example "GRAPH001".'
2591
- },
2592
- include_prompt: {
2593
- type: "boolean",
2594
- description: "Include the human-readable repair prompt alongside the typed plan."
2595
- }
2596
- }
1885
+ required: ["action"],
1886
+ additionalProperties: true
2597
1887
  },
2598
- annotations: READ_ONLY
2599
- },
2600
- // 26. decantr_get_evidence_bundle — local reliability artifact
2601
- {
2602
- name: "decantr_get_evidence_bundle",
2603
- title: "Get Evidence Bundle",
2604
- description: "Generate a local Evidence Bundle for the current Decantr project. The bundle redacts source, prompts, secrets, absolute paths, repo names, and screenshots by default.",
2605
- inputSchema: {
2606
- type: "object",
2607
- properties: {
2608
- project_path: {
2609
- type: "string",
2610
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2611
- }
2612
- }
2613
- },
2614
- annotations: READ_ONLY
2615
- },
2616
- // 23. decantr_workspace_health — local workspace reliability scan
2617
- {
2618
- name: "decantr_workspace_health",
2619
- title: "Workspace Health",
2620
- description: "Discover Decantr projects in the active workspace and return deterministic aggregate health for monorepos with many Decantr apps.",
2621
- inputSchema: {
2622
- type: "object",
2623
- properties: {
2624
- workspace_root: {
2625
- type: "string",
2626
- description: "Optional relative workspace root inside the active workspace. Defaults to the current working directory."
2627
- },
2628
- max_projects: {
2629
- type: "number",
2630
- description: "Optional cap on discovered projects. Defaults to 500."
2631
- }
2632
- }
2633
- },
2634
- annotations: READ_ONLY
2635
- },
2636
- // 24. decantr_get_repair_prompt — local AI repair loop
2637
- {
2638
- name: "decantr_get_repair_prompt",
2639
- title: "Get Repair Prompt",
2640
- description: "Return an AI-ready repair prompt for a Project Health finding, including exact finding evidence, preserved constraints, do-not-change guidance, and rerun commands.",
2641
- inputSchema: {
2642
- type: "object",
2643
- properties: {
2644
- project_path: {
2645
- type: "string",
2646
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2647
- },
2648
- finding_id: {
2649
- type: "string",
2650
- description: "Optional finding id. Defaults to the first error or warning, then the first finding."
2651
- }
2652
- }
2653
- },
2654
- annotations: READ_ONLY
2655
- },
2656
- // 25. decantr_run_health_loop — local evidence + repair loop
2657
- {
2658
- name: "decantr_run_health_loop",
2659
- title: "Run Health Loop",
2660
- description: "Run Project Health, produce evidence, and return the next repair prompt for AI agents without uploading project source.",
2661
- inputSchema: {
2662
- type: "object",
2663
- properties: {
2664
- project_path: {
2665
- type: "string",
2666
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2667
- },
2668
- finding_id: {
2669
- type: "string",
2670
- description: "Optional finding id to target. Defaults to the first error or warning, then the first finding."
2671
- }
2672
- }
2673
- },
2674
- annotations: READ_ONLY
2675
- }
1888
+ annotations
1889
+ };
1890
+ }
1891
+ var TOOLS = [
1892
+ consolidatedTool(
1893
+ "decantr_project",
1894
+ "Decantr Project",
1895
+ "Read local project state and workspace health without uploading source.",
1896
+ READ_ONLY
1897
+ ),
1898
+ consolidatedTool(
1899
+ "decantr_contract",
1900
+ "Decantr Contract",
1901
+ "Read, validate, drift-check, generate, or summarize the active Decantr contract.",
1902
+ READ_ONLY_NETWORK
1903
+ ),
1904
+ consolidatedTool(
1905
+ "decantr_context",
1906
+ "Decantr Context",
1907
+ "Read scaffold, section, page, task, and execution-pack context for agent work.",
1908
+ READ_ONLY_NETWORK
1909
+ ),
1910
+ consolidatedTool(
1911
+ "decantr_graph",
1912
+ "Decantr Graph",
1913
+ "Read, query, and traverse local typed Contract graph artifacts.",
1914
+ READ_ONLY
1915
+ ),
1916
+ consolidatedTool(
1917
+ "decantr_registry",
1918
+ "Decantr Registry",
1919
+ "Search and resolve hosted registry content, benchmark metadata, and execution packs.",
1920
+ READ_ONLY_NETWORK
1921
+ ),
1922
+ consolidatedTool(
1923
+ "decantr_verify",
1924
+ "Decantr Verify",
1925
+ "Run local verification reads, critique files, and return evidence or health findings.",
1926
+ READ_ONLY_NETWORK
1927
+ ),
1928
+ consolidatedTool(
1929
+ "decantr_repair",
1930
+ "Decantr Repair",
1931
+ "Read typed findings, repair plans, repair prompts, and health-loop guidance.",
1932
+ READ_ONLY
1933
+ ),
1934
+ consolidatedTool(
1935
+ "decantr_contract_write",
1936
+ "Decantr Contract Write",
1937
+ "Explicit write surface for accepting drift or mutating Essence v4 inside the workspace.",
1938
+ WRITE_TOOL
1939
+ )
2676
1940
  ];
2677
1941
  async function handleTool(name, args) {
1942
+ if (!(name in CONSOLIDATED_TOOL_ACTIONS)) {
1943
+ return { error: `Unknown tool: ${name}` };
1944
+ }
1945
+ const actionMap = CONSOLIDATED_TOOL_ACTIONS[name];
1946
+ if (typeof args.action !== "string" || !args.action.trim()) {
1947
+ return {
1948
+ error: `Required parameter "action" must be one of: ${Object.keys(actionMap).join(", ")}.`
1949
+ };
1950
+ }
1951
+ const action = args.action.trim();
1952
+ const legacyName = actionMap[action];
1953
+ if (!legacyName) {
1954
+ return {
1955
+ error: `Unsupported action "${action}" for ${name}. Must be one of: ${Object.keys(actionMap).join(", ")}.`
1956
+ };
1957
+ }
1958
+ const { action: _action, ...routedArgs } = args;
1959
+ return handleLegacyTool(legacyName, routedArgs);
1960
+ }
1961
+ async function handleLegacyTool(name, args) {
2678
1962
  const apiClient = getAPIClient();
2679
1963
  switch (name) {
2680
1964
  case "decantr_read_essence": {
@@ -3198,7 +2482,7 @@ async function handleTool(name, args) {
3198
2482
  };
3199
2483
  }
3200
2484
  try {
3201
- const { essence, path } = await mutateEssenceFile(args.path, (v4) => {
2485
+ const { path } = await mutateEssenceFile(args.path, (v4) => {
3202
2486
  for (const v of violations) {
3203
2487
  applyDriftAcceptance(v4, v, resolution, args.scope);
3204
2488
  }
@@ -3238,7 +2522,7 @@ async function handleTool(name, args) {
3238
2522
  };
3239
2523
  }
3240
2524
  try {
3241
- const { essence, path } = await mutateEssenceFile(args.path, (v4) => {
2525
+ const { path } = await mutateEssenceFile(args.path, (v4) => {
3242
2526
  return applyEssenceUpdate(v4, operation, payload);
3243
2527
  });
3244
2528
  return {
@@ -3360,13 +2644,21 @@ async function handleTool(name, args) {
3360
2644
  })).sort((a, b) => a.code.localeCompare(b.code) || a.rule.localeCompare(b.rule))
3361
2645
  },
3362
2646
  recommended_next_tools: [
3363
- graphReady ? "decantr_get_contract_capsule" : "decantr_get_findings",
3364
- graphReady ? null : "decantr_get_repair_plan",
3365
- snapshot ? "decantr_get_graph_snapshot" : null,
3366
- "decantr_prepare_task_context",
3367
- "decantr_get_findings",
3368
- "decantr_get_evidence_bundle"
3369
- ].filter((tool) => Boolean(tool))
2647
+ graphReady ? "decantr_contract" : "decantr_repair",
2648
+ graphReady ? null : "decantr_repair",
2649
+ snapshot ? "decantr_graph" : null,
2650
+ "decantr_context",
2651
+ "decantr_repair",
2652
+ "decantr_verify"
2653
+ ].filter((tool) => Boolean(tool)).filter((tool, index, tools) => tools.indexOf(tool) === index),
2654
+ recommended_next_actions: [
2655
+ graphReady ? { tool: "decantr_contract", action: "capsule" } : { tool: "decantr_repair", action: "findings" },
2656
+ graphReady ? null : { tool: "decantr_repair", action: "repair_plan" },
2657
+ snapshot ? { tool: "decantr_graph", action: "snapshot" } : null,
2658
+ { tool: "decantr_context", action: "task" },
2659
+ { tool: "decantr_repair", action: "findings" },
2660
+ { tool: "decantr_verify", action: "evidence_bundle" }
2661
+ ].filter((action) => Boolean(action))
3370
2662
  };
3371
2663
  } catch (e) {
3372
2664
  return { error: `Could not read project state: ${e.message}` };
@@ -4303,7 +3595,6 @@ async function handleTool(name, args) {
4303
3595
  const manifestPath = join2(contextDir, "pack-manifest.json");
4304
3596
  let manifest = null;
4305
3597
  let manifestSource = null;
4306
- let hostedBundle = null;
4307
3598
  let hostedSelectedPack = null;
4308
3599
  let hostedFallbackError = null;
4309
3600
  const packType = args.pack_type ?? "manifest";
@@ -4323,7 +3614,6 @@ async function handleTool(name, args) {
4323
3614
  manifestSource = "hosted_fallback";
4324
3615
  } else {
4325
3616
  const hosted = await loadHostedExecutionPackBundleFallback(args);
4326
- hostedBundle = hosted.bundle;
4327
3617
  hostedFallbackError = hosted.error;
4328
3618
  if (!hosted.bundle) {
4329
3619
  return {
@@ -4898,7 +4188,7 @@ function describeUpdate(operation, payload) {
4898
4188
  }
4899
4189
 
4900
4190
  // src/index.ts
4901
- var VERSION = "3.0.1";
4191
+ var VERSION = "3.4.0";
4902
4192
  var server = new Server({ name: "decantr", version: VERSION }, { capabilities: { tools: {} } });
4903
4193
  server.setRequestHandler(ListToolsRequestSchema, async () => {
4904
4194
  return { tools: TOOLS };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import "./chunk-PFLHZF35.js";
1
+ import "./chunk-BXY4AIGA.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decantr/mcp-server",
3
- "version": "3.0.2",
3
+ "version": "3.4.0",
4
4
  "mcpName": "io.github.decantr-ai/mcp-server",
5
5
  "description": "MCP server for Decantr — exposes Contract context, typed graph artifacts, and verification evidence to AI coding assistants",
6
6
  "keywords": [
@@ -51,10 +51,10 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@modelcontextprotocol/sdk": "^1.29.0",
54
- "@decantr/essence-spec": "3.0.2",
55
- "@decantr/verifier": "3.0.2",
56
- "@decantr/registry": "3.0.2",
57
- "@decantr/core": "3.0.2"
54
+ "@decantr/core": "3.4.0",
55
+ "@decantr/verifier": "3.4.0",
56
+ "@decantr/essence-spec": "3.4.0",
57
+ "@decantr/registry": "3.4.0"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsup",