@cogitato/kit-mcp 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,25 @@
1
- # Temporary Holding Version
1
+ # @cogitato/kit-mcp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The kit MCP server ([05-kit-mcp.md](../../docs/architecture/components/05-kit-mcp.md)). It gives Claude Code structured access to a prototype's design contract and its scaffolding actions. It's a thin layer over `@cogitato/kit-cli`: every tool calls a kit-cli function.
4
+
5
+ | Tool | What it does |
6
+ |---|---|
7
+ | `list_components` | Kit components with usage notes and source badges |
8
+ | `get_component` | One component's props, states, rules, and the design rules that mention it |
9
+ | `get_tokens` | Tokens (optionally one group) with the `var(--kit-…)` to use |
10
+ | `create_screen` | New screen with a default state, optionally connected from an existing state |
11
+ | `add_state` | New state on a screen, optionally connected |
12
+ | `log_gap` | Records a missing component, token or pattern |
13
+ | `validate` | Plain-language check against the contract |
14
+ | `canvas_link` | The state's frame on the canvas, and the state on its own |
15
+ | `set_status` | Sets a state's review status on the canvas |
16
+ | `save_version` | Saves a version (used by the `save-version` skill) |
17
+
18
+ Tool errors (an id that's taken, a component that isn't in the kit) come back as plain sentences Claude can relay.
19
+
20
+ ## Running it
21
+ The Cogitato plugin starts it from the prototype's own `node_modules`, so it matches the kit version the prototype pins ([ADR 010](../../docs/decisions/010-plugin-runs-project-kit.md)). By hand: `kit-mcp` over stdio in a prototype folder. It finds the prototype from `KIT_PROJECT`, then `CLAUDE_PROJECT_DIR`, then the working directory.
22
+
23
+ ## Tests
24
+ - `test/server.test.ts` drives every tool through an in-memory MCP client on a copy of the template.
25
+ - `test/plugin.test.ts` checks the plugin's files and runs its launchers against the template, a prototype with nothing installed, and a folder that isn't a prototype.
package/bin/kit-mcp.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { serveStdio } from "../dist/index.js";
3
+
4
+ await serveStdio();
@@ -0,0 +1,9 @@
1
+ import { type Workspace } from "@cogitato/kit-cli";
2
+ export { SERVER_NAME, createServer } from "./server.js";
3
+ /**
4
+ * The workspace the server works on: KIT_PROJECT (set by the plugin), then
5
+ * CLAUDE_PROJECT_DIR, then the working directory, each searched upward for design/contract. The prototype is chosen per call.
6
+ */
7
+ export declare function resolveWorkspace(env?: NodeJS.ProcessEnv, cwd?: string): Workspace | undefined;
8
+ /** Starts the server on stdio. */
9
+ export declare function serveStdio(): Promise<void>;
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
+ import { findWorkspace } from "@cogitato/kit-cli";
3
+ import { createServer } from "./server.js";
4
+ export { SERVER_NAME, createServer } from "./server.js";
5
+ /**
6
+ * The workspace the server works on: KIT_PROJECT (set by the plugin), then
7
+ * CLAUDE_PROJECT_DIR, then the working directory, each searched upward for design/contract. The prototype is chosen per call.
8
+ */
9
+ export function resolveWorkspace(env = process.env, cwd = process.cwd()) {
10
+ for (const start of [env.KIT_PROJECT, env.CLAUDE_PROJECT_DIR, cwd]) {
11
+ const ws = start ? findWorkspace(start) : undefined;
12
+ if (ws)
13
+ return ws;
14
+ }
15
+ return undefined;
16
+ }
17
+ /** Starts the server on stdio. */
18
+ export async function serveStdio() {
19
+ const ws = resolveWorkspace();
20
+ if (!ws) {
21
+ process.stderr.write("kit-mcp: this folder isn't a Cogitato workspace (no design/contract folder here or above it).\n");
22
+ process.exitCode = 1;
23
+ return;
24
+ }
25
+ await createServer(ws).connect(new StdioServerTransport());
26
+ }
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAkB,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAyB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE;IACxF,KAAK,MAAM,KAAK,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,kBAAkB,EAAE,GAAG,CAAC,EAAE,CAAC;QACnE,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACpD,IAAI,EAAE;YAAE,OAAO,EAAE,CAAC;IACpB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,kCAAkC;AAClC,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iGAAiG,CAAC,CAAC;QACxH,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IACD,MAAM,YAAY,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { type Workspace } from "@cogitato/kit-cli";
3
+ export declare const SERVER_NAME = "cogitato-kit";
4
+ /**
5
+ * Bullet points in rules.md that mention `name`, each prefixed with its section heading
6
+ * ("Don't: Nest a `Card` inside another `Card`.") so a "Don't" rule can't read as an instruction.
7
+ */
8
+ export declare function rulesMentioning(markdown: string, name: string): string[];
9
+ export declare function createServer(ws: Workspace): McpServer;
package/dist/server.js ADDED
@@ -0,0 +1,200 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
+ import { tokenCssVar } from "@cogitato/contract";
5
+ import { KitError, WORKSPACE_LAYOUT, addGap, addState, createScreen, formatResult, readContract, saveVersion, canvasLink, setStatus, stateLink, statusLabel, listPrototypes, resolvePrototype, validate, validateWorkspace, workspaceSuccess, } from "@cogitato/kit-cli";
6
+ import { z } from "zod";
7
+ // The kit MCP server: a thin layer over @cogitato/kit-cli. Every tool here calls a kit-cli
8
+ // function; nothing about the contract or the rules is decided in this package.
9
+ export const SERVER_NAME = "cogitato-kit";
10
+ // package.json sits one folder up from both src/ and dist/.
11
+ const { version: SERVER_VERSION } = createRequire(import.meta.url)("../package.json");
12
+ const INSTRUCTIONS = `Tools for this Cogitato workspace's design contract (its design system) and its prototypes' screens.
13
+ Use them instead of reading files in design/contract: list_components and get_component before using a kit component,
14
+ get_tokens before choosing a color, size, space, radius or shadow. Create screens and states with create_screen and add_state,
15
+ then fill in the UI. If the design needs something the kit doesn't have, use log_gap rather than improvising.
16
+ Finish building work with validate and give the person the canvas_link (the canvas shows the new state among the rest of the flow). This is a design workspace: several prototypes share one design kit. Pass \`prototype\` when there's more than one; list_prototypes names them.
17
+ The person is usually a designer: plain language.`;
18
+ const text = (t, isError = false) => ({ content: [{ type: "text", text: t }], ...(isError ? { isError } : {}) });
19
+ const json = (label, data) => text(`${label}\n\n${JSON.stringify(data, null, 2)}`);
20
+ /** Runs a tool body, turning KitErrors into tool errors Claude can explain to the designer. */
21
+ async function run(body) {
22
+ try {
23
+ return await body();
24
+ }
25
+ catch (e) {
26
+ if (e instanceof KitError)
27
+ return text(e.message, true);
28
+ return text(`Something went wrong in the Cogitato tools: ${e instanceof Error ? e.message : String(e)}`, true);
29
+ }
30
+ }
31
+ function scaffolded(r) {
32
+ return text([
33
+ `Created ${r.node}. Files: ${r.files.join(", ")}.`,
34
+ `On the canvas: ${r.canvas}`,
35
+ `On its own: ${r.link}`,
36
+ "",
37
+ formatResult(r, "It validates: no problems."),
38
+ ].join("\n"));
39
+ }
40
+ /**
41
+ * Bullet points in rules.md that mention `name`, each prefixed with its section heading
42
+ * ("Don't: Nest a `Card` inside another `Card`.") so a "Don't" rule can't read as an instruction.
43
+ */
44
+ export function rulesMentioning(markdown, name) {
45
+ const mentions = new RegExp(`\\b${name}\\b`);
46
+ let section = "";
47
+ const out = [];
48
+ for (const line of markdown.split(/\r?\n/)) {
49
+ const heading = /^#{2,6}\s+(.+?)\s*$/.exec(line);
50
+ if (heading)
51
+ section = heading[1];
52
+ const bullet = /^\s*[-*]\s+(.+)$/.exec(line);
53
+ if (bullet && mentions.test(bullet[1]))
54
+ out.push(`- ${section ? `${section}: ` : ""}${bullet[1]}`);
55
+ }
56
+ return out;
57
+ }
58
+ const step = z.string().describe('A screen state, written "{screen id}.{state}", like "checkout.payment.default".');
59
+ const prototypeArg = z.string().optional().describe("Which prototype (a folder in prototypes/). Leave out when there's only one.");
60
+ export function createServer(ws) {
61
+ const at = (name) => resolvePrototype(ws, name, process.env.KIT_PROJECT);
62
+ const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION }, { instructions: INSTRUCTIONS });
63
+ server.registerTool("list_components", {
64
+ title: "List kit components",
65
+ description: "Lists the components in the design kit with their one-line usage and source badges. Only these components may be used in screens.",
66
+ annotations: { readOnlyHint: true },
67
+ }, () => run(() => {
68
+ const { manifests } = readContract(ws);
69
+ const lines = [...manifests.values()]
70
+ .sort((a, b) => a.name.localeCompare(b.name))
71
+ .map((m) => `- ${m.name} (import from "${m.import}"; source: ${m.source}, confidence: ${m.confidence})${m.description ? `: ${m.description}` : ""}`);
72
+ return text(lines.length ? `Kit components:\n${lines.join("\n")}` : "The kit has no components yet.");
73
+ }));
74
+ server.registerTool("get_component", {
75
+ title: "Get a kit component",
76
+ description: "Full details of one kit component: props and their allowed values, visual states, usage rules, and the design rules that mention it.",
77
+ inputSchema: { name: z.string().describe('Component name, like "Button".') },
78
+ annotations: { readOnlyHint: true },
79
+ }, ({ name }) => run(() => {
80
+ const { manifests } = readContract(ws);
81
+ const m = manifests.get(name) ?? [...manifests.values()].find((x) => x.name.toLowerCase() === name.toLowerCase());
82
+ if (!m) {
83
+ throw new KitError(`"${name}" isn't in the design kit. It has: ${[...manifests.keys()].sort().join(", ")}. If the design needs it, log a gap.`);
84
+ }
85
+ const rulesPath = ws.abs(`${WORKSPACE_LAYOUT.contract}/rules.md`);
86
+ const designRules = existsSync(rulesPath) ? rulesMentioning(readFileSync(rulesPath, "utf8"), m.name) : [];
87
+ const { $schema: _s, mapping: _m, ...manifest } = m;
88
+ return json(`${m.name}${designRules.length ? `\n\nDesign rules that mention it:\n${designRules.join("\n")}` : ""}`, manifest);
89
+ }));
90
+ server.registerTool("get_tokens", {
91
+ title: "Get design tokens",
92
+ description: "Design tokens with the CSS variable to use for each (var(--kit-...)). Use these for every color, font size, space, radius and shadow; never hardcode values.",
93
+ inputSchema: { group: z.string().optional().describe('Only tokens under this group, like "color", "space" or "color.feedback".') },
94
+ annotations: { readOnlyHint: true },
95
+ }, ({ group }) => run(() => {
96
+ const { tokens } = readContract(ws);
97
+ const picked = tokens.filter((t) => !group || t.path === group || t.path.startsWith(`${group}.`));
98
+ if (!picked.length) {
99
+ const groups = [...new Set(tokens.map((t) => t.path.split(".")[0]))].join(", ");
100
+ throw new KitError(`No tokens under "${group}". Groups: ${groups}.`);
101
+ }
102
+ const lines = picked.map((t) => {
103
+ const value = typeof t.resolved === "string" || typeof t.resolved === "number" ? String(t.resolved) : JSON.stringify(t.resolved);
104
+ const notes = [t.description, t.deprecated ? `deprecated${typeof t.deprecated === "string" ? `: ${t.deprecated}` : ""}` : undefined].filter(Boolean).join("; ");
105
+ return `- ${t.path} = ${value} → var(${tokenCssVar(t.path)})${notes ? ` (${notes})` : ""}`;
106
+ });
107
+ return text(`${picked.length} token${picked.length === 1 ? "" : "s"}:\n${lines.join("\n")}`);
108
+ }));
109
+ server.registerTool("create_screen", {
110
+ title: "Create a screen",
111
+ description: "Creates a new screen file with its default state, registered so it appears in the flow. Optionally connects an existing state to it. Then fill in the screen's UI with kit components.",
112
+ inputSchema: {
113
+ id: z.string().describe('Screen id: lowercase words separated by dots, like "checkout.review".'),
114
+ title: z.string().describe('Name people see, like "Review order".'),
115
+ route: z.string().optional().describe('Address in the prototype; defaults to the id with slashes, like "/checkout/review".'),
116
+ from: step.optional().describe("An existing state that leads to this screen (adds an arrow in the flow)."),
117
+ label: z.string().optional().describe('What the person does to get here, like "Continue".'),
118
+ flow: z.string().optional().describe("Flow to add the arrow to; defaults to the flow that already has `from`."),
119
+ prototype: prototypeArg,
120
+ },
121
+ }, (args) => run(() => scaffolded(createScreen(at(args.prototype), args))));
122
+ server.registerTool("add_state", {
123
+ title: "Add a state to a screen",
124
+ description: "Adds a state (fixture) to an existing screen, like \"card-expired\" on the payment screen, and optionally the arrow that leads to it. Then fill in the state's data and how the screen looks in it.",
125
+ inputSchema: {
126
+ screen: z.string().describe('Screen id, like "checkout.payment".'),
127
+ state: z.string().describe('State name: lowercase words joined by dashes, like "card-expired".'),
128
+ title: z.string().optional().describe('Name people see, like "Card expired".'),
129
+ from: step.optional().describe("An existing state that leads to this one."),
130
+ label: z.string().optional().describe('What happens to get here, like "Card expired".'),
131
+ flow: z.string().optional(),
132
+ prototype: prototypeArg,
133
+ },
134
+ }, (args) => run(() => scaffolded(addState(at(args.prototype), args))));
135
+ server.registerTool("log_gap", {
136
+ title: "Log a design-system gap",
137
+ description: "Records something the design needs that the kit doesn't have (a component, token or pattern), so developers can add it. Use it instead of improvising or hardcoding.",
138
+ inputSchema: {
139
+ kind: z.enum(["component", "token", "pattern"]),
140
+ name: z.string().describe('What\'s missing, like "Stepper" or "color.feedback.warning-subtle".'),
141
+ context: z.string().describe("What the designer was trying to do."),
142
+ screen: z.string().optional().describe("Screen id where it came up."),
143
+ workaround: z.string().optional().describe("What was used instead in the meantime."),
144
+ },
145
+ }, (args) => run(() => {
146
+ const r = addGap(at(listPrototypes(ws)[0]), args);
147
+ return text(r.created ? `Logged gap ${r.gap.id}: ${r.gap.name}.` : `This is already logged as ${r.gap.id}; nothing new was added.`);
148
+ }));
149
+ server.registerTool("validate", {
150
+ title: "Check the prototypes",
151
+ description: "Checks a prototype against its design contract (with several prototypes and none named, checks the whole workspace) and returns plain-language problems with suggested fixes. Run it before finishing any building work.",
152
+ inputSchema: {
153
+ files: z.array(z.string()).optional().describe("Only check these files (relative to the prototype). Leave out to check everything."),
154
+ prototype: prototypeArg,
155
+ },
156
+ annotations: { readOnlyHint: true },
157
+ }, ({ files, prototype }) => run(() => {
158
+ if (!files?.length && !prototype && listPrototypes(ws).length !== 1)
159
+ return text(formatResult(validateWorkspace(ws), workspaceSuccess(ws)));
160
+ return text(formatResult(validate(at(prototype), files?.length ? { files } : {})));
161
+ }));
162
+ server.registerTool("canvas_link", {
163
+ title: "Link to a screen state",
164
+ description: "Where the person can see a screen state: its frame on the canvas, among the rest of the flow, and the state on its own. Give them the canvas link after building something.",
165
+ inputSchema: { step: z.string().describe('"{screen id}.{state}", or just a screen id for its default state.'), prototype: prototypeArg },
166
+ annotations: { readOnlyHint: true },
167
+ }, ({ step: node, prototype }) => run(() => {
168
+ const project = at(prototype);
169
+ return text(`On the canvas: ${canvasLink(project, node)}\nOn its own: ${stateLink(project, node)}`);
170
+ }));
171
+ server.registerTool("set_status", {
172
+ title: "Set a review status",
173
+ description: "Sets a screen state's review status on the canvas: exploring (the default), in-review, approved or handed-off. Use when the person says a state is ready for review, approved, and so on.",
174
+ inputSchema: {
175
+ step: z.string().describe('"{screen id}.{state}", like "checkout.payment.card-declined".'),
176
+ status: z.enum(["exploring", "in-review", "approved", "handed-off"]),
177
+ prototype: prototypeArg,
178
+ },
179
+ }, ({ step: node, status, prototype }) => run(() => {
180
+ const r = setStatus(at(prototype), node, status);
181
+ return text(`${r.node} is now "${statusLabel(r.status)}" on the canvas (it was "${statusLabel(r.previous)}").`);
182
+ }));
183
+ server.registerTool("save_version", {
184
+ title: "Save a version",
185
+ description: "Saves the designer's work as a version: commits everything on their design branch and shares it if the workspace has a shared copy. Only use when the person asks to save.",
186
+ inputSchema: { message: z.string().optional().describe("Short description of the version; generated from the changes if left out.") },
187
+ }, ({ message }) => run(() => {
188
+ const r = saveVersion(ws, message ? { message } : {});
189
+ const problems = r.issues.length ? `\n\nOpen problems:\n${formatResult({ ok: false, issues: r.issues })}` : "";
190
+ return text(`${r.message}${problems}`);
191
+ }));
192
+ server.registerTool("list_prototypes", {
193
+ title: "List prototypes",
194
+ description: "The prototypes in this design workspace (folders in prototypes/). They all share one design kit.",
195
+ inputSchema: {},
196
+ annotations: { readOnlyHint: true },
197
+ }, () => run(() => text(listPrototypes(ws).join("\n") || "No prototypes yet.")));
198
+ return server;
199
+ }
200
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,GAGjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,2FAA2F;AAC3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AE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/G,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,GAAG,QAAQ,EAAE,CAAC,CAAC;IACzC,CAAC,CAAC,CACL,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,kGAAkG;QAC/G,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KACpC,EACD,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,oBAAoB,CAAC,CAAC,CAC7E,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@cogitato/kit-mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "Kit MCP server: gives Claude Code structured access to a design workspace's contract and its prototypes' screens and states",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/cogitato/cogitato.git",
9
+ "directory": "packages/kit-mcp"
10
+ },
11
+ "homepage": "https://github.com/cogitato/cogitato/tree/main/packages/kit-mcp#readme",
12
+ "bugs": "https://github.com/cogitato/cogitato/issues",
13
+ "engines": {
14
+ "node": ">=22"
15
+ },
16
+ "type": "module",
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "bin": {
20
+ "kit-mcp": "./bin/kit-mcp.js"
21
+ },
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "default": "./dist/index.js"
26
+ }
27
+ },
28
+ "files": [
29
+ "bin",
30
+ "dist"
31
+ ],
32
+ "dependencies": {
33
+ "@modelcontextprotocol/sdk": "^1.32.2",
34
+ "zod": "^4.6.7",
35
+ "@cogitato/contract": "0.2.0",
36
+ "@cogitato/kit-cli": "0.2.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^22.10.0",
40
+ "typescript": "^5.9.3",
41
+ "vitest": "^3.0.0"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public",
45
+ "provenance": true
46
+ },
47
+ "scripts": {
48
+ "build": "tsc -p tsconfig.build.json",
49
+ "typecheck": "tsc -p tsconfig.json --noEmit",
50
+ "test": "vitest run"
51
+ }
6
52
  }