@decantr/mcp-server 1.0.0-beta.7 → 1.0.0-beta.8

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/dist/bin.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-IWYOFW2H.js";
2
+ import "./chunk-NZBC33FN.js";
@@ -7,6 +7,7 @@ import {
7
7
  } from "@modelcontextprotocol/sdk/types.js";
8
8
 
9
9
  // src/tools.ts
10
+ import { existsSync, readFileSync } from "fs";
10
11
  import { readFile as readFile2 } from "fs/promises";
11
12
  import { join as join2, dirname as dirname2 } from "path";
12
13
  import { validateEssence, evaluateGuard, isV3 as isV32 } from "@decantr/essence-spec";
@@ -381,6 +382,20 @@ var TOOLS = [
381
382
  required: ["operation", "payload"]
382
383
  },
383
384
  annotations: WRITE_TOOL
385
+ },
386
+ // 13. decantr_get_section_context — local read
387
+ {
388
+ name: "decantr_get_section_context",
389
+ title: "Get Section Context",
390
+ description: "Get the self-contained context for a specific section of the project. Returns guard rules, theme tokens, decorators, pattern specs, zone context, and pages \u2014 everything an AI needs to work on that section.",
391
+ inputSchema: {
392
+ type: "object",
393
+ properties: {
394
+ section_id: { type: "string", description: 'Section ID (archetype ID, e.g., "ai-chatbot", "auth-full", "settings-full")' }
395
+ },
396
+ required: ["section_id"]
397
+ },
398
+ annotations: READ_ONLY
384
399
  }
385
400
  ];
386
401
  async function handleTool(name, args) {
@@ -942,6 +957,49 @@ async function handleTool(name, args) {
942
957
  return { error: `Failed to update essence: ${e.message}` };
943
958
  }
944
959
  }
960
+ case "decantr_get_section_context": {
961
+ const err = validateStringArg(args, "section_id");
962
+ if (err) return { error: err };
963
+ const sectionId = args.section_id;
964
+ let essence;
965
+ try {
966
+ const result = await readEssenceFile();
967
+ essence = result.essence;
968
+ } catch {
969
+ return { error: "No valid essence file found. Run decantr init first." };
970
+ }
971
+ if (!isV32(essence)) {
972
+ return { error: "Section context requires a v3 essence file. Run decantr migrate first." };
973
+ }
974
+ const sections = essence.blueprint.sections || [];
975
+ const section = sections.find((s) => s.id === sectionId);
976
+ if (!section) {
977
+ return {
978
+ error: `Section "${sectionId}" not found.`,
979
+ available_sections: sections.map((s) => ({ id: s.id, role: s.role, pages: s.pages.length }))
980
+ };
981
+ }
982
+ const contextPath = join2(process.cwd(), ".decantr", "context", `section-${sectionId}.md`);
983
+ if (existsSync(contextPath)) {
984
+ return {
985
+ section_id: sectionId,
986
+ role: section.role,
987
+ shell: section.shell,
988
+ features: section.features,
989
+ pages: section.pages.map((p) => ({ id: p.id, route: p.route, layout: p.layout })),
990
+ context: readFileSync(contextPath, "utf-8")
991
+ };
992
+ }
993
+ return {
994
+ section_id: sectionId,
995
+ role: section.role,
996
+ shell: section.shell,
997
+ features: section.features,
998
+ description: section.description,
999
+ pages: section.pages.map((p) => ({ id: p.id, route: p.route, layout: p.layout })),
1000
+ note: "Section context file not found. Run decantr refresh to generate it."
1001
+ };
1002
+ }
945
1003
  default:
946
1004
  return { error: `Unknown tool: ${name}` };
947
1005
  }
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import "./chunk-IWYOFW2H.js";
1
+ import "./chunk-NZBC33FN.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decantr/mcp-server",
3
- "version": "1.0.0-beta.7",
3
+ "version": "1.0.0-beta.8",
4
4
  "description": "MCP server for Decantr — exposes design intelligence tools to AI coding assistants",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@modelcontextprotocol/sdk": "^1.0.0",
26
- "@decantr/essence-spec": "1.0.0-beta.6",
27
- "@decantr/registry": "1.0.0-beta.6"
26
+ "@decantr/essence-spec": "1.0.0-beta.7",
27
+ "@decantr/registry": "1.0.0-beta.7"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "tsup",