@decantr/mcp-server 2.3.0 → 2.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
@@ -12,7 +12,7 @@ Design intelligence for AI-generated UI. Make Claude, Cursor, and Windsurf gener
12
12
 
13
13
  ![Decantr MCP demo](https://raw.githubusercontent.com/decantr-ai/decantr/main/packages/mcp-server/assets/decantr-demo.gif)
14
14
 
15
- - **Structured design context** -- gives your AI assistant patterns, layouts, component specs, Brownfield local law, and task-time context instead of letting it guess
15
+ - **Structured design context** -- gives your AI assistant patterns, layouts, component specs, Brownfield/Hybrid authority, local law, and task-time context instead of letting it guess
16
16
  - **Evidence-backed repair loops** -- gives AI agents Project Health, Evidence Bundles, workspace health, and scoped repair prompts without uploading source
17
17
  - **Drift detection** -- catches when generated code deviates from your design intent
18
18
  - **Zero config** -- run with `npx`, no API keys or accounts required
@@ -136,7 +136,7 @@ The server exposes Decantr registry, context, benchmark, and verification tools.
136
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
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
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_prepare_task_context` | Resolve compact route/task context, local law, evidence, and changed-file impact before editing a Brownfield or Essence route | `{ "route": "/feed", "task": "improve recipe card loading" }` |
139
+ | `decantr_prepare_task_context` | Resolve compact route/task context, authority lane, local law, evidence, and changed-file impact before editing a Brownfield, Hybrid, or Essence route | `{ "route": "/feed", "task": "improve recipe card loading" }` |
140
140
  | `decantr_compile_execution_packs` | Compile a hosted execution-pack bundle from a local or inline essence document | `{ "path": "./decantr.essence.json", "namespace": "@official" }` |
141
141
  | `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" }` |
142
142
  | `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,6 +148,12 @@ The server exposes Decantr registry, context, benchmark, and verification tools.
148
148
 
149
149
  For the broader product surface and support policy, see the root Decantr docs and package support matrix.
150
150
 
151
+ ## Security And Permissions
152
+
153
+ The MCP server reads Decantr files 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.
154
+
155
+ 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).
156
+
151
157
  ## Compatibility
152
158
 
153
159
  `@decantr/mcp-server` is stable in the `2.x` line for the documented MCP tool surface.
@@ -171,7 +177,7 @@ The AI assistant calls these tools behind the scenes:
171
177
  3. `decantr_suggest_patterns` -- recommends `kpi-grid`, `chart-grid`, `data-table`, and `form-sections` for the described pages
172
178
  4. `decantr_resolve_pattern` -- fetches layout specs and component lists for each pattern
173
179
  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
174
- 6. `decantr_prepare_task_context` -- resolves route-local Brownfield context, accepted local law, changed-file impact, visual evidence, and theme inventory before editing an existing app
180
+ 6. `decantr_prepare_task_context` -- resolves route-local Brownfield/Hybrid context, active authority, accepted local law, changed-file impact, visual evidence, and theme inventory before editing an existing app
175
181
  7. `decantr_compile_execution_packs` -- compiles the hosted pack bundle when the task needs a fresh remote contract from the essence document
176
182
  8. `decantr_check_drift` -- validates the generated code against the Essence spec before presenting it
177
183
  9. `decantr_critique` -- critiques a specific file, falling back to the hosted verifier when the local review pack is missing
package/dist/bin.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-GIVGJE76.js";
2
+ import "./chunk-P2K3R43N.js";
@@ -160,9 +160,7 @@ function changedFilesForTask(projectRoot) {
160
160
  return [...changed].sort();
161
161
  }
162
162
  function impactedRoutesForFiles(projectRoot, files) {
163
- const analysis = readJsonIfExists(
164
- join2(projectRoot, ".decantr", "analysis.json")
165
- );
163
+ const analysis = readJsonIfExists(join2(projectRoot, ".decantr", "analysis.json"));
166
164
  const routeEntries = analysis?.routes?.routes ?? [];
167
165
  const impacted = /* @__PURE__ */ new Set();
168
166
  for (const file of files) {
@@ -193,6 +191,63 @@ function localLawSummary(projectRoot) {
193
191
  })) ?? []
194
192
  };
195
193
  }
194
+ function mentionsWord(text, term) {
195
+ const escaped = term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
196
+ return new RegExp(`\\b${escaped}\\b`, "i").test(text);
197
+ }
198
+ function taskAuthoritySummary(input) {
199
+ const hasLocalLaw = input.localLaw.patterns.length > 0 || input.localLaw.rules.length > 0;
200
+ let lane = "Brownfield contract-only";
201
+ let sourceAuthority = "Existing app is authoritative; Decantr supplies contract context.";
202
+ let styleAuthority = "Use the existing styling system.";
203
+ const activeAuthorities = ["existing source", "Essence V4 contract"];
204
+ if (input.workflowMode === "hybrid-compose") {
205
+ lane = "Hybrid composition";
206
+ sourceAuthority = "Existing app plus selected Decantr/local law are authoritative.";
207
+ } else if (input.workflowMode === "brownfield-attach" && input.adoptionMode === "decantr-css") {
208
+ lane = "Hybrid with Decantr CSS";
209
+ sourceAuthority = "Existing app remains authoritative except where Decantr CSS is explicitly adopted.";
210
+ styleAuthority = "Decantr CSS runtime is active where adopted.";
211
+ activeAuthorities.push("Decantr CSS runtime");
212
+ } else if (input.workflowMode === "brownfield-attach" && input.adoptionMode === "style-bridge") {
213
+ lane = "Hybrid style bridge";
214
+ sourceAuthority = "Existing app remains authoritative; Decantr intent maps through the style bridge.";
215
+ styleAuthority = "Use bridge tokens/classes as a mapping layer onto the app styling system.";
216
+ activeAuthorities.push("style bridge");
217
+ } else if (input.workflowMode === "brownfield-attach" && hasLocalLaw) {
218
+ lane = "Hybrid local law";
219
+ sourceAuthority = "Existing app plus accepted project-owned UI law are authoritative.";
220
+ styleAuthority = "Use project-owned components, tokens, classes, and accepted local rules.";
221
+ } else if (input.workflowMode?.startsWith("greenfield")) {
222
+ lane = input.workflowMode === "greenfield-contract-only" ? "Greenfield contract-only" : "Greenfield scaffold";
223
+ sourceAuthority = "Essence V4 and generated context are authoritative.";
224
+ styleAuthority = input.adoptionMode === "contract-only" ? "Use the project-chosen styling system." : "Use Decantr CSS where generated by the adapter.";
225
+ }
226
+ if (hasLocalLaw) activeAuthorities.push("accepted local patterns/rules");
227
+ if (input.hasPackManifest) activeAuthorities.push("hosted execution packs as guidance");
228
+ const warnings = [];
229
+ const task = input.task;
230
+ for (const term of ["angular", "vue", "svelte", "solid", "bootstrap", "shadcn"]) {
231
+ if (mentionsWord(task, term)) {
232
+ warnings.push(
233
+ `Task mentions ${term}; treat it as optional Hybrid guidance unless this workspace already owns that runtime/library or the user explicitly asks for a reviewed adoption plan.`
234
+ );
235
+ }
236
+ }
237
+ if (input.adoptionMode !== "decantr-css" && (/@decantr\/css/i.test(task) || /\bdecantr css\b/i.test(task) || /\bd-[a-z0-9-]+/i.test(task))) {
238
+ warnings.push(
239
+ "This project is not in decantr-css adoption mode. Do not add @decantr/css or d-* classes unless the user explicitly changes adoption mode."
240
+ );
241
+ }
242
+ return {
243
+ lane,
244
+ source_authority: sourceAuthority,
245
+ style_authority: styleAuthority,
246
+ active_authorities: activeAuthorities,
247
+ runtime_boundary: "Preserve the current workspace runtime unless the task is explicitly a reviewed migration or isolated integration plan.",
248
+ warnings
249
+ };
250
+ }
196
251
  function extractPatternIdsFromLayoutItem(item, ids) {
197
252
  if (typeof item === "string") {
198
253
  ids.add(item);
@@ -2428,6 +2483,7 @@ async function handleTool(name, args) {
2428
2483
  join2(process.cwd(), ".decantr", "theme-inventory.json")
2429
2484
  );
2430
2485
  const localLaw = localLawSummary(process.cwd());
2486
+ const projectJson = readJsonIfExists(join2(process.cwd(), ".decantr", "project.json"));
2431
2487
  const changedFiles = changedFilesForTask(process.cwd());
2432
2488
  const changedRoutes = impactedRoutesForFiles(process.cwd(), changedFiles);
2433
2489
  const patternIds = extractPagePatternIds(page);
@@ -2479,6 +2535,13 @@ async function handleTool(name, args) {
2479
2535
  path: ".decantr/theme-inventory.json"
2480
2536
  } : null,
2481
2537
  local_law: localLaw,
2538
+ authority: taskAuthoritySummary({
2539
+ workflowMode: projectJson?.initialized?.workflowMode ?? null,
2540
+ adoptionMode: projectJson?.initialized?.adoptionMode ?? null,
2541
+ localLaw,
2542
+ hasPackManifest: Boolean(manifest),
2543
+ task
2544
+ }),
2482
2545
  change_impact: {
2483
2546
  changed_files: changedFiles.slice(0, 40),
2484
2547
  changed_file_count: changedFiles.length,
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import "./chunk-GIVGJE76.js";
1
+ import "./chunk-P2K3R43N.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decantr/mcp-server",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "mcpName": "io.github.decantr-ai/mcp-server",
5
5
  "description": "MCP server for Decantr — exposes design intelligence, packs, and verification to AI coding assistants",
6
6
  "keywords": [
@@ -50,8 +50,8 @@
50
50
  "dependencies": {
51
51
  "@modelcontextprotocol/sdk": "^1.29.0",
52
52
  "@decantr/essence-spec": "2.0.1",
53
- "@decantr/registry": "2.2.0",
54
- "@decantr/verifier": "2.2.0"
53
+ "@decantr/verifier": "2.3.3",
54
+ "@decantr/registry": "2.2.0"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "tsup",