google-stitch-mcp 0.3.2
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 +212 -0
- package/README.md +439 -0
- package/bin/stitch-mcp.js +2 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +130810 -0
- package/dist/commands/doctor/command.d.ts +2 -0
- package/dist/commands/doctor/context.d.ts +19 -0
- package/dist/commands/doctor/handler.d.ts +12 -0
- package/dist/commands/doctor/spec.d.ts +130 -0
- package/dist/commands/doctor/steps/AdcCheckStep.d.ts +8 -0
- package/dist/commands/doctor/steps/ApiCheckStep.d.ts +8 -0
- package/dist/commands/doctor/steps/ApiKeyConnectionStep.d.ts +8 -0
- package/dist/commands/doctor/steps/ApiKeyDetectedStep.d.ts +8 -0
- package/dist/commands/doctor/steps/AuthCheckStep.d.ts +8 -0
- package/dist/commands/doctor/steps/GcloudCheckStep.d.ts +8 -0
- package/dist/commands/doctor/steps/ProjectCheckStep.d.ts +8 -0
- package/dist/commands/init/command.d.ts +2 -0
- package/dist/commands/init/context.d.ts +24 -0
- package/dist/commands/init/handler.d.ts +19 -0
- package/dist/commands/init/spec.d.ts +91 -0
- package/dist/commands/init/steps/AuthModeStep.d.ts +8 -0
- package/dist/commands/init/steps/AuthStep.d.ts +8 -0
- package/dist/commands/init/steps/ClientSelectionStep.d.ts +9 -0
- package/dist/commands/init/steps/ConfigStep.d.ts +9 -0
- package/dist/commands/init/steps/GcloudInstallStep.d.ts +8 -0
- package/dist/commands/init/steps/IamApiStep.d.ts +8 -0
- package/dist/commands/init/steps/ProjectSelectStep.d.ts +8 -0
- package/dist/commands/init/steps/TestConnectionStep.d.ts +8 -0
- package/dist/commands/init/steps/TransportStep.d.ts +9 -0
- package/dist/commands/logout/command.d.ts +2 -0
- package/dist/commands/logout/context.d.ts +12 -0
- package/dist/commands/logout/handler.d.ts +8 -0
- package/dist/commands/logout/spec.d.ts +77 -0
- package/dist/commands/logout/steps/ClearConfigStep.d.ts +8 -0
- package/dist/commands/logout/steps/PrepareStep.d.ts +8 -0
- package/dist/commands/logout/steps/RevokeAdcStep.d.ts +9 -0
- package/dist/commands/logout/steps/RevokeUserStep.d.ts +9 -0
- package/dist/commands/proxy/command.d.ts +2 -0
- package/dist/commands/proxy/handler.d.ts +7 -0
- package/dist/commands/registry.d.ts +2 -0
- package/dist/commands/screens/ScreensView.d.ts +16 -0
- package/dist/commands/screens/command.d.ts +2 -0
- package/dist/commands/screens/handler.d.ts +24 -0
- package/dist/commands/serve/ServeView.d.ts +12 -0
- package/dist/commands/serve/command.d.ts +2 -0
- package/dist/commands/serve/handler.d.ts +22 -0
- package/dist/commands/site/command.d.ts +2 -0
- package/dist/commands/site/hooks/useProjectHydration.d.ts +9 -0
- package/dist/commands/site/index.d.ts +12 -0
- package/dist/commands/site/ui/ScreenList.d.ts +11 -0
- package/dist/commands/site/ui/SiteBuilder.d.ts +10 -0
- package/dist/commands/site/ui/components/StatusIcon.d.ts +6 -0
- package/dist/commands/site/ui/types.d.ts +1 -0
- package/dist/commands/site/utils/ProjectSyncer.d.ts +8 -0
- package/dist/commands/site/utils/SiteManifest.d.ts +16 -0
- package/dist/commands/snapshot/command.d.ts +2 -0
- package/dist/commands/snapshot/handler.d.ts +17 -0
- package/dist/commands/snapshot/spec.d.ts +39 -0
- package/dist/commands/tool/command.d.ts +2 -0
- package/dist/commands/tool/context.d.ts +9 -0
- package/dist/commands/tool/handler.d.ts +9 -0
- package/dist/commands/tool/spec.d.ts +39 -0
- package/dist/commands/tool/steps/ExecuteToolStep.d.ts +8 -0
- package/dist/commands/tool/steps/ListToolsStep.d.ts +8 -0
- package/dist/commands/tool/steps/ParseArgsStep.d.ts +8 -0
- package/dist/commands/tool/steps/ShowSchemaStep.d.ts +10 -0
- package/dist/commands/tool/steps/ValidateToolStep.d.ts +8 -0
- package/dist/commands/tool/virtual-tools/build-site.d.ts +2 -0
- package/dist/commands/tool/virtual-tools/get-screen-code.d.ts +2 -0
- package/dist/commands/tool/virtual-tools/get-screen-image.d.ts +2 -0
- package/dist/commands/tool/virtual-tools/index.d.ts +7 -0
- package/dist/commands/tool/virtual-tools/list-tools.d.ts +2 -0
- package/dist/commands/view/command.d.ts +2 -0
- package/dist/commands/view/handler.d.ts +14 -0
- package/dist/framework/CommandDefinition.d.ts +18 -0
- package/dist/framework/CommandStep.d.ts +15 -0
- package/dist/framework/ConsoleUI.d.ts +14 -0
- package/dist/framework/MockUI.d.ts +16 -0
- package/dist/framework/StepRunner.d.ts +20 -0
- package/dist/framework/UserInterface.d.ts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +23583 -0
- package/dist/lib/server/AssetGateway.d.ts +25 -0
- package/dist/lib/server/vite/StitchViteServer.d.ts +11 -0
- package/dist/lib/server/vite/plugins/virtualContent.d.ts +7 -0
- package/dist/lib/services/site/SiteService.d.ts +6 -0
- package/dist/lib/services/site/schemas.d.ts +91 -0
- package/dist/lib/services/site/types.d.ts +22 -0
- package/dist/platform/detector.d.ts +29 -0
- package/dist/platform/environment.d.ts +13 -0
- package/dist/platform/paths.d.ts +20 -0
- package/dist/platform/shell.d.ts +30 -0
- package/dist/services/gcloud/handler.d.ts +57 -0
- package/dist/services/gcloud/spec.d.ts +408 -0
- package/dist/services/mcp-client/MockStitchMCPClient.d.ts +7 -0
- package/dist/services/mcp-client/client.d.ts +79 -0
- package/dist/services/mcp-client/spec.d.ts +27 -0
- package/dist/services/mcp-config/handler.d.ts +13 -0
- package/dist/services/mcp-config/spec.d.ts +108 -0
- package/dist/services/project/handler.d.ts +11 -0
- package/dist/services/project/spec.d.ts +86 -0
- package/dist/services/proxy/handler.d.ts +26 -0
- package/dist/services/proxy/spec.d.ts +83 -0
- package/dist/services/stitch/handler.d.ts +17 -0
- package/dist/services/stitch/spec.d.ts +279 -0
- package/dist/services/view/handler.d.ts +7 -0
- package/dist/services/view/spec.d.ts +66 -0
- package/dist/ui/InteractiveViewer.d.ts +17 -0
- package/dist/ui/JsonTree.d.ts +12 -0
- package/dist/ui/checklist/handler.d.ts +23 -0
- package/dist/ui/checklist/spec.d.ts +191 -0
- package/dist/ui/checklist.d.ts +54 -0
- package/dist/ui/copy-behaviors/clipboard.d.ts +32 -0
- package/dist/ui/copy-behaviors/handlers.d.ts +16 -0
- package/dist/ui/copy-behaviors/index.d.ts +8 -0
- package/dist/ui/copy-behaviors/registry.d.ts +24 -0
- package/dist/ui/copy-behaviors/types.d.ts +26 -0
- package/dist/ui/navigation-behaviors/index.d.ts +34 -0
- package/dist/ui/serve-behaviors/handlers.d.ts +9 -0
- package/dist/ui/serve-behaviors/index.d.ts +7 -0
- package/dist/ui/serve-behaviors/registry.d.ts +10 -0
- package/dist/ui/serve-behaviors/server.d.ts +8 -0
- package/dist/ui/serve-behaviors/types.d.ts +18 -0
- package/dist/ui/spinner.d.ts +11 -0
- package/dist/ui/theme.d.ts +18 -0
- package/dist/ui/wizard.d.ts +36 -0
- package/package.json +83 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of exercising or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 David East
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
DISCLAIMER
|
|
195
|
+
|
|
196
|
+
This project is an independent, experimental tool created by David East.
|
|
197
|
+
It is NOT affiliated with, endorsed by, or sponsored by Google LLC, Alphabet Inc.,
|
|
198
|
+
or the Stitch API team.
|
|
199
|
+
|
|
200
|
+
"Stitch" and "Google Cloud" are trademarks of Google LLC. Use of these names
|
|
201
|
+
is for identification purposes only and does not imply any association with
|
|
202
|
+
or endorsement by Google.
|
|
203
|
+
|
|
204
|
+
This software is provided AS-IS with NO WARRANTIES of any kind. The author
|
|
205
|
+
makes no guarantees about:
|
|
206
|
+
- Continued maintenance or support
|
|
207
|
+
- Compatibility with future versions of the Stitch API
|
|
208
|
+
- Fitness for any particular purpose
|
|
209
|
+
- Security or reliability
|
|
210
|
+
|
|
211
|
+
USE AT YOUR OWN RISK. The author is not responsible for any damages, data loss,
|
|
212
|
+
or issues arising from the use of this software.
|
package/README.md
ADDED
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
# stitch-mcp
|
|
2
|
+
|
|
3
|
+
A CLI for moving AI-generated UI designs into your development workflow — preview them locally, build sites from them, and feed them to coding agents.
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
AI-generated designs in Google's Stitch platform live as HTML/CSS behind an API. Getting them into a local development environment — for previewing, building, or handing off to coding agents — requires fetching, serving, and structuring them. stitch-mcp handles this through a set of CLI commands that connect to Stitch.
|
|
8
|
+
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Set up authentication and MCP client config
|
|
13
|
+
npx @_davideast/stitch-mcp init
|
|
14
|
+
|
|
15
|
+
# Serve all project screens on a local dev server
|
|
16
|
+
npx @_davideast/stitch-mcp serve -p <project-id>
|
|
17
|
+
|
|
18
|
+
# Build an Astro site by mapping screens to routes
|
|
19
|
+
npx @_davideast/stitch-mcp site -p <project-id>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- **Local dev server** — `serve` runs a Vite server with all screens from a project
|
|
25
|
+
- **Site generation** — `site` builds an Astro project from screen-to-route mappings
|
|
26
|
+
- **MCP proxy** — `proxy` bridges your IDE's coding agent to Stitch tools with automatic token refresh
|
|
27
|
+
- **Virtual tools** — `build_site`, `get_screen_code`, `get_screen_image` give agents direct access to design HTML and screenshots
|
|
28
|
+
- **Interactive browser** — `view` navigates projects and screens in the terminal
|
|
29
|
+
- **Guided setup** — `init` handles gcloud, auth, and MCP client configuration
|
|
30
|
+
|
|
31
|
+
## MCP integration
|
|
32
|
+
|
|
33
|
+
Add this to your MCP client config to give coding agents access to Stitch tools and virtual tools:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"mcpServers": {
|
|
38
|
+
"stitch": {
|
|
39
|
+
"command": "npx",
|
|
40
|
+
"args": ["@_davideast/stitch-mcp", "proxy"]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Supported clients: VS Code, Cursor, Claude Code, Gemini CLI, Codex, OpenCode.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
Run directly with `npx` (no install needed):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx @_davideast/stitch-mcp <command>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or install globally:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install -g @_davideast/stitch-mcp
|
|
62
|
+
stitch-mcp <command>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Commands
|
|
66
|
+
|
|
67
|
+
### `init` — Set up authentication and MCP config
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx @_davideast/stitch-mcp init [options]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
| Option | Description |
|
|
74
|
+
|--------|-------------|
|
|
75
|
+
| `--local` | Install gcloud locally to project directory instead of user home |
|
|
76
|
+
| `-y, --yes` | Auto-approve verification prompts |
|
|
77
|
+
| `--defaults` | Use default values for prompts |
|
|
78
|
+
| `-c, --client <client>` | MCP client to configure (antigravity, vscode, cursor, claude-code, gemini-cli, codex, opencode) |
|
|
79
|
+
| `-t, --transport <type>` | Transport type (`http` or `stdio`) |
|
|
80
|
+
|
|
81
|
+
Walks through a setup wizard: MCP client selection, gcloud installation, OAuth login, application credentials, project selection, IAM permissions, Stitch API enablement, connection test, and config generation.
|
|
82
|
+
|
|
83
|
+
### `doctor` — Verify configuration health
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npx @_davideast/stitch-mcp doctor [options]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
| Option | Description |
|
|
90
|
+
|--------|-------------|
|
|
91
|
+
| `--verbose` | Show detailed error information |
|
|
92
|
+
|
|
93
|
+
Checks that gcloud is installed, user is authenticated, Application Default Credentials exist, a GCP project is configured, and the Stitch API is reachable.
|
|
94
|
+
|
|
95
|
+
### `serve` — Local dev server for project screens
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx @_davideast/stitch-mcp serve -p <project-id>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
| Option | Description |
|
|
102
|
+
|--------|-------------|
|
|
103
|
+
| `-p, --project <id>` | **Required.** Project ID |
|
|
104
|
+
|
|
105
|
+
Fetches all screens from a Stitch project and serves them on a local Vite dev server. Each screen gets its own route for previewing rendered HTML in the browser.
|
|
106
|
+
|
|
107
|
+
### `screens` — Explore screens in a project
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx @_davideast/stitch-mcp screens -p <project-id>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
| Option | Description |
|
|
114
|
+
|--------|-------------|
|
|
115
|
+
| `-p, --project <id>` | **Required.** Project ID |
|
|
116
|
+
|
|
117
|
+
Opens an interactive terminal UI for browsing all screens in a project.
|
|
118
|
+
|
|
119
|
+
### `site` — Build an Astro site from screens
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
npx @_davideast/stitch-mcp site -p <project-id> [options]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
| Option | Description |
|
|
126
|
+
|--------|-------------|
|
|
127
|
+
| `-p, --project <id>` | **Required.** Project ID |
|
|
128
|
+
| `-o, --output <dir>` | Output directory (default: `.`) |
|
|
129
|
+
| `-e, --export` | Export screen-to-route config as `build_site` JSON (no interactive UI) |
|
|
130
|
+
|
|
131
|
+
Launches an interactive screen-to-route mapper, then generates an Astro project with the following structure:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
├── package.json
|
|
135
|
+
├── astro.config.mjs
|
|
136
|
+
└── src/
|
|
137
|
+
├── layouts/Layout.astro
|
|
138
|
+
└── pages/
|
|
139
|
+
├── index.astro # screen mapped to "/"
|
|
140
|
+
└── about.astro # screen mapped to "/about"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
External assets (fonts, images) are downloaded to `public/assets/` with URLs rewritten to local paths.
|
|
144
|
+
|
|
145
|
+
Press `e` in the interactive builder to export the current screen-to-route config as JSON to stdout (useful for piping into `build_site`).
|
|
146
|
+
|
|
147
|
+
### `view` — Interactive resource browser
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npx @_davideast/stitch-mcp view [options]
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
| Option | Description |
|
|
154
|
+
|--------|-------------|
|
|
155
|
+
| `--projects` | List all projects |
|
|
156
|
+
| `--name <name>` | Resource name to view |
|
|
157
|
+
| `--sourceScreen <name>` | Source screen resource name |
|
|
158
|
+
| `--project <id>` | Project ID |
|
|
159
|
+
| `--screen <id>` | Screen ID |
|
|
160
|
+
| `--serve` | Serve the screen via local server |
|
|
161
|
+
|
|
162
|
+
Browse Stitch resources in a navigable JSON tree. Supports drilling into nested objects and performing actions on selected nodes.
|
|
163
|
+
|
|
164
|
+
**Keyboard shortcuts:**
|
|
165
|
+
|
|
166
|
+
| Key | Action |
|
|
167
|
+
|-----|--------|
|
|
168
|
+
| `↑` / `↓` | Navigate up/down |
|
|
169
|
+
| `Enter` | Expand/collapse or drill into nested object |
|
|
170
|
+
| `Backspace` | Go back one level |
|
|
171
|
+
| `c` | Copy selected value to clipboard |
|
|
172
|
+
| `cc` | Extended copy (downloads content for URLs) |
|
|
173
|
+
| `s` | Preview HTML — serves `htmlCode` in-memory and opens browser |
|
|
174
|
+
| `o` | Open project in Stitch web app |
|
|
175
|
+
| `q` | Quit viewer |
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# Browse all projects
|
|
179
|
+
npx @_davideast/stitch-mcp view --projects
|
|
180
|
+
|
|
181
|
+
# View a specific screen
|
|
182
|
+
npx @_davideast/stitch-mcp view --project <project-id> --screen <screen-id>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### `tool` — Invoke MCP tools directly
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npx @_davideast/stitch-mcp tool [toolName] [options]
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
| Option | Description |
|
|
192
|
+
|--------|-------------|
|
|
193
|
+
| `-s, --schema` | Show tool arguments and schema |
|
|
194
|
+
| `-d, --data <json>` | JSON data (like `curl -d`) |
|
|
195
|
+
| `-f, --data-file <path>` | Read JSON from file (like `curl -d @file`) |
|
|
196
|
+
| `-o, --output <format>` | Output format: `json`, `pretty`, `raw` (default: `pretty`) |
|
|
197
|
+
|
|
198
|
+
Calls any MCP tool (including virtual tools) from the command line. Run without a tool name to list available tools.
|
|
199
|
+
|
|
200
|
+
**Virtual tools:**
|
|
201
|
+
|
|
202
|
+
These tools are not part of the upstream Stitch MCP server. They are added by the proxy and combine multiple API calls into higher-level operations for coding agents.
|
|
203
|
+
|
|
204
|
+
- **`build_site`** — Builds a site from a project by mapping screens to routes. Returns the design HTML for each page.
|
|
205
|
+
- **`get_screen_code`** — Retrieves a screen and downloads its HTML code content.
|
|
206
|
+
- **`get_screen_image`** — Retrieves a screen and downloads its screenshot image as base64.
|
|
207
|
+
|
|
208
|
+
`build_site` input schema:
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
{
|
|
212
|
+
"projectId": "string (required)",
|
|
213
|
+
"routes": [
|
|
214
|
+
{
|
|
215
|
+
"screenId": "string (required)",
|
|
216
|
+
"route": "string (required, e.g. \"/\" or \"/about\")"
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Example:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
npx @_davideast/stitch-mcp tool build_site -d '{
|
|
226
|
+
"projectId": "123456",
|
|
227
|
+
"routes": [
|
|
228
|
+
{ "screenId": "abc", "route": "/" },
|
|
229
|
+
{ "screenId": "def", "route": "/about" }
|
|
230
|
+
]
|
|
231
|
+
}'
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### `proxy` — MCP proxy server
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
npx @_davideast/stitch-mcp proxy [options]
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
| Option | Description |
|
|
241
|
+
|--------|-------------|
|
|
242
|
+
| `--transport <type>` | Transport type: `stdio` or `sse` (default: `stdio`) |
|
|
243
|
+
| `--port <number>` | Port number (required for `sse`) |
|
|
244
|
+
| `--debug` | Enable debug logging to `/tmp/stitch-proxy-debug.log` |
|
|
245
|
+
|
|
246
|
+
Proxies requests between your MCP client and the Stitch MCP server. Handles automatic token refresh and exposes virtual tools alongside the upstream tools.
|
|
247
|
+
|
|
248
|
+
**STDIO config (default):**
|
|
249
|
+
|
|
250
|
+
```json
|
|
251
|
+
{
|
|
252
|
+
"mcpServers": {
|
|
253
|
+
"stitch": {
|
|
254
|
+
"command": "npx",
|
|
255
|
+
"args": ["@_davideast/stitch-mcp", "proxy"]
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**SSE config:**
|
|
262
|
+
|
|
263
|
+
```json
|
|
264
|
+
{
|
|
265
|
+
"mcpServers": {
|
|
266
|
+
"stitch": {
|
|
267
|
+
"command": "npx",
|
|
268
|
+
"args": ["@_davideast/stitch-mcp", "proxy", "--transport", "sse", "--port", "3100"]
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### `logout` — Revoke credentials
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
npx @_davideast/stitch-mcp logout [options]
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
| Option | Description |
|
|
281
|
+
|--------|-------------|
|
|
282
|
+
| `--force` | Skip confirmation prompts |
|
|
283
|
+
| `--clear-config` | Delete entire gcloud config directory |
|
|
284
|
+
|
|
285
|
+
Revokes both user authentication and Application Default Credentials.
|
|
286
|
+
|
|
287
|
+
### `snapshot` — Create UI snapshots
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
npx @_davideast/stitch-mcp snapshot [options]
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
| Option | Description |
|
|
294
|
+
|--------|-------------|
|
|
295
|
+
| `-c, --command <command>` | The command to snapshot (e.g. `init`) |
|
|
296
|
+
| `-d, --data <file>` | Path to JSON data file |
|
|
297
|
+
| `-s, --schema` | Print the data schema for the command |
|
|
298
|
+
|
|
299
|
+
Creates UI snapshots of CLI commands given a data state. Useful for testing and documentation.
|
|
300
|
+
|
|
301
|
+
## Authentication
|
|
302
|
+
|
|
303
|
+
**Automatic (recommended):** Run `init` and follow the wizard. It handles gcloud installation, OAuth, credentials, and project setup.
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
npx @_davideast/stitch-mcp init
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**API key:** Set the `STITCH_API_KEY` environment variable to skip OAuth entirely.
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
export STITCH_API_KEY="your-api-key"
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
**Manual (existing gcloud):** If you already have gcloud configured:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
gcloud auth application-default login
|
|
319
|
+
gcloud config set project <PROJECT_ID>
|
|
320
|
+
gcloud beta services mcp enable stitch.googleapis.com --project=<PROJECT_ID>
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Then use the proxy with `STITCH_USE_SYSTEM_GCLOUD=1`:
|
|
324
|
+
|
|
325
|
+
```json
|
|
326
|
+
{
|
|
327
|
+
"mcpServers": {
|
|
328
|
+
"stitch": {
|
|
329
|
+
"command": "npx",
|
|
330
|
+
"args": ["@_davideast/stitch-mcp", "proxy"],
|
|
331
|
+
"env": {
|
|
332
|
+
"STITCH_USE_SYSTEM_GCLOUD": "1"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Environment variables
|
|
340
|
+
|
|
341
|
+
| Variable | Description |
|
|
342
|
+
|----------|-------------|
|
|
343
|
+
| `STITCH_API_KEY` | API key for direct authentication (skips OAuth) |
|
|
344
|
+
| `STITCH_ACCESS_TOKEN` | Pre-existing access token |
|
|
345
|
+
| `STITCH_USE_SYSTEM_GCLOUD` | Use system gcloud config instead of isolated config |
|
|
346
|
+
| `STITCH_PROJECT_ID` | Override project ID |
|
|
347
|
+
| `GOOGLE_CLOUD_PROJECT` | Alternative project ID variable |
|
|
348
|
+
| `STITCH_HOST` | Custom Stitch API endpoint |
|
|
349
|
+
|
|
350
|
+
## Troubleshooting
|
|
351
|
+
|
|
352
|
+
### "Permission Denied" errors
|
|
353
|
+
|
|
354
|
+
Ensure:
|
|
355
|
+
- You have Owner or Editor role on the GCP project
|
|
356
|
+
- Billing is enabled on your project
|
|
357
|
+
- Stitch API is enabled
|
|
358
|
+
|
|
359
|
+
Run `doctor` to diagnose:
|
|
360
|
+
```bash
|
|
361
|
+
npx @_davideast/stitch-mcp doctor --verbose
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Authentication URL not appearing
|
|
365
|
+
|
|
366
|
+
The tool prints authentication URLs to the terminal with a 5-second timeout. If the URL doesn't appear:
|
|
367
|
+
|
|
368
|
+
1. Check your terminal output carefully
|
|
369
|
+
2. The URL starts with `https://accounts.google.com`
|
|
370
|
+
3. If using proxy with `--debug`, check `/tmp/stitch-proxy-debug.log`
|
|
371
|
+
|
|
372
|
+
### Already authenticated but showing logged in
|
|
373
|
+
|
|
374
|
+
The bundled gcloud SDK maintains separate authentication from your global gcloud installation. To fully clear authentication:
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
npx @_davideast/stitch-mcp logout --force --clear-config
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### API connection fails after setup
|
|
381
|
+
|
|
382
|
+
1. Run the doctor command:
|
|
383
|
+
```bash
|
|
384
|
+
npx @_davideast/stitch-mcp doctor --verbose
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
2. Verify your project has billing enabled
|
|
388
|
+
|
|
389
|
+
3. Check that Stitch API is enabled:
|
|
390
|
+
```bash
|
|
391
|
+
gcloud services list --enabled | grep stitch
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
4. Try re-authenticating:
|
|
395
|
+
```bash
|
|
396
|
+
npx @_davideast/stitch-mcp logout --force
|
|
397
|
+
npx @_davideast/stitch-mcp init
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### WSL / SSH / Docker environments
|
|
401
|
+
|
|
402
|
+
The CLI detects WSL, SSH sessions, Docker containers, and Cloud Shell. In these environments, browser-based auth may not work automatically. Copy the OAuth URL from your terminal and open it in a browser manually.
|
|
403
|
+
|
|
404
|
+
## Development
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
# Install dependencies
|
|
408
|
+
bun install
|
|
409
|
+
|
|
410
|
+
# Run locally
|
|
411
|
+
bun run dev init
|
|
412
|
+
|
|
413
|
+
# Run tests
|
|
414
|
+
bun test
|
|
415
|
+
|
|
416
|
+
# Build
|
|
417
|
+
bun run build
|
|
418
|
+
|
|
419
|
+
# Verify package
|
|
420
|
+
bun run verify-pack
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
## License
|
|
424
|
+
|
|
425
|
+
Apache 2.0 © David East
|
|
426
|
+
|
|
427
|
+
## Disclaimer
|
|
428
|
+
|
|
429
|
+
> [!WARNING]
|
|
430
|
+
> **Experimental Project** - This is an independent, experimental tool.
|
|
431
|
+
|
|
432
|
+
This project is:
|
|
433
|
+
- **NOT** affiliated with, endorsed by, or sponsored by Google LLC, Alphabet Inc., or the Stitch API team
|
|
434
|
+
- Provided **AS-IS** with **NO WARRANTIES** of any kind
|
|
435
|
+
- **NOT** guaranteed to be maintained, secure, or compatible with future API versions
|
|
436
|
+
|
|
437
|
+
"Stitch" and "Google Cloud" are trademarks of Google LLC.
|
|
438
|
+
|
|
439
|
+
**USE AT YOUR OWN RISK.**
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|