@_davideast/stitch-mcp 0.2.1 → 0.3.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 +222 -193
- package/dist/cli.js +2465 -1617
- package/dist/commands/doctor/context.d.ts +2 -0
- package/dist/commands/doctor/handler.d.ts +3 -1
- package/dist/commands/doctor/steps/ApiKeyConnectionStep.d.ts +8 -0
- package/dist/commands/doctor/steps/ApiKeyDetectedStep.d.ts +8 -0
- package/dist/commands/init/handler.d.ts +3 -1
- package/dist/commands/site/hooks/useProjectHydration.d.ts +2 -2
- package/dist/commands/site/index.d.ts +3 -0
- package/dist/commands/site/ui/ScreenList.d.ts +5 -2
- package/dist/commands/site/ui/components/StatusIcon.d.ts +1 -4
- package/dist/commands/site/ui/types.d.ts +1 -6
- 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/context.d.ts +9 -0
- package/dist/commands/tool/handler.d.ts +4 -6
- package/dist/commands/tool/spec.d.ts +4 -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/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 +6 -0
- package/dist/commands/view/handler.d.ts +14 -0
- package/dist/framework/MockUI.d.ts +16 -0
- package/dist/framework/StepRunner.d.ts +20 -0
- package/dist/index.js +666 -90
- package/dist/lib/server/AssetGateway.d.ts +1 -0
- package/dist/lib/services/site/SiteService.d.ts +2 -6
- package/dist/lib/services/site/schemas.d.ts +0 -53
- package/dist/lib/services/site/types.d.ts +8 -2
- package/dist/platform/shell.d.ts +4 -0
- package/dist/services/gcloud/handler.d.ts +4 -0
- package/dist/services/mcp-client/MockStitchMCPClient.d.ts +7 -0
- package/dist/services/proxy/handler.d.ts +11 -0
- package/dist/services/stitch/handler.d.ts +3 -1
- package/dist/services/stitch/spec.d.ts +12 -0
- package/package.json +2 -1
- package/dist/commands/site/ui/DetailPane.d.ts +0 -10
- package/dist/commands/tool/virtual-tools.d.ts +0 -6
package/README.md
CHANGED
|
@@ -1,154 +1,164 @@
|
|
|
1
|
-
#
|
|
1
|
+
# stitch-mcp
|
|
2
2
|
|
|
3
|
-
|
|
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
4
|
|
|
5
|
-
|
|
5
|
+
## Why
|
|
6
6
|
|
|
7
|
-
|
|
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
|
|
8
10
|
|
|
9
11
|
```bash
|
|
12
|
+
# Set up authentication and MCP client config
|
|
10
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>
|
|
11
20
|
```
|
|
12
21
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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:
|
|
21
34
|
|
|
22
|
-
**Example output:**
|
|
23
35
|
```json
|
|
24
36
|
{
|
|
25
37
|
"mcpServers": {
|
|
26
38
|
"stitch": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"X-Goog-Api-Key": "YOUR-API-KEY"
|
|
30
|
-
}
|
|
39
|
+
"command": "npx",
|
|
40
|
+
"args": ["@_davideast/stitch-mcp", "proxy"]
|
|
31
41
|
}
|
|
32
42
|
}
|
|
33
43
|
}
|
|
34
44
|
```
|
|
35
45
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## Verify Your Setup
|
|
46
|
+
Supported clients: VS Code, Cursor, Claude Code, Gemini CLI, Codex, OpenCode.
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
npx @_davideast/stitch-mcp doctor
|
|
42
|
-
```
|
|
48
|
+
---
|
|
43
49
|
|
|
44
|
-
|
|
45
|
-
- ✔ Google Cloud CLI installation
|
|
46
|
-
- ✔ User authentication
|
|
47
|
-
- ✔ Application credentials
|
|
48
|
-
- ✔ Project configuration
|
|
49
|
-
- ✔ Stitch API connectivity
|
|
50
|
+
## Installation
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
Run directly with `npx` (no install needed):
|
|
52
53
|
|
|
53
54
|
```bash
|
|
54
|
-
npx @_davideast/stitch-mcp
|
|
55
|
+
npx @_davideast/stitch-mcp <command>
|
|
56
|
+
```
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
npx @_davideast/stitch-mcp logout --force
|
|
58
|
+
Or install globally:
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
```bash
|
|
61
|
+
npm install -g @_davideast/stitch-mcp
|
|
62
|
+
stitch-mcp <command>
|
|
61
63
|
```
|
|
62
64
|
|
|
63
|
-
##
|
|
65
|
+
## Commands
|
|
64
66
|
|
|
65
|
-
###
|
|
66
|
-
|
|
67
|
-
Can be configured with `npx` or installed globally.
|
|
67
|
+
### `init` — Set up authentication and MCP config
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
npx @_davideast/stitch-mcp init
|
|
70
|
+
npx @_davideast/stitch-mcp init [options]
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
|
|
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
|
|
74
84
|
|
|
75
85
|
```bash
|
|
76
|
-
|
|
77
|
-
stitch-mcp init
|
|
86
|
+
npx @_davideast/stitch-mcp doctor [options]
|
|
78
87
|
```
|
|
79
88
|
|
|
80
|
-
|
|
89
|
+
| Option | Description |
|
|
90
|
+
|--------|-------------|
|
|
91
|
+
| `--verbose` | Show detailed error information |
|
|
81
92
|
|
|
82
|
-
|
|
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
|
|
83
96
|
|
|
84
97
|
```bash
|
|
85
|
-
npx @_davideast/stitch-mcp
|
|
98
|
+
npx @_davideast/stitch-mcp serve -p <project-id>
|
|
86
99
|
```
|
|
87
100
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
1. **MCP Client Selection** - Choose your IDE/CLI
|
|
96
|
-
2. **gcloud Setup** - Install or detect Google Cloud CLI
|
|
97
|
-
3. **User Authentication** - OAuth login flow
|
|
98
|
-
4. **Application Credentials** - API-level authentication
|
|
99
|
-
5. **Project Selection** - Interactive picker with search
|
|
100
|
-
6. **IAM Configuration** - Set up required permissions
|
|
101
|
-
7. **API Enablement** - Enable Stitch API
|
|
102
|
-
8. **Connection Test** - Verify API access
|
|
103
|
-
9. **Config Generation** - Output ready-to-use MCP config
|
|
104
|
-
|
|
105
|
-
#### `doctor` - Health Checks
|
|
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
|
|
106
108
|
|
|
107
109
|
```bash
|
|
108
|
-
npx @_davideast/stitch-mcp
|
|
110
|
+
npx @_davideast/stitch-mcp screens -p <project-id>
|
|
109
111
|
```
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
| Option | Description |
|
|
114
|
+
|--------|-------------|
|
|
115
|
+
| `-p, --project <id>` | **Required.** Project ID |
|
|
113
116
|
|
|
114
|
-
|
|
115
|
-
- Google Cloud CLI is installed and accessible
|
|
116
|
-
- User is authenticated
|
|
117
|
-
- Application Default Credentials exist
|
|
118
|
-
- Active GCP project is configured
|
|
119
|
-
- Stitch API is reachable
|
|
117
|
+
Opens an interactive terminal UI for browsing all screens in a project.
|
|
120
118
|
|
|
121
|
-
|
|
119
|
+
### `site` — Build an Astro site from screens
|
|
122
120
|
|
|
123
121
|
```bash
|
|
124
|
-
npx @_davideast/stitch-mcp
|
|
122
|
+
npx @_davideast/stitch-mcp site -p <project-id> [options]
|
|
125
123
|
```
|
|
126
124
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
| Option | Description |
|
|
126
|
+
|--------|-------------|
|
|
127
|
+
| `-p, --project <id>` | **Required.** Project ID |
|
|
128
|
+
| `-o, --output <dir>` | Output directory (default: `.`) |
|
|
130
129
|
|
|
131
|
-
|
|
132
|
-
- Switching Google accounts
|
|
133
|
-
- Clearing authentication for testing
|
|
134
|
-
- Resetting state when troubleshooting
|
|
130
|
+
Launches an interactive screen-to-route mapper, then generates an Astro project with the following structure:
|
|
135
131
|
|
|
136
|
-
|
|
132
|
+
```
|
|
133
|
+
├── package.json
|
|
134
|
+
├── astro.config.mjs
|
|
135
|
+
└── src/
|
|
136
|
+
├── layouts/Layout.astro
|
|
137
|
+
└── pages/
|
|
138
|
+
├── index.astro # screen mapped to "/"
|
|
139
|
+
└── about.astro # screen mapped to "/about"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
External assets (fonts, images) are downloaded to `public/assets/` with URLs rewritten to local paths.
|
|
143
|
+
|
|
144
|
+
### `view` — Interactive resource browser
|
|
137
145
|
|
|
138
146
|
```bash
|
|
139
147
|
npx @_davideast/stitch-mcp view [options]
|
|
140
148
|
```
|
|
141
149
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
150
|
+
| Option | Description |
|
|
151
|
+
|--------|-------------|
|
|
152
|
+
| `--projects` | List all projects |
|
|
153
|
+
| `--name <name>` | Resource name to view |
|
|
154
|
+
| `--sourceScreen <name>` | Source screen resource name |
|
|
155
|
+
| `--project <id>` | Project ID |
|
|
156
|
+
| `--screen <id>` | Screen ID |
|
|
157
|
+
| `--serve` | Serve the screen via local server |
|
|
148
158
|
|
|
149
|
-
|
|
159
|
+
Browse Stitch resources in a navigable JSON tree. Supports drilling into nested objects and performing actions on selected nodes.
|
|
150
160
|
|
|
151
|
-
**Keyboard
|
|
161
|
+
**Keyboard shortcuts:**
|
|
152
162
|
|
|
153
163
|
| Key | Action |
|
|
154
164
|
|-----|--------|
|
|
@@ -157,23 +167,10 @@ Interactively browse Stitch resources in a navigable JSON tree. Supports drillin
|
|
|
157
167
|
| `Backspace` | Go back one level |
|
|
158
168
|
| `c` | Copy selected value to clipboard |
|
|
159
169
|
| `cc` | Extended copy (downloads content for URLs) |
|
|
160
|
-
| `s` |
|
|
170
|
+
| `s` | Preview HTML — serves `htmlCode` in-memory and opens browser |
|
|
161
171
|
| `o` | Open project in Stitch web app |
|
|
162
172
|
| `q` | Quit viewer |
|
|
163
173
|
|
|
164
|
-
**HTML Preview Feature:**
|
|
165
|
-
|
|
166
|
-
When viewing a screen, select the `htmlCode` node and press `s` to:
|
|
167
|
-
1. Download the HTML code from Stitch
|
|
168
|
-
2. Start a local server (auto-closes after 5 minutes)
|
|
169
|
-
3. Open your browser to preview the rendered HTML
|
|
170
|
-
|
|
171
|
-
```
|
|
172
|
-
Selected Path: screen.htmlCode | 'c' copy, 'cc' extended, 's' preview
|
|
173
|
-
🌐 Preview at http://127.0.0.1:54268 (auto-closes in 5 min)
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
**Example Usage:**
|
|
177
174
|
```bash
|
|
178
175
|
# Browse all projects
|
|
179
176
|
npx @_davideast/stitch-mcp view --projects
|
|
@@ -182,127 +179,146 @@ npx @_davideast/stitch-mcp view --projects
|
|
|
182
179
|
npx @_davideast/stitch-mcp view --project <project-id> --screen <screen-id>
|
|
183
180
|
```
|
|
184
181
|
|
|
185
|
-
|
|
182
|
+
### `tool` — Invoke MCP tools directly
|
|
186
183
|
|
|
187
184
|
```bash
|
|
188
|
-
npx @_davideast/stitch-mcp
|
|
185
|
+
npx @_davideast/stitch-mcp tool [toolName] [options]
|
|
189
186
|
```
|
|
190
187
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
188
|
+
| Option | Description |
|
|
189
|
+
|--------|-------------|
|
|
190
|
+
| `-s, --schema` | Show tool arguments and schema |
|
|
191
|
+
| `-d, --data <json>` | JSON data (like `curl -d`) |
|
|
192
|
+
| `-f, --data-file <path>` | Read JSON from file (like `curl -d @file`) |
|
|
193
|
+
| `-o, --output <format>` | Output format: `json`, `pretty`, `raw` (default: `pretty`) |
|
|
194
|
+
|
|
195
|
+
Calls any MCP tool (including virtual tools) from the command line. Run without a tool name to list available tools.
|
|
196
|
+
|
|
197
|
+
**Virtual tools:**
|
|
195
198
|
|
|
196
|
-
|
|
197
|
-
- Automatic token refresh
|
|
198
|
-
- Request/response proxying
|
|
199
|
-
- Error handling
|
|
200
|
-
- Debug logging (when `--debug` is enabled to `/tmp/stitch-proxy-debug.log`)
|
|
199
|
+
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.
|
|
201
200
|
|
|
202
|
-
|
|
201
|
+
- **`build_site`** — Builds a site from a project by mapping screens to routes. Returns the design HTML for each page.
|
|
202
|
+
- **`get_screen_code`** — Retrieves a screen and downloads its HTML code content.
|
|
203
|
+
- **`get_screen_image`** — Retrieves a screen and downloads its screenshot image as base64.
|
|
203
204
|
|
|
204
|
-
|
|
205
|
+
`build_site` input schema:
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"projectId": "string (required)",
|
|
210
|
+
"routes": [
|
|
211
|
+
{
|
|
212
|
+
"screenId": "string (required)",
|
|
213
|
+
"route": "string (required, e.g. \"/\" or \"/about\")"
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Example:
|
|
205
220
|
|
|
206
|
-
**Prerequisites:**
|
|
207
221
|
```bash
|
|
208
|
-
|
|
209
|
-
|
|
222
|
+
npx @_davideast/stitch-mcp tool build_site -d '{
|
|
223
|
+
"projectId": "123456",
|
|
224
|
+
"routes": [
|
|
225
|
+
{ "screenId": "abc", "route": "/" },
|
|
226
|
+
{ "screenId": "def", "route": "/about" }
|
|
227
|
+
]
|
|
228
|
+
}'
|
|
229
|
+
```
|
|
210
230
|
|
|
211
|
-
|
|
212
|
-
gcloud config set project <PROJECT_ID>
|
|
231
|
+
### `proxy` — MCP proxy server
|
|
213
232
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
gcloud beta services mcp enable stitch.googleapis.com --project=<PROJECT_ID>
|
|
233
|
+
```bash
|
|
234
|
+
npx @_davideast/stitch-mcp proxy [options]
|
|
217
235
|
```
|
|
218
236
|
|
|
219
|
-
|
|
237
|
+
| Option | Description |
|
|
238
|
+
|--------|-------------|
|
|
239
|
+
| `--transport <type>` | Transport type: `stdio` or `sse` (default: `stdio`) |
|
|
240
|
+
| `--port <number>` | Port number (required for `sse`) |
|
|
241
|
+
| `--debug` | Enable debug logging to `/tmp/stitch-proxy-debug.log` |
|
|
242
|
+
|
|
243
|
+
Proxies requests between your MCP client and the Stitch MCP server. Handles automatic token refresh and exposes virtual tools alongside the upstream tools.
|
|
244
|
+
|
|
245
|
+
**STDIO config (default):**
|
|
246
|
+
|
|
220
247
|
```json
|
|
221
248
|
{
|
|
222
249
|
"mcpServers": {
|
|
223
250
|
"stitch": {
|
|
224
251
|
"command": "npx",
|
|
225
|
-
"args": ["@_davideast/stitch-mcp", "proxy"]
|
|
226
|
-
"env": {
|
|
227
|
-
"STITCH_USE_SYSTEM_GCLOUD": "1"
|
|
228
|
-
}
|
|
252
|
+
"args": ["@_davideast/stitch-mcp", "proxy"]
|
|
229
253
|
}
|
|
230
254
|
}
|
|
231
255
|
}
|
|
232
256
|
```
|
|
233
257
|
|
|
234
|
-
**
|
|
235
|
-
| Variable | Description |
|
|
236
|
-
|----------|-------------|
|
|
237
|
-
| `STITCH_USE_SYSTEM_GCLOUD` | Use system gcloud config instead of isolated config |
|
|
238
|
-
| `STITCH_PROJECT_ID` | Override project ID |
|
|
239
|
-
| `GOOGLE_CLOUD_PROJECT` | Alternative project ID variable |
|
|
240
|
-
| `STITCH_HOST` | Custom Stitch API endpoint |
|
|
258
|
+
**SSE config:**
|
|
241
259
|
|
|
242
|
-
|
|
260
|
+
```json
|
|
261
|
+
{
|
|
262
|
+
"mcpServers": {
|
|
263
|
+
"stitch": {
|
|
264
|
+
"command": "npx",
|
|
265
|
+
"args": ["@_davideast/stitch-mcp", "proxy", "--transport", "sse", "--port", "3100"]
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
```
|
|
243
270
|
|
|
244
|
-
|
|
271
|
+
### `logout` — Revoke credentials
|
|
245
272
|
|
|
246
|
-
|
|
273
|
+
```bash
|
|
274
|
+
npx @_davideast/stitch-mcp logout [options]
|
|
275
|
+
```
|
|
247
276
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
277
|
+
| Option | Description |
|
|
278
|
+
|--------|-------------|
|
|
279
|
+
| `--force` | Skip confirmation prompts |
|
|
280
|
+
| `--clear-config` | Delete entire gcloud config directory |
|
|
251
281
|
|
|
252
|
-
|
|
282
|
+
Revokes both user authentication and Application Default Credentials.
|
|
253
283
|
|
|
254
|
-
|
|
284
|
+
### `snapshot` — Create UI snapshots
|
|
255
285
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
286
|
+
```bash
|
|
287
|
+
npx @_davideast/stitch-mcp snapshot [options]
|
|
288
|
+
```
|
|
259
289
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
290
|
+
| Option | Description |
|
|
291
|
+
|--------|-------------|
|
|
292
|
+
| `-c, --command <command>` | The command to snapshot (e.g. `init`) |
|
|
293
|
+
| `-d, --data <file>` | Path to JSON data file |
|
|
294
|
+
| `-s, --schema` | Print the data schema for the command |
|
|
263
295
|
|
|
264
|
-
|
|
296
|
+
Creates UI snapshots of CLI commands given a data state. Useful for testing and documentation.
|
|
265
297
|
|
|
266
|
-
|
|
267
|
-
Authenticate with Google Cloud
|
|
298
|
+
## Authentication
|
|
268
299
|
|
|
269
|
-
|
|
300
|
+
**Automatic (recommended):** Run `init` and follow the wizard. It handles gcloud installation, OAuth, credentials, and project setup.
|
|
270
301
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
✔ Logged in as you@gmail.com
|
|
302
|
+
```bash
|
|
303
|
+
npx @_davideast/stitch-mcp init
|
|
274
304
|
```
|
|
275
305
|
|
|
276
|
-
|
|
306
|
+
**API key:** Set the `STITCH_API_KEY` environment variable to skip OAuth entirely.
|
|
277
307
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
```
|
|
281
|
-
⚠ WSL detected - browser redirect to localhost may not work
|
|
282
|
-
If browser auth fails, copy the URL from terminal and open manually.
|
|
308
|
+
```bash
|
|
309
|
+
export STITCH_API_KEY="your-api-key"
|
|
283
310
|
```
|
|
284
311
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
#### Transport Options
|
|
312
|
+
**Manual (existing gcloud):** If you already have gcloud configured:
|
|
288
313
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
"stitch": {
|
|
294
|
-
"type": "http",
|
|
295
|
-
"url": "https://stitch.googleapis.com/mcp",
|
|
296
|
-
"headers": {
|
|
297
|
-
"Authorization": "Bearer <token>",
|
|
298
|
-
"X-Goog-User-Project": "<project-id>"
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
314
|
+
```bash
|
|
315
|
+
gcloud auth application-default login
|
|
316
|
+
gcloud config set project <PROJECT_ID>
|
|
317
|
+
gcloud beta services mcp enable stitch.googleapis.com --project=<PROJECT_ID>
|
|
303
318
|
```
|
|
304
319
|
|
|
305
|
-
|
|
320
|
+
Then use the proxy with `STITCH_USE_SYSTEM_GCLOUD=1`:
|
|
321
|
+
|
|
306
322
|
```json
|
|
307
323
|
{
|
|
308
324
|
"mcpServers": {
|
|
@@ -310,18 +326,27 @@ Simply copy the OAuth URL from your terminal and paste it into your browser to c
|
|
|
310
326
|
"command": "npx",
|
|
311
327
|
"args": ["@_davideast/stitch-mcp", "proxy"],
|
|
312
328
|
"env": {
|
|
313
|
-
"
|
|
329
|
+
"STITCH_USE_SYSTEM_GCLOUD": "1"
|
|
314
330
|
}
|
|
315
331
|
}
|
|
316
332
|
}
|
|
317
333
|
}
|
|
318
334
|
```
|
|
319
335
|
|
|
320
|
-
|
|
336
|
+
## Environment variables
|
|
321
337
|
|
|
322
|
-
|
|
338
|
+
| Variable | Description |
|
|
339
|
+
|----------|-------------|
|
|
340
|
+
| `STITCH_API_KEY` | API key for direct authentication (skips OAuth) |
|
|
341
|
+
| `STITCH_ACCESS_TOKEN` | Pre-existing access token |
|
|
342
|
+
| `STITCH_USE_SYSTEM_GCLOUD` | Use system gcloud config instead of isolated config |
|
|
343
|
+
| `STITCH_PROJECT_ID` | Override project ID |
|
|
344
|
+
| `GOOGLE_CLOUD_PROJECT` | Alternative project ID variable |
|
|
345
|
+
| `STITCH_HOST` | Custom Stitch API endpoint |
|
|
323
346
|
|
|
324
|
-
|
|
347
|
+
## Troubleshooting
|
|
348
|
+
|
|
349
|
+
### "Permission Denied" errors
|
|
325
350
|
|
|
326
351
|
Ensure:
|
|
327
352
|
- You have Owner or Editor role on the GCP project
|
|
@@ -333,15 +358,15 @@ Run `doctor` to diagnose:
|
|
|
333
358
|
npx @_davideast/stitch-mcp doctor --verbose
|
|
334
359
|
```
|
|
335
360
|
|
|
336
|
-
|
|
361
|
+
### Authentication URL not appearing
|
|
337
362
|
|
|
338
|
-
The tool
|
|
363
|
+
The tool prints authentication URLs to the terminal with a 5-second timeout. If the URL doesn't appear:
|
|
339
364
|
|
|
340
365
|
1. Check your terminal output carefully
|
|
341
366
|
2. The URL starts with `https://accounts.google.com`
|
|
342
|
-
3. If
|
|
367
|
+
3. If using proxy with `--debug`, check `/tmp/stitch-proxy-debug.log`
|
|
343
368
|
|
|
344
|
-
|
|
369
|
+
### Already authenticated but showing logged in
|
|
345
370
|
|
|
346
371
|
The bundled gcloud SDK maintains separate authentication from your global gcloud installation. To fully clear authentication:
|
|
347
372
|
|
|
@@ -349,7 +374,7 @@ The bundled gcloud SDK maintains separate authentication from your global gcloud
|
|
|
349
374
|
npx @_davideast/stitch-mcp logout --force --clear-config
|
|
350
375
|
```
|
|
351
376
|
|
|
352
|
-
|
|
377
|
+
### API connection fails after setup
|
|
353
378
|
|
|
354
379
|
1. Run the doctor command:
|
|
355
380
|
```bash
|
|
@@ -369,7 +394,11 @@ npx @_davideast/stitch-mcp logout --force --clear-config
|
|
|
369
394
|
npx @_davideast/stitch-mcp init
|
|
370
395
|
```
|
|
371
396
|
|
|
372
|
-
###
|
|
397
|
+
### WSL / SSH / Docker environments
|
|
398
|
+
|
|
399
|
+
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.
|
|
400
|
+
|
|
401
|
+
## Development
|
|
373
402
|
|
|
374
403
|
```bash
|
|
375
404
|
# Install dependencies
|