@decantr/mcp-server 3.1.0 → 3.4.1

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-JGU5VKY7.js";
2
+ import "./chunk-BXY4AIGA.js";
@@ -1813,894 +1813,152 @@ async function getMcpWorkspaceHealth(args) {
1813
1813
  projects
1814
1814
  };
1815
1815
  }
1816
- var TOOLS = [
1817
- // 1. decantr_read_essence — local read
1818
- {
1819
- name: "decantr_read_essence",
1820
- title: "Read Essence",
1821
- description: "Read and return the current Essence v4 decantr.essence.json file from the working directory. Optionally filter by layer (dna, blueprint, or full).",
1822
- inputSchema: {
1823
- type: "object",
1824
- properties: {
1825
- path: {
1826
- type: "string",
1827
- description: "Optional path to essence file. Defaults to ./decantr.essence.json."
1828
- },
1829
- layer: {
1830
- type: "string",
1831
- enum: ["dna", "blueprint", "full"],
1832
- description: "For Essence v4 files: return only the specified layer. Defaults to full."
1833
- }
1834
- }
1835
- },
1836
- annotations: READ_ONLY
1816
+ var CONSOLIDATED_TOOL_ACTIONS = {
1817
+ decantr_project: {
1818
+ state: "decantr_get_project_state",
1819
+ workspace_health: "decantr_workspace_health"
1837
1820
  },
1838
- // 2. decantr_validate — local read
1839
- {
1840
- name: "decantr_validate",
1841
- title: "Validate Essence",
1842
- description: "Validate an Essence v4 decantr.essence.json file against the schema and guard rules, reporting DNA vs Blueprint violations separately.",
1843
- inputSchema: {
1844
- type: "object",
1845
- properties: {
1846
- path: {
1847
- type: "string",
1848
- description: "Path to essence file. Defaults to ./decantr.essence.json."
1849
- }
1850
- }
1851
- },
1852
- 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"
1853
1827
  },
1854
- // 3. decantr_search_registry — network
1855
- {
1856
- name: "decantr_search_registry",
1857
- title: "Search Vocabulary",
1858
- description: "Search Decantr official/community vocabulary for patterns, archetypes, themes, and shells.",
1859
- inputSchema: {
1860
- type: "object",
1861
- properties: {
1862
- query: { type: "string", description: 'Search query (e.g. "kanban", "neon", "dashboard")' },
1863
- type: { type: "string", description: "Filter by type: pattern, archetype, theme, shell" },
1864
- sort: { type: "string", description: "Optional sort: recommended, recent, or name." },
1865
- recommended: { type: "boolean", description: "When true, only return recommended items." },
1866
- source: {
1867
- type: "string",
1868
- description: "Optional intelligence source filter: authored, benchmark, or hybrid."
1869
- }
1870
- },
1871
- required: ["query"]
1872
- },
1873
- annotations: READ_ONLY_NETWORK
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"
1874
1834
  },
1875
- // 4. decantr_resolve_pattern — network
1876
- {
1877
- name: "decantr_resolve_pattern",
1878
- title: "Resolve Pattern",
1879
- description: "Get full pattern details including layout spec, components, presets, and code examples.",
1880
- inputSchema: {
1881
- type: "object",
1882
- properties: {
1883
- id: { type: "string", description: 'Pattern ID (e.g. "hero", "data-table", "kpi-grid")' },
1884
- preset: { type: "string", description: 'Optional preset name (e.g. "product", "content")' },
1885
- namespace: { type: "string", description: 'Namespace (default: "@official")' }
1886
- },
1887
- required: ["id"]
1888
- },
1889
- annotations: READ_ONLY_NETWORK
1890
- },
1891
- // 5. decantr_resolve_archetype — network
1892
- {
1893
- name: "decantr_resolve_archetype",
1894
- title: "Resolve Archetype",
1895
- description: "Get archetype details including default pages, layouts, features, and suggested theme.",
1896
- inputSchema: {
1897
- type: "object",
1898
- properties: {
1899
- id: { type: "string", description: 'Archetype ID (e.g. "saas-dashboard", "ecommerce")' },
1900
- namespace: { type: "string", description: 'Namespace (default: "@official")' }
1901
- },
1902
- required: ["id"]
1903
- },
1904
- annotations: READ_ONLY_NETWORK
1905
- },
1906
- // 6. decantr_resolve_blueprint — network
1907
- {
1908
- name: "decantr_resolve_blueprint",
1909
- title: "Resolve Blueprint",
1910
- description: "Get a blueprint (app composition) with its archetype list, suggested theme, personality traits, and full page structure.",
1911
- inputSchema: {
1912
- type: "object",
1913
- properties: {
1914
- id: {
1915
- type: "string",
1916
- description: 'Blueprint ID (e.g. "saas-dashboard", "ecommerce", "portfolio")'
1917
- },
1918
- namespace: { type: "string", description: 'Namespace (default: "@official")' }
1919
- },
1920
- required: ["id"]
1921
- },
1922
- annotations: READ_ONLY_NETWORK
1923
- },
1924
- // 8. decantr_suggest_patterns — network
1925
- {
1926
- name: "decantr_suggest_patterns",
1927
- title: "Suggest Patterns",
1928
- description: "Given a page description, suggest appropriate patterns from the registry. Returns ranked pattern matches with layout specs and component lists.",
1929
- inputSchema: {
1930
- type: "object",
1931
- properties: {
1932
- description: {
1933
- type: "string",
1934
- description: 'Description of the page or section (e.g. "dashboard with metrics and charts", "settings form with toggles")'
1935
- },
1936
- route: {
1937
- type: "string",
1938
- description: 'Optional route context, for example "/feed" or "/settings".'
1939
- },
1940
- source_code: {
1941
- type: "string",
1942
- description: "Optional local source excerpt to rank against actual code evidence."
1943
- }
1944
- },
1945
- required: ["description"]
1946
- },
1947
- annotations: READ_ONLY_NETWORK
1835
+ decantr_graph: {
1836
+ snapshot: "decantr_get_graph_snapshot",
1837
+ query: "decantr_query_graph",
1838
+ traverse: "decantr_traverse_graph"
1948
1839
  },
1949
- // 9. decantr_check_drift — local read
1950
- {
1951
- name: "decantr_check_drift",
1952
- title: "Check Drift",
1953
- 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.",
1954
- inputSchema: {
1955
- type: "object",
1956
- properties: {
1957
- path: {
1958
- type: "string",
1959
- description: "Path to essence file. Defaults to ./decantr.essence.json."
1960
- },
1961
- page_id: {
1962
- type: "string",
1963
- description: 'Page ID being modified (e.g. "overview", "settings")'
1964
- },
1965
- components_used: {
1966
- type: "array",
1967
- items: { type: "string" },
1968
- description: "List of component names used in the generated code. Checked against page layout patterns."
1969
- },
1970
- theme_used: { type: "string", description: "Theme id used in the generated code" }
1971
- }
1972
- },
1973
- annotations: READ_ONLY
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"
1974
1849
  },
1975
- // 10. decantr_create_essence — network (fetches archetype)
1976
- {
1977
- name: "decantr_create_essence",
1978
- title: "Create Essence",
1979
- 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.",
1980
- inputSchema: {
1981
- type: "object",
1982
- properties: {
1983
- description: {
1984
- type: "string",
1985
- description: 'Natural language project description (e.g. "SaaS dashboard with analytics, user management, and billing")'
1986
- },
1987
- framework: {
1988
- type: "string",
1989
- description: 'Target framework (e.g. "react", "vue", "svelte"). Defaults to "react".'
1990
- }
1991
- },
1992
- required: ["description"]
1993
- },
1994
- 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"
1995
1856
  },
1996
- // 11. decantr_accept_drift — WRITE tool (NEW)
1997
- {
1998
- name: "decantr_accept_drift",
1999
- title: "Accept Drift",
2000
- description: "Resolve guard violations by accepting, scoping, rejecting, or deferring drift. For DNA violations, requires explicit confirmation. Updates the essence file or drift log.",
2001
- inputSchema: {
2002
- type: "object",
2003
- properties: {
2004
- violations: {
2005
- type: "array",
2006
- items: {
2007
- type: "object",
2008
- properties: {
2009
- rule: { type: "string" },
2010
- page_id: { type: "string" },
2011
- details: { type: "string" }
2012
- },
2013
- required: ["rule"]
2014
- },
2015
- description: "The violations to resolve."
2016
- },
2017
- resolution: {
2018
- type: "string",
2019
- enum: ["accept", "accept_scoped", "reject", "defer"],
2020
- description: "How to resolve: accept updates the essence, accept_scoped limits to a page, reject is a no-op, defer logs for later."
2021
- },
2022
- scope: { type: "string", description: "For accept_scoped: the page or section scope." },
2023
- path: {
2024
- type: "string",
2025
- description: "Path to essence file. Defaults to ./decantr.essence.json."
2026
- },
2027
- confirm_dna: {
2028
- type: "boolean",
2029
- description: "Required to be true when accepting DNA-layer violations."
2030
- }
2031
- },
2032
- required: ["violations", "resolution"]
2033
- },
2034
- annotations: WRITE_TOOL
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"
2035
1862
  },
2036
- // 12. decantr_update_essence — WRITE tool (NEW)
2037
- {
2038
- name: "decantr_update_essence",
2039
- title: "Update Essence",
2040
- 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.",
2041
- inputSchema: {
2042
- type: "object",
2043
- properties: {
2044
- operation: {
2045
- type: "string",
2046
- enum: [
2047
- "add_page",
2048
- "remove_page",
2049
- "update_page_layout",
2050
- "update_dna",
2051
- "update_blueprint",
2052
- "add_feature",
2053
- "remove_feature"
2054
- ],
2055
- description: "The mutation operation to perform."
2056
- },
2057
- payload: {
2058
- type: "object",
2059
- description: "Operation-specific payload. See tool docs for each operation."
2060
- },
2061
- path: {
2062
- type: "string",
2063
- description: "Path to essence file. Defaults to ./decantr.essence.json."
2064
- }
2065
- },
2066
- required: ["operation", "payload"]
2067
- },
2068
- annotations: WRITE_TOOL
2069
- },
2070
- // 13. decantr_get_scaffold_context — local read
2071
- {
2072
- name: "decantr_get_scaffold_context",
2073
- title: "Get Scaffold Context",
2074
- 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.",
2075
- inputSchema: {
2076
- type: "object",
2077
- properties: {
2078
- path: {
2079
- type: "string",
2080
- description: "Optional path to an essence file when using hosted fallback compilation. Defaults to ./decantr.essence.json."
2081
- },
2082
- namespace: {
2083
- type: "string",
2084
- description: 'Optional preferred public namespace for hosted fallback compilation. Defaults to "@official".'
2085
- }
2086
- }
2087
- },
2088
- annotations: READ_ONLY
2089
- },
2090
- // 14. decantr_get_section_context — local read
2091
- {
2092
- name: "decantr_get_section_context",
2093
- title: "Get Section Context",
2094
- 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.",
2095
- inputSchema: {
2096
- type: "object",
2097
- properties: {
2098
- section_id: {
2099
- type: "string",
2100
- description: 'Section ID (archetype ID, e.g., "ai-chatbot", "auth-full", "settings-full")'
2101
- },
2102
- path: {
2103
- type: "string",
2104
- description: "Optional path to an essence file when using hosted fallback compilation. Defaults to ./decantr.essence.json."
2105
- },
2106
- namespace: {
2107
- type: "string",
2108
- description: 'Optional preferred public namespace for hosted fallback compilation. Defaults to "@official".'
2109
- }
2110
- },
2111
- required: ["section_id"]
2112
- },
2113
- annotations: READ_ONLY
2114
- },
2115
- // 15. decantr_get_page_context — local read
2116
- {
2117
- name: "decantr_get_page_context",
2118
- title: "Get Page Context",
2119
- 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.",
2120
- inputSchema: {
2121
- type: "object",
2122
- properties: {
2123
- page_id: {
2124
- type: "string",
2125
- description: 'Page ID (for example "overview", "settings", or "home").'
2126
- },
2127
- path: {
2128
- type: "string",
2129
- description: "Optional path to an essence file when using hosted fallback compilation. Defaults to ./decantr.essence.json."
2130
- },
2131
- namespace: {
2132
- type: "string",
2133
- description: 'Optional preferred public namespace for hosted fallback compilation. Defaults to "@official".'
2134
- }
2135
- },
2136
- required: ["page_id"]
2137
- },
2138
- annotations: READ_ONLY
2139
- },
2140
- // 16. decantr_get_project_state — local read
2141
- {
2142
- name: "decantr_get_project_state",
2143
- title: "Get Project State",
2144
- 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.",
2145
- inputSchema: {
2146
- type: "object",
2147
- properties: {
2148
- project_path: {
2149
- type: "string",
2150
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2151
- }
2152
- }
2153
- },
2154
- annotations: READ_ONLY
2155
- },
2156
- // 17. decantr_prepare_task_context — local read
2157
- {
2158
- name: "decantr_prepare_task_context",
2159
- title: "Prepare Task Context",
2160
- 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.",
2161
- inputSchema: {
2162
- type: "object",
2163
- properties: {
2164
- project_path: {
2165
- type: "string",
2166
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2167
- },
2168
- route: {
2169
- type: "string",
2170
- description: 'Route being edited, for example "/feed". Preferred when known.'
2171
- },
2172
- page_id: {
2173
- type: "string",
2174
- description: "Page ID when route is unknown."
2175
- },
2176
- task: {
2177
- type: "string",
2178
- description: "Short task description used to rank relevant patterns and context."
2179
- }
2180
- }
2181
- },
2182
- annotations: READ_ONLY
2183
- },
2184
- // 17. decantr_get_contract_capsule — local typed graph read
2185
- {
2186
- name: "decantr_get_contract_capsule",
2187
- title: "Get Contract Capsule",
2188
- 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.",
2189
- inputSchema: {
2190
- type: "object",
2191
- properties: {
2192
- project_path: {
2193
- type: "string",
2194
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2195
- }
2196
- }
2197
- },
2198
- annotations: READ_ONLY
2199
- },
2200
- // 18. decantr_get_graph_snapshot — local typed graph read
2201
- {
2202
- name: "decantr_get_graph_snapshot",
2203
- title: "Get Graph Snapshot",
2204
- 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.",
2205
- inputSchema: {
2206
- type: "object",
2207
- properties: {
2208
- project_path: {
2209
- type: "string",
2210
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2211
- },
2212
- route: {
2213
- type: "string",
2214
- description: 'Optional route path, for example "/settings", to return a scoped subgraph.'
2215
- },
2216
- node_id: {
2217
- type: "string",
2218
- description: 'Optional graph node ID, for example "cmp:button" or "tkn:surface", to return dependency impact context.'
2219
- },
2220
- file_path: {
2221
- type: "string",
2222
- description: 'Optional project-relative source file path, for example "src/app/page.tsx", to return dependency impact context for its SourceArtifact node.'
2223
- },
2224
- snapshot_id: {
2225
- type: "string",
2226
- description: 'Optional graph snapshot id to read from .decantr/graph/snapshots. Use "current" or omit for graph.snapshot.json.'
2227
- },
2228
- compare_to: {
2229
- type: "string",
2230
- description: 'Optional snapshot id to diff against the selected snapshot. Use "current" for graph.snapshot.json.'
2231
- },
2232
- include_diff_ops: {
2233
- type: "boolean",
2234
- description: "Include diff operation details when compare_to is provided. Defaults to false."
2235
- },
2236
- limit: {
2237
- type: "number",
2238
- description: "Maximum diff operations or impact nodes to return. Defaults to 200, maximum 500."
2239
- },
2240
- include_full: {
2241
- type: "boolean",
2242
- description: "Return the full graph snapshot instead of metadata. Defaults to false."
2243
- },
2244
- include_history: {
2245
- type: "boolean",
2246
- description: "Include a compact index of local snapshot history entries from .decantr/graph/snapshots. Defaults to false."
2247
- },
2248
- task: {
2249
- type: "string",
2250
- description: "Optional task description used to boost matching nodes in route-scoped or impact ranked context."
2251
- }
2252
- }
2253
- },
2254
- annotations: READ_ONLY
2255
- },
2256
- // 19. decantr_query_graph — local typed graph read
2257
- {
2258
- name: "decantr_query_graph",
2259
- title: "Query Graph",
2260
- 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.",
2261
- inputSchema: {
2262
- type: "object",
2263
- properties: {
2264
- project_path: {
2265
- type: "string",
2266
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2267
- },
2268
- snapshot_id: {
2269
- type: "string",
2270
- description: 'Optional snapshot id from local graph history, or "current". Defaults to current.'
2271
- },
2272
- node_ids: {
2273
- type: "array",
2274
- items: { type: "string" },
2275
- description: 'Optional exact graph node IDs to return, for example ["rt:/feed"].'
2276
- },
2277
- file_path: {
2278
- type: "string",
2279
- description: 'Optional project-relative source file path, for example "src/app/page.tsx", resolved to a SourceArtifact node selector.'
2280
- },
2281
- node_type: {
2282
- type: "string",
2283
- enum: [...GRAPH_NODE_TYPES],
2284
- description: 'Optional single node type selector, for example "Route" or "Component".'
2285
- },
2286
- node_types: {
2287
- type: "array",
2288
- items: { type: "string", enum: [...GRAPH_NODE_TYPES] },
2289
- description: "Optional node type selectors."
2290
- },
2291
- payload_key: {
2292
- type: "string",
2293
- description: 'Optional node payload key or dotted path filter, for example "code" for Finding nodes.'
2294
- },
2295
- payload_value: {
2296
- type: "string",
2297
- description: 'Optional exact stringified payload value used with payload_key, for example "COMP010".'
2298
- },
2299
- payload_contains: {
2300
- type: "string",
2301
- description: "Optional case-insensitive substring filter over the node payload JSON."
2302
- },
2303
- edge_src: {
2304
- type: "string",
2305
- description: "Optional edge source node ID selector."
2306
- },
2307
- edge_dst: {
2308
- type: "string",
2309
- description: "Optional edge destination node ID selector."
2310
- },
2311
- relation: {
2312
- type: "string",
2313
- enum: [...GRAPH_RELATIONS],
2314
- description: 'Optional single edge relation selector, for example "PAGE_COMPOSES_PATTERN".'
2315
- },
2316
- relations: {
2317
- type: "array",
2318
- items: { type: "string", enum: [...GRAPH_RELATIONS] },
2319
- description: "Optional edge relation selectors."
2320
- },
2321
- include_edges: {
2322
- type: "boolean",
2323
- description: "When querying nodes, include incident edges and their opposite endpoint nodes. Defaults to false unless edge selectors are present."
2324
- },
2325
- include_impact: {
2326
- type: "boolean",
2327
- description: "When querying nodes, also return the dependency impact context for the matched node IDs."
2328
- },
2329
- task: {
2330
- type: "string",
2331
- description: "Optional task description used to boost matching nodes in the impact ranking when include_impact is true."
2332
- },
2333
- limit: {
2334
- type: "number",
2335
- description: "Maximum nodes and edges to return. Defaults to 200, maximum 500."
2336
- }
2337
- }
2338
- },
2339
- annotations: READ_ONLY
2340
- },
2341
- // 20. decantr_traverse_graph — local typed graph read
2342
- {
2343
- name: "decantr_traverse_graph",
2344
- title: "Traverse Graph",
2345
- 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.",
2346
- inputSchema: {
2347
- type: "object",
2348
- properties: {
2349
- project_path: {
2350
- type: "string",
2351
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2352
- },
2353
- snapshot_id: {
2354
- type: "string",
2355
- description: 'Optional snapshot id from local graph history, or "current". Defaults to current.'
2356
- },
2357
- from: {
2358
- type: "string",
2359
- description: 'Start node ID, for example "rt:/feed" or "tkn:color.primary".'
2360
- },
2361
- from_ids: {
2362
- type: "array",
2363
- items: { type: "string" },
2364
- description: "Optional start node IDs. Used when traversing from multiple anchors."
2365
- },
2366
- file_path: {
2367
- type: "string",
2368
- description: 'Optional project-relative source file path, for example "src/app/page.tsx", resolved to a SourceArtifact start node.'
2369
- },
2370
- relations: {
2371
- type: "array",
2372
- items: { type: "string", enum: [...GRAPH_RELATIONS] },
2373
- description: "Optional relation allow-list. When omitted, all relations are traversed."
2374
- },
2375
- direction: {
2376
- type: "string",
2377
- enum: ["out", "in", "both"],
2378
- description: "Traversal direction. Defaults to out."
2379
- },
2380
- depth: {
2381
- type: "number",
2382
- description: "Traversal depth. Defaults to 1, maximum 4."
2383
- },
2384
- limit: {
2385
- type: "number",
2386
- description: "Maximum nodes and edges to return. Defaults to 200, maximum 500."
2387
- }
2388
- }
2389
- },
2390
- annotations: READ_ONLY
2391
- },
2392
- // 21. decantr_get_execution_pack — local read
2393
- {
2394
- name: "decantr_get_execution_pack",
2395
- title: "Get Execution Pack",
2396
- 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.",
2397
- inputSchema: {
2398
- type: "object",
2399
- properties: {
2400
- pack_type: {
2401
- type: "string",
2402
- enum: ["manifest", "scaffold", "review", "mutation", "section", "page"],
2403
- description: "Pack type to fetch. Defaults to manifest."
2404
- },
2405
- id: {
2406
- type: "string",
2407
- description: 'Required for section/page/mutation packs (for example "dashboard", "overview", or "modify").'
2408
- },
2409
- format: {
2410
- type: "string",
2411
- enum: ["json", "markdown", "both"],
2412
- description: "Return format for a specific pack. Defaults to both."
2413
- },
2414
- path: {
2415
- type: "string",
2416
- description: "Optional path to an essence file when using hosted fallback compilation. Defaults to ./decantr.essence.json."
2417
- },
2418
- namespace: {
2419
- type: "string",
2420
- description: 'Optional preferred public namespace for hosted fallback compilation. Defaults to "@official".'
2421
- }
2422
- }
2423
- },
2424
- annotations: READ_ONLY
2425
- },
2426
- // 17. decantr_get_showcase_benchmarks — network read
2427
- {
2428
- name: "decantr_get_showcase_benchmarks",
2429
- title: "Get Showcase Benchmarks",
2430
- description: "Read the audited Decantr showcase corpus metadata. Returns the active manifest, shortlisted benchmark set, or the schema-backed shortlist verification report.",
2431
- inputSchema: {
2432
- type: "object",
2433
- properties: {
2434
- view: {
2435
- type: "string",
2436
- enum: ["manifest", "shortlist", "verification"],
2437
- description: "Which showcase benchmark view to return. Defaults to shortlist."
2438
- }
2439
- }
2440
- },
2441
- annotations: READ_ONLY_NETWORK
2442
- },
2443
- // 18. decantr_get_registry_intelligence_summary — network read
2444
- {
2445
- name: "decantr_get_registry_intelligence_summary",
2446
- title: "Get Registry Intelligence Summary",
2447
- description: "Read the hosted schema-backed registry intelligence summary. Useful for checking overall intelligence/recommendation coverage without crawling every item.",
2448
- inputSchema: {
2449
- type: "object",
2450
- properties: {
2451
- namespace: {
2452
- type: "string",
2453
- description: 'Optional namespace to scope the summary to, for example "@official".'
2454
- }
2455
- }
2456
- },
2457
- annotations: READ_ONLY_NETWORK
2458
- },
2459
- // 19. decantr_compile_execution_packs — network read
2460
- {
2461
- name: "decantr_compile_execution_packs",
2462
- title: "Compile Execution Packs",
2463
- 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.",
2464
- inputSchema: {
2465
- type: "object",
2466
- properties: {
2467
- path: {
2468
- type: "string",
2469
- description: "Optional path to an essence file. Defaults to ./decantr.essence.json when essence is not provided."
2470
- },
2471
- essence: {
2472
- type: "object",
2473
- description: "Optional inline essence document to compile instead of reading from disk."
2474
- },
2475
- namespace: {
2476
- type: "string",
2477
- description: 'Optional preferred public namespace for content resolution. Defaults to "@official".'
2478
- }
2479
- }
2480
- },
2481
- annotations: READ_ONLY_NETWORK
2482
- },
2483
- // 20. decantr_audit_project — local read with hosted fallback
2484
- {
2485
- name: "decantr_audit_project",
2486
- title: "Audit Project",
2487
- 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.",
2488
- inputSchema: {
2489
- type: "object",
2490
- properties: {
2491
- path: {
2492
- type: "string",
2493
- description: "Optional path to the essence file for hosted fallback. Defaults to ./decantr.essence.json."
2494
- },
2495
- namespace: {
2496
- type: "string",
2497
- description: 'Optional preferred public namespace for hosted fallback. Defaults to "@official".'
2498
- },
2499
- dist_path: {
2500
- type: "string",
2501
- description: "Optional path to a local dist directory to snapshot for hosted runtime verification. Defaults to ./dist."
2502
- },
2503
- sources_path: {
2504
- type: "string",
2505
- description: "Optional path to a local source directory to snapshot for hosted source-level verification. For example `src` or `app`."
2506
- },
2507
- allow_hosted_upload: {
2508
- type: "boolean",
2509
- description: "Explicitly opt in to uploading local dist/source snapshots to the hosted verifier when local packs are missing. Defaults to false."
2510
- }
2511
- }
2512
- },
2513
- annotations: READ_ONLY_NETWORK
2514
- },
2515
- // 21. decantr_critique — local read with hosted fallback
2516
- {
2517
- name: "decantr_critique",
2518
- title: "Design Critique",
2519
- 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,
2520
1876
  inputSchema: {
2521
1877
  type: "object",
2522
1878
  properties: {
2523
- file_path: {
2524
- type: "string",
2525
- description: "Path to the component file to critique"
2526
- },
2527
- path: {
1879
+ action: {
2528
1880
  type: "string",
2529
- description: "Optional path to the essence file when using hosted fallback. Defaults to ./decantr.essence.json."
2530
- },
2531
- namespace: {
2532
- type: "string",
2533
- description: 'Optional preferred public namespace for hosted fallback. Defaults to "@official".'
2534
- },
2535
- treatments_path: {
2536
- type: "string",
2537
- description: "Optional path to treatments.css when using hosted fallback. Defaults to ./src/styles/treatments.css."
2538
- },
2539
- allow_hosted_upload: {
2540
- type: "boolean",
2541
- 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."
2542
1883
  }
2543
1884
  },
2544
- required: ["file_path"]
1885
+ required: ["action"],
1886
+ additionalProperties: true
2545
1887
  },
2546
- annotations: READ_ONLY_NETWORK
2547
- },
2548
- // 24. decantr_get_findings — local typed findings read
2549
- {
2550
- name: "decantr_get_findings",
2551
- title: "Get Findings",
2552
- description: "Return typed Project Health findings for the current Decantr project, with stable codes, repair IDs, graph anchors when available, and optional repair prompts.",
2553
- inputSchema: {
2554
- type: "object",
2555
- properties: {
2556
- project_path: {
2557
- type: "string",
2558
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2559
- },
2560
- severity: {
2561
- type: "string",
2562
- enum: ["error", "warn", "info"],
2563
- description: "Optional severity filter."
2564
- },
2565
- source: {
2566
- type: "string",
2567
- enum: [
2568
- "audit",
2569
- "assertion",
2570
- "browser",
2571
- "check",
2572
- "brownfield",
2573
- "design-token",
2574
- "style-bridge",
2575
- "graph",
2576
- "runtime",
2577
- "pack",
2578
- "interaction"
2579
- ],
2580
- description: "Optional finding source filter."
2581
- },
2582
- code: {
2583
- type: "string",
2584
- description: 'Optional stable diagnostic code filter, for example "TOKEN010".'
2585
- },
2586
- include_prompts: {
2587
- type: "boolean",
2588
- description: "Include full repair prompts on each finding. Defaults to false to keep context compact."
2589
- },
2590
- limit: {
2591
- type: "number",
2592
- description: "Maximum findings to return. Defaults to 50, maximum 200."
2593
- }
2594
- }
2595
- },
2596
- annotations: READ_ONLY
2597
- },
2598
- // 25. decantr_get_repair_plan — local structured repair loop
2599
- {
2600
- name: "decantr_get_repair_plan",
2601
- title: "Get Repair Plan",
2602
- 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.",
2603
- inputSchema: {
2604
- type: "object",
2605
- properties: {
2606
- project_path: {
2607
- type: "string",
2608
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2609
- },
2610
- finding_id: {
2611
- type: "string",
2612
- description: "Optional finding id. Defaults to the first error or warning, then the first finding."
2613
- },
2614
- code: {
2615
- type: "string",
2616
- description: 'Optional stable diagnostic code selector, for example "GRAPH001".'
2617
- },
2618
- include_prompt: {
2619
- type: "boolean",
2620
- description: "Include the human-readable repair prompt alongside the typed plan."
2621
- }
2622
- }
2623
- },
2624
- annotations: READ_ONLY
2625
- },
2626
- // 26. decantr_get_evidence_bundle — local reliability artifact
2627
- {
2628
- name: "decantr_get_evidence_bundle",
2629
- title: "Get Evidence Bundle",
2630
- 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.",
2631
- inputSchema: {
2632
- type: "object",
2633
- properties: {
2634
- project_path: {
2635
- type: "string",
2636
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2637
- }
2638
- }
2639
- },
2640
- annotations: READ_ONLY
2641
- },
2642
- // 23. decantr_workspace_health — local workspace reliability scan
2643
- {
2644
- name: "decantr_workspace_health",
2645
- title: "Workspace Health",
2646
- description: "Discover Decantr projects in the active workspace and return deterministic aggregate health for monorepos with many Decantr apps.",
2647
- inputSchema: {
2648
- type: "object",
2649
- properties: {
2650
- workspace_root: {
2651
- type: "string",
2652
- description: "Optional relative workspace root inside the active workspace. Defaults to the current working directory."
2653
- },
2654
- max_projects: {
2655
- type: "number",
2656
- description: "Optional cap on discovered projects. Defaults to 500."
2657
- }
2658
- }
2659
- },
2660
- annotations: READ_ONLY
2661
- },
2662
- // 24. decantr_get_repair_prompt — local AI repair loop
2663
- {
2664
- name: "decantr_get_repair_prompt",
2665
- title: "Get Repair Prompt",
2666
- 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.",
2667
- inputSchema: {
2668
- type: "object",
2669
- properties: {
2670
- project_path: {
2671
- type: "string",
2672
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2673
- },
2674
- finding_id: {
2675
- type: "string",
2676
- description: "Optional finding id. Defaults to the first error or warning, then the first finding."
2677
- }
2678
- }
2679
- },
2680
- annotations: READ_ONLY
2681
- },
2682
- // 25. decantr_run_health_loop — local evidence + repair loop
2683
- {
2684
- name: "decantr_run_health_loop",
2685
- title: "Run Health Loop",
2686
- description: "Run Project Health, produce evidence, and return the next repair prompt for AI agents without uploading project source.",
2687
- inputSchema: {
2688
- type: "object",
2689
- properties: {
2690
- project_path: {
2691
- type: "string",
2692
- description: "Optional relative project path inside the active workspace. Defaults to the current working directory."
2693
- },
2694
- finding_id: {
2695
- type: "string",
2696
- description: "Optional finding id to target. Defaults to the first error or warning, then the first finding."
2697
- }
2698
- }
2699
- },
2700
- annotations: READ_ONLY
2701
- }
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
+ )
2702
1940
  ];
2703
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) {
2704
1962
  const apiClient = getAPIClient();
2705
1963
  switch (name) {
2706
1964
  case "decantr_read_essence": {
@@ -3224,7 +2482,7 @@ async function handleTool(name, args) {
3224
2482
  };
3225
2483
  }
3226
2484
  try {
3227
- const { essence, path } = await mutateEssenceFile(args.path, (v4) => {
2485
+ const { path } = await mutateEssenceFile(args.path, (v4) => {
3228
2486
  for (const v of violations) {
3229
2487
  applyDriftAcceptance(v4, v, resolution, args.scope);
3230
2488
  }
@@ -3264,7 +2522,7 @@ async function handleTool(name, args) {
3264
2522
  };
3265
2523
  }
3266
2524
  try {
3267
- const { essence, path } = await mutateEssenceFile(args.path, (v4) => {
2525
+ const { path } = await mutateEssenceFile(args.path, (v4) => {
3268
2526
  return applyEssenceUpdate(v4, operation, payload);
3269
2527
  });
3270
2528
  return {
@@ -3386,13 +2644,21 @@ async function handleTool(name, args) {
3386
2644
  })).sort((a, b) => a.code.localeCompare(b.code) || a.rule.localeCompare(b.rule))
3387
2645
  },
3388
2646
  recommended_next_tools: [
3389
- graphReady ? "decantr_get_contract_capsule" : "decantr_get_findings",
3390
- graphReady ? null : "decantr_get_repair_plan",
3391
- snapshot ? "decantr_get_graph_snapshot" : null,
3392
- "decantr_prepare_task_context",
3393
- "decantr_get_findings",
3394
- "decantr_get_evidence_bundle"
3395
- ].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))
3396
2662
  };
3397
2663
  } catch (e) {
3398
2664
  return { error: `Could not read project state: ${e.message}` };
@@ -4329,7 +3595,6 @@ async function handleTool(name, args) {
4329
3595
  const manifestPath = join2(contextDir, "pack-manifest.json");
4330
3596
  let manifest = null;
4331
3597
  let manifestSource = null;
4332
- let hostedBundle = null;
4333
3598
  let hostedSelectedPack = null;
4334
3599
  let hostedFallbackError = null;
4335
3600
  const packType = args.pack_type ?? "manifest";
@@ -4349,7 +3614,6 @@ async function handleTool(name, args) {
4349
3614
  manifestSource = "hosted_fallback";
4350
3615
  } else {
4351
3616
  const hosted = await loadHostedExecutionPackBundleFallback(args);
4352
- hostedBundle = hosted.bundle;
4353
3617
  hostedFallbackError = hosted.error;
4354
3618
  if (!hosted.bundle) {
4355
3619
  return {
@@ -4924,7 +4188,7 @@ function describeUpdate(operation, payload) {
4924
4188
  }
4925
4189
 
4926
4190
  // src/index.ts
4927
- var VERSION = "3.1.0";
4191
+ var VERSION = "3.4.0";
4928
4192
  var server = new Server({ name: "decantr", version: VERSION }, { capabilities: { tools: {} } });
4929
4193
  server.setRequestHandler(ListToolsRequestSchema, async () => {
4930
4194
  return { tools: TOOLS };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import "./chunk-JGU5VKY7.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.1.0",
3
+ "version": "3.4.1",
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/registry": "3.1.0",
55
- "@decantr/core": "3.1.0",
56
- "@decantr/essence-spec": "3.1.0",
57
- "@decantr/verifier": "3.1.0"
54
+ "@decantr/core": "3.4.0",
55
+ "@decantr/essence-spec": "3.4.0",
56
+ "@decantr/verifier": "3.4.1",
57
+ "@decantr/registry": "3.4.0"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsup",