@nebutra/mcp 4.0.0 → 4.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @nebutra/mcp
2
2
 
3
+ ## 4.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @nebutra/ui@4.0.1
9
+ - @nebutra/capability-kit@4.0.1
10
+ - @nebutra/errors@4.0.1
11
+ - @nebutra/event-log@4.0.1
12
+ - @nebutra/trace-store@4.0.1
13
+
3
14
  ## 4.0.0
4
15
 
5
16
  ### Patch Changes
@@ -9,6 +9,13 @@ import {
9
9
  ListToolsRequestSchema,
10
10
  ReadResourceRequestSchema
11
11
  } from "@modelcontextprotocol/sdk/types.js";
12
+ import {
13
+ encodePreset,
14
+ presetArgument,
15
+ presetJsonSchema,
16
+ readPresetInput,
17
+ studioReviewUrl
18
+ } from "@nebutra/tokens/preset";
12
19
  var NebutraContextServer = class {
13
20
  server;
14
21
  projectRoot;
@@ -108,11 +115,16 @@ function createContextServerHandlers(projectRoot) {
108
115
  properties: {},
109
116
  required: []
110
117
  }
111
- }
118
+ },
119
+ ...STUDIO_TOOLS
112
120
  ]
113
121
  };
114
122
  },
115
- async callTool({ name }) {
123
+ async callTool({
124
+ name,
125
+ arguments: args
126
+ }) {
127
+ if (name.startsWith("studio_")) return callStudioTool(projectRoot, name, args ?? {});
116
128
  if (name !== "get_project_structure") {
117
129
  throw new Error(`Unknown tool: ${name}`);
118
130
  }
@@ -139,6 +151,78 @@ function createContextServerHandlers(projectRoot) {
139
151
  }
140
152
  };
141
153
  }
