mcp-stitch 0.1.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 +122 -0
- package/dist/config/stitch.d.ts +11 -0
- package/dist/config/stitch.d.ts.map +1 -0
- package/dist/config/stitch.js +38 -0
- package/dist/config/stitch.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/models/stitch.d.ts +20 -0
- package/dist/models/stitch.d.ts.map +1 -0
- package/dist/models/stitch.js +2 -0
- package/dist/models/stitch.js.map +1 -0
- package/dist/services/stitchClient.d.ts +8 -0
- package/dist/services/stitchClient.d.ts.map +1 -0
- package/dist/services/stitchClient.js +189 -0
- package/dist/services/stitchClient.js.map +1 -0
- package/dist/tools/status.d.ts +3 -0
- package/dist/tools/status.d.ts.map +1 -0
- package/dist/tools/status.js +50 -0
- package/dist/tools/status.js.map +1 -0
- package/dist/tools/stitchDesignSystems.d.ts +3 -0
- package/dist/tools/stitchDesignSystems.d.ts.map +1 -0
- package/dist/tools/stitchDesignSystems.js +340 -0
- package/dist/tools/stitchDesignSystems.js.map +1 -0
- package/dist/tools/stitchExport.d.ts +3 -0
- package/dist/tools/stitchExport.d.ts.map +1 -0
- package/dist/tools/stitchExport.js +923 -0
- package/dist/tools/stitchExport.js.map +1 -0
- package/dist/tools/stitchProjects.d.ts +3 -0
- package/dist/tools/stitchProjects.d.ts.map +1 -0
- package/dist/tools/stitchProjects.js +125 -0
- package/dist/tools/stitchProjects.js.map +1 -0
- package/dist/tools/stitchScreens.d.ts +3 -0
- package/dist/tools/stitchScreens.d.ts.map +1 -0
- package/dist/tools/stitchScreens.js +320 -0
- package/dist/tools/stitchScreens.js.map +1 -0
- package/dist/utils/redact.d.ts +3 -0
- package/dist/utils/redact.d.ts.map +1 -0
- package/dist/utils/redact.js +14 -0
- package/dist/utils/redact.js.map +1 -0
- package/dist/utils/safePath.d.ts +3 -0
- package/dist/utils/safePath.d.ts.map +1 -0
- package/dist/utils/safePath.js +81 -0
- package/dist/utils/safePath.js.map +1 -0
- package/dist/utils/stitchIds.d.ts +12 -0
- package/dist/utils/stitchIds.d.ts.map +1 -0
- package/dist/utils/stitchIds.js +48 -0
- package/dist/utils/stitchIds.js.map +1 -0
- package/dist/utils/stitchResponse.d.ts +11 -0
- package/dist/utils/stitchResponse.d.ts.map +1 -0
- package/dist/utils/stitchResponse.js +71 -0
- package/dist/utils/stitchResponse.js.map +1 -0
- package/dist/utils/stitchScreenResolver.d.ts +26 -0
- package/dist/utils/stitchScreenResolver.d.ts.map +1 -0
- package/dist/utils/stitchScreenResolver.js +159 -0
- package/dist/utils/stitchScreenResolver.js.map +1 -0
- package/dist/utils/stitchToolHelpers.d.ts +6 -0
- package/dist/utils/stitchToolHelpers.d.ts.map +1 -0
- package/dist/utils/stitchToolHelpers.js +25 -0
- package/dist/utils/stitchToolHelpers.js.map +1 -0
- package/docs/stitch-tools.md +389 -0
- package/package.json +40 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
# Stitch MCP Tools
|
|
2
|
+
|
|
3
|
+
This server exposes Stitch project, screen, design-system, DESIGN.md import, generation, and safe artifact export helpers.
|
|
4
|
+
|
|
5
|
+
## Required environment variables
|
|
6
|
+
|
|
7
|
+
- GOOGLE_API_KEY
|
|
8
|
+
|
|
9
|
+
## Recommended environment variables
|
|
10
|
+
|
|
11
|
+
- PROJECT_ROOT (workspace/project directory where Stitch artifacts should be exported)
|
|
12
|
+
|
|
13
|
+
## Optional environment variables
|
|
14
|
+
|
|
15
|
+
- STITCH_API_BASE_URL (default: https://stitch.googleapis.com/mcp)
|
|
16
|
+
- STITCH_TIMEOUT_MS (default: 30000)
|
|
17
|
+
- STITCH_MAX_RETRIES (default: 2)
|
|
18
|
+
- STITCH_OUTPUT_DIR (default: PROJECT_ROOT/stitch-output or cwd/stitch-output)
|
|
19
|
+
|
|
20
|
+
## Tools
|
|
21
|
+
|
|
22
|
+
Mutating tools are marked `MUTATING` and require `confirm: true`. Without confirmation they return a safe refusal describing the operation that would run.
|
|
23
|
+
|
|
24
|
+
1. stitch_status
|
|
25
|
+
- Checks Stitch MCP setup and reports missing required, recommended, and optional environment variables without exposing secret values.
|
|
26
|
+
- Input: none
|
|
27
|
+
|
|
28
|
+
2. stitch_list_projects
|
|
29
|
+
- Lists Stitch projects.
|
|
30
|
+
- Input:
|
|
31
|
+
- filter (optional)
|
|
32
|
+
- rawInput (optional override for exact Stitch request shape)
|
|
33
|
+
|
|
34
|
+
3. stitch_get_project
|
|
35
|
+
- Gets one project.
|
|
36
|
+
- Input:
|
|
37
|
+
- projectId (optional if rawInput used; bare id or projects/{id}, normalized to full resource name)
|
|
38
|
+
- rawInput (optional)
|
|
39
|
+
|
|
40
|
+
4. stitch_list_screens
|
|
41
|
+
- Lists screens in a project.
|
|
42
|
+
- Input:
|
|
43
|
+
- projectId (optional if rawInput used; bare id or projects/{id}, normalized to bare id)
|
|
44
|
+
- rawInput (optional)
|
|
45
|
+
|
|
46
|
+
5. stitch_get_screen
|
|
47
|
+
- Gets one screen.
|
|
48
|
+
- Input:
|
|
49
|
+
- screenId (optional if rawInput used; full projects/{id}/screens/{screen} path, or bare screen id when projectId is also provided)
|
|
50
|
+
- projectId (optional; bare id or projects/{id}, used with bare screenId or partial title/name lookup)
|
|
51
|
+
- rawInput (optional)
|
|
52
|
+
|
|
53
|
+
6. stitch_generate_screen_from_text
|
|
54
|
+
- Generates a screen from text.
|
|
55
|
+
- Input:
|
|
56
|
+
- prompt (required unless rawInput used)
|
|
57
|
+
- projectId (required unless rawInput used; bare id preferred; projects/{id} is normalized by the adapter)
|
|
58
|
+
- rawInput (optional)
|
|
59
|
+
|
|
60
|
+
7. stitch_export_screen_artifact
|
|
61
|
+
- Exports a screen artifact bundle under PROJECT_ROOT, with STITCH_OUTPUT_DIR as fallback when PROJECT_ROOT is unset.
|
|
62
|
+
- Input:
|
|
63
|
+
- screenData (optional direct payload to export)
|
|
64
|
+
- screenId (optional: fetches from Stitch first; full screen resource name, bare screen id with projectId, or partial title/name with projectId)
|
|
65
|
+
- projectId (optional; used with bare screenId or partial title/name lookup)
|
|
66
|
+
- rawGetScreenInput (optional)
|
|
67
|
+
- artifactPath (optional workspace-relative bundle directory, for example `.artifacts/features/settings/design`)
|
|
68
|
+
- artifactName (optional backward-compatible fallback)
|
|
69
|
+
- relativePath (optional legacy bundle directory, treated like artifactPath)
|
|
70
|
+
|
|
71
|
+
8. stitch_create_project
|
|
72
|
+
- MUTATING: creates a new Stitch project.
|
|
73
|
+
- Input:
|
|
74
|
+
- title (optional)
|
|
75
|
+
- confirm (required true to execute)
|
|
76
|
+
- rawInput (optional)
|
|
77
|
+
|
|
78
|
+
9. stitch_edit_screens
|
|
79
|
+
- MUTATING: edits existing screens with a text prompt.
|
|
80
|
+
- Input:
|
|
81
|
+
- projectId (required unless rawInput used; bare id or projects/{id}, normalized to bare id)
|
|
82
|
+
- selectedScreenIds (required unless rawInput used; bare screen ids or full screen resource names, normalized to bare ids)
|
|
83
|
+
- prompt (required unless rawInput used)
|
|
84
|
+
- deviceType (optional: DEVICE_TYPE_UNSPECIFIED, MOBILE, DESKTOP, TABLET, AGNOSTIC)
|
|
85
|
+
- modelId (optional: MODEL_ID_UNSPECIFIED, GEMINI_3_PRO, GEMINI_3_FLASH, GEMINI_3_1_PRO)
|
|
86
|
+
- confirm (required true to execute)
|
|
87
|
+
- rawInput (optional)
|
|
88
|
+
|
|
89
|
+
10. stitch_generate_variants
|
|
90
|
+
- MUTATING: generates variants of existing screens.
|
|
91
|
+
- Input:
|
|
92
|
+
- projectId (required unless rawInput used; normalized to bare id)
|
|
93
|
+
- selectedScreenIds (required unless rawInput used; normalized to bare ids)
|
|
94
|
+
- prompt (required unless rawInput used)
|
|
95
|
+
- variantOptions (required unless rawInput used)
|
|
96
|
+
- aspects (optional array: VARIANT_ASPECT_UNSPECIFIED, LAYOUT, COLOR_SCHEME, IMAGES, TEXT_FONT, TEXT_CONTENT)
|
|
97
|
+
- creativeRange (optional: CREATIVE_RANGE_UNSPECIFIED, REFINE, EXPLORE, REIMAGINE)
|
|
98
|
+
- variantCount (optional integer 1-5)
|
|
99
|
+
- deviceType (optional)
|
|
100
|
+
- modelId (optional)
|
|
101
|
+
- confirm (required true to execute)
|
|
102
|
+
- rawInput (optional)
|
|
103
|
+
|
|
104
|
+
11. stitch_upload_design_md
|
|
105
|
+
- MUTATING: uploads base64-encoded DESIGN.md content to a project.
|
|
106
|
+
- Input:
|
|
107
|
+
- projectId (required unless rawInput used; normalized to bare id)
|
|
108
|
+
- designMdBase64 (required unless rawInput used)
|
|
109
|
+
- confirm (required true to execute)
|
|
110
|
+
- rawInput (optional)
|
|
111
|
+
|
|
112
|
+
12. stitch_create_design_system
|
|
113
|
+
- MUTATING: creates a design system, optionally scoped to a project.
|
|
114
|
+
- Input:
|
|
115
|
+
- projectId (optional; normalized to bare id)
|
|
116
|
+
- designSystem (required unless rawInput used)
|
|
117
|
+
- displayName (required)
|
|
118
|
+
- theme (required)
|
|
119
|
+
- colorMode (required)
|
|
120
|
+
- headlineFont (required)
|
|
121
|
+
- bodyFont (required)
|
|
122
|
+
- roundness (required)
|
|
123
|
+
- customColor (required)
|
|
124
|
+
- colorVariant, designMd, labelFont, override*Color, spacing, typography (optional)
|
|
125
|
+
- confirm (required true to execute)
|
|
126
|
+
- rawInput (optional)
|
|
127
|
+
|
|
128
|
+
13. stitch_create_design_system_from_design_md
|
|
129
|
+
- MUTATING: creates a design system from an uploaded DESIGN.md screen instance.
|
|
130
|
+
- Input:
|
|
131
|
+
- projectId (required unless rawInput used; normalized to bare id)
|
|
132
|
+
- selectedScreenInstance (required unless rawInput used)
|
|
133
|
+
- id (required; screen instance id, not source screen id)
|
|
134
|
+
- sourceScreen (required; full projects/{project}/screens/{screen}, or normalized from bare screen id when possible)
|
|
135
|
+
- deviceType (optional)
|
|
136
|
+
- confirm (required true to execute)
|
|
137
|
+
- rawInput (optional)
|
|
138
|
+
|
|
139
|
+
14. stitch_update_design_system
|
|
140
|
+
- MUTATING: updates an existing design system.
|
|
141
|
+
- Input:
|
|
142
|
+
- name (required unless rawInput used; assets/{asset_id} or bare asset id, normalized to full asset resource name)
|
|
143
|
+
- projectId (required unless rawInput used; normalized to bare id)
|
|
144
|
+
- designSystem (required unless rawInput used; same shape as create_design_system)
|
|
145
|
+
- confirm (required true to execute)
|
|
146
|
+
- rawInput (optional)
|
|
147
|
+
|
|
148
|
+
15. stitch_list_design_systems
|
|
149
|
+
- Lists design systems. If projectId is omitted, Stitch lists global design systems.
|
|
150
|
+
- Input:
|
|
151
|
+
- projectId (optional; normalized to bare id)
|
|
152
|
+
- rawInput (optional)
|
|
153
|
+
|
|
154
|
+
16. stitch_apply_design_system
|
|
155
|
+
- MUTATING: applies a design system to selected screen instances.
|
|
156
|
+
- Input:
|
|
157
|
+
- projectId (required unless rawInput used; normalized to bare id)
|
|
158
|
+
- assetId (required unless rawInput used; assets/{asset_id} or bare asset id, normalized to bare id)
|
|
159
|
+
- selectedScreenInstances (required unless rawInput used)
|
|
160
|
+
- id (required; screen instance id from get_project)
|
|
161
|
+
- sourceScreen (required; full projects/{project}/screens/{screen}, or normalized from bare screen id when possible)
|
|
162
|
+
- confirm (required true to execute)
|
|
163
|
+
- rawInput (optional)
|
|
164
|
+
|
|
165
|
+
## Basic usage examples
|
|
166
|
+
|
|
167
|
+
- List projects:
|
|
168
|
+
- call stitch_list_projects with {}
|
|
169
|
+
|
|
170
|
+
- Get a project:
|
|
171
|
+
- call stitch_get_project with { "projectId": "projects/abc" }
|
|
172
|
+
|
|
173
|
+
- List screens:
|
|
174
|
+
- call stitch_list_screens with { "projectId": "projects/abc" }
|
|
175
|
+
|
|
176
|
+
- Get a screen:
|
|
177
|
+
- call stitch_get_screen with { "screenId": "projects/abc/screens/home" }
|
|
178
|
+
- call stitch_get_screen with { "projectId": "projects/abc", "screenId": "home" }
|
|
179
|
+
- call stitch_get_screen with { "projectId": "projects/abc", "screenId": "do for you" }
|
|
180
|
+
|
|
181
|
+
- Generate a screen:
|
|
182
|
+
- call stitch_generate_screen_from_text with {
|
|
183
|
+
"projectId": "abc",
|
|
184
|
+
"prompt": "Create a dashboard with KPI cards and a recent activity list"
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
- Export a fetched screen:
|
|
188
|
+
- call stitch_export_screen_artifact with {
|
|
189
|
+
"screenId": "projects/abc/screens/home",
|
|
190
|
+
"artifactName": "home-screen"
|
|
191
|
+
}
|
|
192
|
+
- call stitch_export_screen_artifact with {
|
|
193
|
+
"projectId": "projects/abc",
|
|
194
|
+
"screenId": "do for you",
|
|
195
|
+
"artifactPath": ".artifacts/features/settings/design",
|
|
196
|
+
"artifactName": "matched-screen"
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
- Export direct payload:
|
|
200
|
+
- call stitch_export_screen_artifact with {
|
|
201
|
+
"screenData": { "name": "manual-screen", "nodes": [] },
|
|
202
|
+
"artifactPath": ".artifacts/stitch/manual-screen"
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
- Safely preview a mutating call without executing it:
|
|
206
|
+
- call stitch_edit_screens with {
|
|
207
|
+
"projectId": "projects/example-project",
|
|
208
|
+
"selectedScreenIds": ["abc123"],
|
|
209
|
+
"prompt": "Make the primary call to action clearer"
|
|
210
|
+
}
|
|
211
|
+
- The wrapper refuses until the same call includes `"confirm": true`.
|
|
212
|
+
|
|
213
|
+
- List design systems:
|
|
214
|
+
- call stitch_list_design_systems with { "projectId": "projects/example-project" }
|
|
215
|
+
|
|
216
|
+
- Create a design system:
|
|
217
|
+
- call stitch_create_design_system with {
|
|
218
|
+
"projectId": "projects/example-project",
|
|
219
|
+
"confirm": true,
|
|
220
|
+
"designSystem": {
|
|
221
|
+
"displayName": "Product Theme",
|
|
222
|
+
"theme": {
|
|
223
|
+
"colorMode": "LIGHT",
|
|
224
|
+
"headlineFont": "INTER",
|
|
225
|
+
"bodyFont": "INTER",
|
|
226
|
+
"roundness": "ROUND_EIGHT",
|
|
227
|
+
"customColor": "#2563eb"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
- Apply a design system:
|
|
233
|
+
- call stitch_apply_design_system with {
|
|
234
|
+
"projectId": "projects/example-project",
|
|
235
|
+
"assetId": "15996705518239280238",
|
|
236
|
+
"selectedScreenInstances": [
|
|
237
|
+
{
|
|
238
|
+
"id": "screen-instance-id-from-get-project",
|
|
239
|
+
"sourceScreen": "projects/example-project/screens/source-screen-id"
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
"confirm": true
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
## Stitch API Transport
|
|
246
|
+
|
|
247
|
+
The Stitch client uses `https://stitch.googleapis.com/mcp` by default. `STITCH_API_BASE_URL` is available as an optional override for testing or future endpoint changes.
|
|
248
|
+
|
|
249
|
+
The transport uses JSON-RPC over HTTP:
|
|
250
|
+
|
|
251
|
+
- method: `tools/call`
|
|
252
|
+
- params.name: the Stitch tool name
|
|
253
|
+
- params.arguments: input object
|
|
254
|
+
- auth header: `x-goog-api-key`
|
|
255
|
+
|
|
256
|
+
## Live Contract Notes (Verified 2026-07-01)
|
|
257
|
+
|
|
258
|
+
The following behaviors were validated against a live endpoint:
|
|
259
|
+
|
|
260
|
+
- Endpoint shape:
|
|
261
|
+
- host/path observed: stitch.googleapis.com/mcp
|
|
262
|
+
- method: POST
|
|
263
|
+
- content type: application/json
|
|
264
|
+
|
|
265
|
+
- Auth header:
|
|
266
|
+
- x-goog-api-key
|
|
267
|
+
|
|
268
|
+
- RPC envelope:
|
|
269
|
+
- list tools: { jsonrpc, id, method: "tools/list", params: {} }
|
|
270
|
+
- call tool: { jsonrpc, id, method: "tools/call", params: { name, arguments } }
|
|
271
|
+
|
|
272
|
+
- Tool names:
|
|
273
|
+
- list_projects
|
|
274
|
+
- get_project
|
|
275
|
+
- list_screens
|
|
276
|
+
- get_screen
|
|
277
|
+
- generate_screen_from_text
|
|
278
|
+
- create_project
|
|
279
|
+
- edit_screens
|
|
280
|
+
- generate_variants
|
|
281
|
+
- upload_design_md
|
|
282
|
+
- create_design_system
|
|
283
|
+
- create_design_system_from_design_md
|
|
284
|
+
- update_design_system
|
|
285
|
+
- list_design_systems
|
|
286
|
+
- apply_design_system
|
|
287
|
+
|
|
288
|
+
- Input field names observed from live tools/list schema:
|
|
289
|
+
- list_projects: filter (optional)
|
|
290
|
+
- get_project: name (required, full resource name `projects/{project}`)
|
|
291
|
+
- list_screens: projectId (required, bare project id without `projects/`)
|
|
292
|
+
- get_screen: name, projectId, screenId (schema marks all required; name is full `projects/{project}/screens/{screen}`, projectId and screenId are bare ids)
|
|
293
|
+
- generate_screen_from_text: projectId, prompt (required; projectId is bare id without `projects/`)
|
|
294
|
+
- projectId must be the bare project id, without the `projects/` prefix.
|
|
295
|
+
- Verified failure mode: passing `projects/example-project` returned result.isError = true with "Requested entity was not found."
|
|
296
|
+
- Verified success mode: passing `example-project` generated a screen successfully.
|
|
297
|
+
- create_project: title (optional)
|
|
298
|
+
- edit_screens: projectId, selectedScreenIds, prompt (required); deviceType, modelId (optional)
|
|
299
|
+
- generate_variants: projectId, selectedScreenIds, prompt, variantOptions (required); deviceType, modelId (optional)
|
|
300
|
+
- upload_design_md: projectId, designMdBase64 (required)
|
|
301
|
+
- create_design_system: designSystem (required), projectId (optional)
|
|
302
|
+
- create_design_system_from_design_md: projectId, selectedScreenInstance (required), deviceType (optional)
|
|
303
|
+
- update_design_system: name, projectId, designSystem (required)
|
|
304
|
+
- list_design_systems: projectId (optional; omitted means global design systems)
|
|
305
|
+
- apply_design_system: projectId, selectedScreenInstances, assetId (required)
|
|
306
|
+
|
|
307
|
+
- Shared live nested shapes:
|
|
308
|
+
- `variantOptions`: optional `aspects`, optional `creativeRange`, optional integer `variantCount`.
|
|
309
|
+
- `selectedScreenInstance`: required `id` and `sourceScreen`. `id` is a screen instance id from project info, not a source screen id. `sourceScreen` is `projects/{project}/screens/{screen}`.
|
|
310
|
+
- `designSystem`: required `displayName` and `theme`.
|
|
311
|
+
- `designSystem.theme`: required `colorMode`, `headlineFont`, `bodyFont`, `roundness`, `customColor`; optional `colorVariant`, `designMd`, `labelFont`, override colors, `spacing`, and `typography`.
|
|
312
|
+
|
|
313
|
+
## Project ID Normalization
|
|
314
|
+
|
|
315
|
+
Wrapper tools accept either `example-project` or `projects/example-project` for project-oriented inputs, then normalize at the Stitch contract boundary:
|
|
316
|
+
|
|
317
|
+
- `get_project` sends `name: "projects/{project}"`.
|
|
318
|
+
- `list_screens` sends `projectId: "{project}"`.
|
|
319
|
+
- `get_screen` sends `name: "projects/{project}/screens/{screen}"`, `projectId: "{project}"`, and `screenId: "{screen}"`.
|
|
320
|
+
- `generate_screen_from_text` sends `projectId: "{project}"`.
|
|
321
|
+
- `edit_screens`, `generate_variants`, `upload_design_md`, design-system project fields, and `apply_design_system` send `projectId: "{project}"`.
|
|
322
|
+
- `update_design_system` sends `name: "assets/{asset_id}"`.
|
|
323
|
+
- `apply_design_system` sends `assetId: "{asset_id}"`.
|
|
324
|
+
- Screen selections for edit/variant operations send bare screen ids. Screen instance `sourceScreen` values send full `projects/{project}/screens/{screen}` resource names.
|
|
325
|
+
|
|
326
|
+
`rawInput` and `rawGetScreenInput` remain exact pass-through escape hatches and are not normalized.
|
|
327
|
+
|
|
328
|
+
## Screen Lookup Convenience
|
|
329
|
+
|
|
330
|
+
`stitch_get_screen` and `stitch_export_screen_artifact` can resolve a screen without an exact full resource name:
|
|
331
|
+
|
|
332
|
+
- Full resource name: `screenId: "projects/{project}/screens/{screen}"`.
|
|
333
|
+
- Bare screen id: `projectId: "projects/{project}"`, `screenId: "{screen}"`.
|
|
334
|
+
- Partial title/name: `projectId: "projects/{project}"`, `screenId: "do for you"`.
|
|
335
|
+
|
|
336
|
+
Partial lookup calls `list_screens` for the project, normalizes case and whitespace, and supports substring matches against screen title, full resource name, and screen id. It only proceeds when exactly one screen matches. Multiple matches return an ambiguity error listing matching screen resource names and ids. No matches return a not-found error.
|
|
337
|
+
|
|
338
|
+
## Export Artifact Bundle
|
|
339
|
+
|
|
340
|
+
`stitch_export_screen_artifact` writes a coding-agent-friendly bundle:
|
|
341
|
+
|
|
342
|
+
- `raw.json`: full original Stitch response payload.
|
|
343
|
+
- `screen-summary.md`: title, ids, purpose, screen metadata, and notable sections/suggestions when available.
|
|
344
|
+
- `implementation-context.md`: build notes for coding agents, including layout, component/content hints, interaction notes, linked assets, and design tokens when present.
|
|
345
|
+
- `implementation-plan.md`: inferred page/component structure, suggested build order, assumptions, accessibility notes, and responsive notes.
|
|
346
|
+
- `component-map.json`: structured map of extracted text/interactions plus inferred sections/components with provenance labels.
|
|
347
|
+
- `copy.md`: text split into confident visible UI text, possible user-facing metadata, and generation/context text that should not be treated as UI copy without confirmation.
|
|
348
|
+
- `style-notes.md`: extracted layout values, tokens, colors, typography, spacing, and clear notes when values are absent.
|
|
349
|
+
- `build-prompt.md`: ready-to-paste Codex prompt for implementing the screen from the artifact bundle.
|
|
350
|
+
- `acceptance-criteria.md`: checklist of implementation requirements and constraints.
|
|
351
|
+
- `test-plan.md`: suggested unit, component, responsive, accessibility, and e2e test coverage.
|
|
352
|
+
- `questions.md`: open questions and missing design/product details to resolve.
|
|
353
|
+
- `manifest.json`: source ids, generated timestamp, artifact paths, caller input, fetch input, and resolver metadata.
|
|
354
|
+
|
|
355
|
+
The MCP response intentionally does not include raw JSON. It returns the bundle directory, artifact paths, and a short screen summary.
|
|
356
|
+
Handoff files mark inferred items as inferred and avoid inventing precise design values when the Stitch payload does not include them.
|
|
357
|
+
|
|
358
|
+
Output location rules:
|
|
359
|
+
|
|
360
|
+
- If `artifactPath` is provided, the bundle is written directly into that workspace-relative folder. No `artifactName` nesting is added.
|
|
361
|
+
- `relativePath` remains as a legacy alias for a caller-provided bundle directory, for example `exports/manual-screen`.
|
|
362
|
+
- If no path is provided but `artifactName` is provided, the legacy fallback is `exports/{artifactName}`.
|
|
363
|
+
- If neither `artifactPath` nor `artifactName` is provided, the default is `.artifacts/stitch/{normalized-screen-title-or-screen-id}`.
|
|
364
|
+
- The base root is `PROJECT_ROOT` when set. If `PROJECT_ROOT` is not set, `STITCH_OUTPUT_DIR` remains the fallback/testing base.
|
|
365
|
+
- Empty `PROJECT_ROOT` is treated as missing. A non-empty `PROJECT_ROOT` must already exist and be a directory; invalid roots are rejected instead of being created.
|
|
366
|
+
- Absolute paths, `..`, suspicious path segments, symlink escapes, and paths outside the base root are rejected.
|
|
367
|
+
|
|
368
|
+
`manifest.json` includes `artifactPath`, `resolvedOutputDir`, `baseRoot`, `baseRootSource`, and whether `artifactPath`, `artifactName`, or default fallback was used.
|
|
369
|
+
|
|
370
|
+
Example workflow:
|
|
371
|
+
|
|
372
|
+
1. Call `stitch_list_projects` with `{}`.
|
|
373
|
+
2. Pick a returned project, for example `projects/example-project`.
|
|
374
|
+
3. Call `stitch_list_screens` with `{ "projectId": "projects/example-project" }`.
|
|
375
|
+
4. Optionally inspect a screen by partial title:
|
|
376
|
+
- `stitch_get_screen` with `{ "projectId": "projects/example-project", "screenId": "settings" }`.
|
|
377
|
+
5. Export a bundle by partial title:
|
|
378
|
+
- `stitch_export_screen_artifact` with {
|
|
379
|
+
"projectId": "projects/example-project",
|
|
380
|
+
"screenId": "settings",
|
|
381
|
+
"artifactPath": ".artifacts/features/settings/design"
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
- Response shape notes:
|
|
385
|
+
- JSON-RPC success envelope is often returned even when the tool fails logically.
|
|
386
|
+
- Logical tool failures are signaled by result.isError = true and text in result.content[].text.
|
|
387
|
+
|
|
388
|
+
- Rate limit / quota headers:
|
|
389
|
+
- no x-ratelimit-* or retry-after headers were observed in tested calls.
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mcp-stitch",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for Google Stitch.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mcp-stitch": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"docs/stitch-tools.md",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "tsx src/index.ts",
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"prepack": "npm run build",
|
|
18
|
+
"start": "node dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"mcp",
|
|
22
|
+
"model-context-protocol",
|
|
23
|
+
"stitch",
|
|
24
|
+
"google-stitch",
|
|
25
|
+
"vscode"
|
|
26
|
+
],
|
|
27
|
+
"author": "",
|
|
28
|
+
"license": "ISC",
|
|
29
|
+
"type": "module",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
32
|
+
"dotenv": "^17.4.2",
|
|
33
|
+
"zod": "^4.4.3"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^26.0.1",
|
|
37
|
+
"tsx": "^4.22.4",
|
|
38
|
+
"typescript": "^6.0.3"
|
|
39
|
+
}
|
|
40
|
+
}
|