154
+ var PRESET_ARG = {
155
+ preset: {
156
+ description: "A preset object (see studio_preset_schema), its JSON text, a preset code, a base id, or a Studio link."
157
+ }
158
+ };
159
+ var STUDIO_TOOLS = [
160
+ {
161
+ name: "studio_preset_schema",
162
+ description: "JSON Schema for a Sailor Studio preset: the base design language and every knob with its allowed values.",
163
+ inputSchema: { type: "object", properties: {}, required: [] }
164
+ },
165
+ {
166
+ name: "studio_preview",
167
+ description: "Validate a preset and return the Sailor Studio link to show the person, plus the commands that apply it. Ask them to review the link before pulling.",
168
+ inputSchema: {
169
+ type: "object",
170
+ properties: {
171
+ ...PRESET_ARG,
172
+ from: { type: "string", description: "Who proposed it, shown on the Studio banner" }
173
+ },
174
+ required: ["preset"]
175
+ }
176
+ },
177
+ {
178
+ name: "studio_pull",
179
+ description: "Write an approved preset onto this Sailor project (packages/design/tokens/project/preset). Run `pnpm --filter @nebutra/tokens build` afterwards, or use `nebutra studio pull`, which does both.",
180
+ inputSchema: { type: "object", properties: PRESET_ARG, required: ["preset"] }
181
+ }
182
+ ];
183
+ var text = (value) => ({
184
+ content: [
185
+ { type: "text", text: typeof value === "string" ? value : JSON.stringify(value, null, 2) }
186
+ ]
187
+ });
188
+ function callStudioTool(projectRoot, name, args) {
189
+ try {
190
+ if (name === "studio_preset_schema") return text(presetJsonSchema());
191
+ const preset = readPresetInput(args.preset);
192
+ const code = presetArgument(preset);
193
+ if (name === "studio_preview") {
194
+ const from = typeof args.from === "string" ? args.from : "agent";
195
+ return text({
196
+ code,
197
+ preset,
198
+ reviewUrl: studioReviewUrl(preset, from),
199
+ apply: `nebutra studio pull ${code}`,
200
+ create: `npx create-sailor@latest my-app --preset ${code}`
201
+ });
202
+ }
203
+ if (name === "studio_pull") {
204
+ const tokens = path.join(projectRoot, "packages", "design", "tokens");
205
+ if (!fs.existsSync(path.join(tokens, "package.json"))) {
206
+ throw new Error(`${projectRoot} is not a Sailor project (no packages/design/tokens).`);
207
+ }
208
+ const file = path.join(tokens, "project", "preset");
209
+ fs.mkdirSync(path.dirname(file), { recursive: true });
210
+ fs.writeFileSync(file, `${encodePreset(preset)}
211
+ `);
212
+ return text({
213
+ written: path.relative(projectRoot, file),
214
+ code,
215
+ next: "pnpm --filter @nebutra/tokens build"
216
+ });
217
+ }
218
+ throw new Error(`Unknown tool: ${name}`);
219
+ } catch (error) {
220
+ return {
221
+ ...text(`Error: ${error instanceof Error ? error.message : String(error)}`),
222
+ isError: true
223
+ };
224
+ }
225
+ }
142
226
  function getProjectStructure(projectRoot) {
143
227
  const roots = ["apps", "packages", "backends"].filter(
144
228
  (segment) => fs.existsSync(path.join(projectRoot, segment))
@@ -174,5 +258,7 @@ if (process.argv[1]?.endsWith("contextServer.js") || process.argv[1]?.endsWith("
174
258
 
175
259
  export {
176
260
  createContextServerHandlers,
261
+ STUDIO_TOOLS,
262
+ callStudioTool,
177
263
  startContextServer
178
264
  };
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  import "./chunk-EMIF5K3P.js";
6
6
  import {
7
7
  createContextServerHandlers
8
- } from "./chunk-YMTQFRV2.js";
8
+ } from "./chunk-OPM7YNM4.js";
9
9
 
10
10
  // src/cli.ts
11
11
  var command = process.argv[2] ?? "doctor";
@@ -18,7 +18,19 @@ declare function createContextServerHandlers(projectRoot: string): {
18
18
  }[];
19
19
  }>;
20
20
  listTools(): Promise<{
21
- tools: {
21
+ tools: ({
22
+ name: string;
23
+ description: string;
24
+ inputSchema: {
25
+ type: string;
26
+ properties: {
27
+ preset: {
28
+ description: string;
29
+ };
30
+ };
31
+ required: string[];
32
+ };
33
+ } | {
22
34
  name: string;
23
35
  description: string;
24
36
  inputSchema: {
@@ -26,9 +38,9 @@ declare function createContextServerHandlers(projectRoot: string): {
26
38
  properties: {};
27
39
  required: never[];
28
40
  };
29
- }[];
41
+ })[];
30
42
  }>;
31
- callTool({ name }: {
43
+ callTool({ name, arguments: args, }: {
32
44
  name: string;
33
45
  arguments?: Record<string, unknown> | undefined;
34
46
  }): Promise<{
@@ -36,15 +48,57 @@ declare function createContextServerHandlers(projectRoot: string): {
36
48
  type: string;
37
49
  text: string;
38
50
  }[];
39
- isError?: never;
40
- } | {
41
- content: {
42
- type: string;
43
- text: string;
44
- }[];
45
- isError: boolean;
46
51
  }>;
47
52
  };
53
+ declare const STUDIO_TOOLS: ({
54
+ name: string;
55
+ description: string;
56
+ inputSchema: {
57
+ type: string;
58
+ properties: {};
59
+ required: never[];
60
+ };
61
+ } | {
62
+ name: string;
63
+ description: string;
64
+ inputSchema: {
65
+ type: string;
66
+ properties: {
67
+ from: {
68
+ type: string;
69
+ description: string;
70
+ };
71
+ preset: {
72
+ description: string;
73
+ };
74
+ };
75
+ required: string[];
76
+ };
77
+ } | {
78
+ name: string;
79
+ description: string;
80
+ inputSchema: {
81
+ type: string;
82
+ properties: {
83
+ preset: {
84
+ description: string;
85
+ };
86
+ };
87
+ required: string[];
88
+ };
89
+ })[];
90
+ declare function callStudioTool(projectRoot: string, name: string, args: Record<string, unknown>): {
91
+ content: {
92
+ type: string;
93
+ text: string;
94
+ }[];
95
+ } | {
96
+ isError: boolean;
97
+ content: {
98
+ type: string;
99
+ text: string;
100
+ }[];
101
+ };
48
102
  declare const startContextServer: () => void;
49
103
 
50
- export { createContextServerHandlers, startContextServer };
104
+ export { STUDIO_TOOLS, callStudioTool, createContextServerHandlers, startContextServer };
@@ -1,9 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ STUDIO_TOOLS,
4
+ callStudioTool,
3
5
  createContextServerHandlers,
4
6
  startContextServer
5
- } from "../chunk-YMTQFRV2.js";
7
+ } from "../chunk-OPM7YNM4.js";
6
8
  export {
9
+ STUDIO_TOOLS,
10
+ callStudioTool,
7
11
  createContextServerHandlers,
8
12
  startContextServer
9
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebutra/mcp",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -42,10 +42,11 @@
42
42
  "dependencies": {
43
43
  "@modelcontextprotocol/sdk": "1.29.0",
44
44
  "zod": "^4.3.6",
45
- "@nebutra/capability-kit": "4.0.0",
46
- "@nebutra/errors": "4.0.0",
47
- "@nebutra/event-log": "4.0.0",
48
- "@nebutra/trace-store": "4.0.0"
45
+ "@nebutra/capability-kit": "4.0.1",
46
+ "@nebutra/errors": "4.0.1",
47
+ "@nebutra/tokens": "4.0.1",
48
+ "@nebutra/event-log": "4.0.1",
49
+ "@nebutra/trace-store": "4.0.1"
49
50
  },
50
51
  "devDependencies": {
51
52
  "tsup": "^8.5.1",
@@ -72,7 +73,7 @@
72
73
  "CHANGELOG.md"
73
74
  ],
74
75
  "peerDependencies": {
75
- "@nebutra/ui": "4.0.0"
76
+ "@nebutra/ui": "4.0.1"
76
77
  },
77
78
  "peerDependenciesMeta": {
78
79
  "@nebutra/ui": {