@_davideast/stitch-mcp 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +224 -192
- package/dist/cli.js +2495 -1608
- 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 +4 -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,167 @@
|
|
|
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
|
-
|
|
46
|
+
Supported clients: VS Code, Cursor, Claude Code, Gemini CLI, Codex, OpenCode.
|
|
47
|
+
|
|
48
|
+
---
|
|
37
49
|
|
|
38
|
-
##
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
Run directly with `npx` (no install needed):
|
|
39
53
|
|
|
40
54
|
```bash
|
|
41
|
-
npx @_davideast/stitch-mcp
|
|
55
|
+
npx @_davideast/stitch-mcp <command>
|
|
42
56
|
```
|
|
43
57
|
|
|
44
|
-
|
|
45
|
-
- ✔ Google Cloud CLI installation
|
|
46
|
-
- ✔ User authentication
|
|
47
|
-
- ✔ Application credentials
|
|
48
|
-
- ✔ Project configuration
|
|
49
|
-
- ✔ Stitch API connectivity
|
|
50
|
-
|
|
51
|
-
## Logout
|
|
58
|
+
Or install globally:
|
|
52
59
|
|
|
53
60
|
```bash
|
|
54
|
-
|
|
61
|
+
npm install -g @_davideast/stitch-mcp
|
|
62
|
+
stitch-mcp <command>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Commands
|
|
55
66
|
|
|
56
|
-
|
|
57
|
-
npx @_davideast/stitch-mcp logout --force
|
|
67
|
+
### `init` — Set up authentication and MCP config
|
|
58
68
|
|
|
59
|
-
|
|
60
|
-
npx @_davideast/stitch-mcp
|
|
69
|
+
```bash
|
|
70
|
+
npx @_davideast/stitch-mcp init [options]
|
|
61
71
|
```
|
|
62
72
|
|
|
63
|
-
|
|
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`) |
|
|
64
80
|
|
|
65
|
-
|
|
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.
|
|
66
82
|
|
|
67
|
-
|
|
83
|
+
### `doctor` — Verify configuration health
|
|
68
84
|
|
|
69
85
|
```bash
|
|
70
|
-
npx @_davideast/stitch-mcp
|
|
86
|
+
npx @_davideast/stitch-mcp doctor [options]
|
|
71
87
|
```
|
|
72
88
|
|
|
73
|
-
|
|
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
|
|
74
96
|
|
|
75
97
|
```bash
|
|
76
|
-
|
|
77
|
-
stitch-mcp init
|
|
98
|
+
npx @_davideast/stitch-mcp serve -p <project-id>
|
|
78
99
|
```
|
|
79
100
|
|
|
80
|
-
|
|
101
|
+
| Option | Description |
|
|
102
|
+
|--------|-------------|
|
|
103
|
+
| `-p, --project <id>` | **Required.** Project ID |
|
|
81
104
|
|
|
82
|
-
|
|
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
|
|
83
108
|
|
|
84
109
|
```bash
|
|
85
|
-
npx @_davideast/stitch-mcp
|
|
110
|
+
npx @_davideast/stitch-mcp screens -p <project-id>
|
|
86
111
|
```
|
|
87
112
|
|
|
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
|
|
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
|
|
106
120
|
|
|
107
121
|
```bash
|
|
108
|
-
npx @_davideast/stitch-mcp
|
|
122
|
+
npx @_davideast/stitch-mcp site -p <project-id> [options]
|
|
109
123
|
```
|
|
110
124
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
-
|
|
116
|
-
- User is authenticated
|
|
117
|
-
- Application Default Credentials exist
|
|
118
|
-
- Active GCP project is configured
|
|
119
|
-
- Stitch API is reachable
|
|
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) |
|
|
120
130
|
|
|
121
|
-
|
|
131
|
+
Launches an interactive screen-to-route mapper, then generates an Astro project with the following structure:
|
|
122
132
|
|
|
123
|
-
```
|
|
124
|
-
|
|
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"
|
|
125
141
|
```
|
|
126
142
|
|
|
127
|
-
|
|
128
|
-
- `--force` - Skip confirmation prompts
|
|
129
|
-
- `--clear-config` - Delete entire gcloud config directory
|
|
143
|
+
External assets (fonts, images) are downloaded to `public/assets/` with URLs rewritten to local paths.
|
|
130
144
|
|
|
131
|
-
|
|
132
|
-
- Switching Google accounts
|
|
133
|
-
- Clearing authentication for testing
|
|
134
|
-
- Resetting state when troubleshooting
|
|
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`).
|
|
135
146
|
|
|
136
|
-
|
|
147
|
+
### `view` — Interactive resource browser
|
|
137
148
|
|
|
138
149
|
```bash
|
|
139
150
|
npx @_davideast/stitch-mcp view [options]
|
|
140
151
|
```
|
|
141
152
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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 |
|
|
148
161
|
|
|
149
|
-
|
|
162
|
+
Browse Stitch resources in a navigable JSON tree. Supports drilling into nested objects and performing actions on selected nodes.
|
|
150
163
|
|
|
151
|
-
**Keyboard
|
|
164
|
+
**Keyboard shortcuts:**
|
|
152
165
|
|
|
153
166
|
| Key | Action |
|
|
154
167
|
|-----|--------|
|
|
@@ -157,23 +170,10 @@ Interactively browse Stitch resources in a navigable JSON tree. Supports drillin
|
|
|
157
170
|
| `Backspace` | Go back one level |
|
|
158
171
|
| `c` | Copy selected value to clipboard |
|
|
159
172
|
| `cc` | Extended copy (downloads content for URLs) |
|
|
160
|
-
| `s` |
|
|
173
|
+
| `s` | Preview HTML — serves `htmlCode` in-memory and opens browser |
|
|
161
174
|
| `o` | Open project in Stitch web app |
|
|
162
175
|
| `q` | Quit viewer |
|
|
163
176
|
|
|
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
177
|
```bash
|
|
178
178
|
# Browse all projects
|
|
179
179
|
npx @_davideast/stitch-mcp view --projects
|
|
@@ -182,127 +182,146 @@ npx @_davideast/stitch-mcp view --projects
|
|
|
182
182
|
npx @_davideast/stitch-mcp view --project <project-id> --screen <screen-id>
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
### `tool` — Invoke MCP tools directly
|
|
186
186
|
|
|
187
187
|
```bash
|
|
188
|
-
npx @_davideast/stitch-mcp
|
|
188
|
+
npx @_davideast/stitch-mcp tool [toolName] [options]
|
|
189
189
|
```
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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:**
|
|
195
201
|
|
|
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`)
|
|
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.
|
|
201
203
|
|
|
202
|
-
|
|
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.
|
|
203
207
|
|
|
204
|
-
|
|
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:
|
|
205
223
|
|
|
206
|
-
**Prerequisites:**
|
|
207
224
|
```bash
|
|
208
|
-
|
|
209
|
-
|
|
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
|
+
```
|
|
210
233
|
|
|
211
|
-
|
|
212
|
-
gcloud config set project <PROJECT_ID>
|
|
234
|
+
### `proxy` — MCP proxy server
|
|
213
235
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
gcloud beta services mcp enable stitch.googleapis.com --project=<PROJECT_ID>
|
|
236
|
+
```bash
|
|
237
|
+
npx @_davideast/stitch-mcp proxy [options]
|
|
217
238
|
```
|
|
218
239
|
|
|
219
|
-
|
|
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
|
+
|
|
220
250
|
```json
|
|
221
251
|
{
|
|
222
252
|
"mcpServers": {
|
|
223
253
|
"stitch": {
|
|
224
254
|
"command": "npx",
|
|
225
|
-
"args": ["@_davideast/stitch-mcp", "proxy"]
|
|
226
|
-
"env": {
|
|
227
|
-
"STITCH_USE_SYSTEM_GCLOUD": "1"
|
|
228
|
-
}
|
|
255
|
+
"args": ["@_davideast/stitch-mcp", "proxy"]
|
|
229
256
|
}
|
|
230
257
|
}
|
|
231
258
|
}
|
|
232
259
|
```
|
|
233
260
|
|
|
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 |
|
|
261
|
+
**SSE config:**
|
|
241
262
|
|
|
242
|
-
|
|
263
|
+
```json
|
|
264
|
+
{
|
|
265
|
+
"mcpServers": {
|
|
266
|
+
"stitch": {
|
|
267
|
+
"command": "npx",
|
|
268
|
+
"args": ["@_davideast/stitch-mcp", "proxy", "--transport", "sse", "--port", "3100"]
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
```
|
|
243
273
|
|
|
244
|
-
|
|
274
|
+
### `logout` — Revoke credentials
|
|
245
275
|
|
|
246
|
-
|
|
276
|
+
```bash
|
|
277
|
+
npx @_davideast/stitch-mcp logout [options]
|
|
278
|
+
```
|
|
247
279
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
280
|
+
| Option | Description |
|
|
281
|
+
|--------|-------------|
|
|
282
|
+
| `--force` | Skip confirmation prompts |
|
|
283
|
+
| `--clear-config` | Delete entire gcloud config directory |
|
|
251
284
|
|
|
252
|
-
|
|
285
|
+
Revokes both user authentication and Application Default Credentials.
|
|
253
286
|
|
|
254
|
-
|
|
287
|
+
### `snapshot` — Create UI snapshots
|
|
255
288
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
289
|
+
```bash
|
|
290
|
+
npx @_davideast/stitch-mcp snapshot [options]
|
|
291
|
+
```
|
|
259
292
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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 |
|
|
263
298
|
|
|
264
|
-
|
|
299
|
+
Creates UI snapshots of CLI commands given a data state. Useful for testing and documentation.
|
|
265
300
|
|
|
266
|
-
|
|
267
|
-
Authenticate with Google Cloud
|
|
301
|
+
## Authentication
|
|
268
302
|
|
|
269
|
-
|
|
303
|
+
**Automatic (recommended):** Run `init` and follow the wizard. It handles gcloud installation, OAuth, credentials, and project setup.
|
|
270
304
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
✔ Logged in as you@gmail.com
|
|
305
|
+
```bash
|
|
306
|
+
npx @_davideast/stitch-mcp init
|
|
274
307
|
```
|
|
275
308
|
|
|
276
|
-
|
|
309
|
+
**API key:** Set the `STITCH_API_KEY` environment variable to skip OAuth entirely.
|
|
277
310
|
|
|
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.
|
|
311
|
+
```bash
|
|
312
|
+
export STITCH_API_KEY="your-api-key"
|
|
283
313
|
```
|
|
284
314
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
#### Transport Options
|
|
315
|
+
**Manual (existing gcloud):** If you already have gcloud configured:
|
|
288
316
|
|
|
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
|
-
}
|
|
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>
|
|
303
321
|
```
|
|
304
322
|
|
|
305
|
-
|
|
323
|
+
Then use the proxy with `STITCH_USE_SYSTEM_GCLOUD=1`:
|
|
324
|
+
|
|
306
325
|
```json
|
|
307
326
|
{
|
|
308
327
|
"mcpServers": {
|
|
@@ -310,18 +329,27 @@ Simply copy the OAuth URL from your terminal and paste it into your browser to c
|
|
|
310
329
|
"command": "npx",
|
|
311
330
|
"args": ["@_davideast/stitch-mcp", "proxy"],
|
|
312
331
|
"env": {
|
|
313
|
-
"
|
|
332
|
+
"STITCH_USE_SYSTEM_GCLOUD": "1"
|
|
314
333
|
}
|
|
315
334
|
}
|
|
316
335
|
}
|
|
317
336
|
}
|
|
318
337
|
```
|
|
319
338
|
|
|
320
|
-
|
|
339
|
+
## Environment variables
|
|
321
340
|
|
|
322
|
-
|
|
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 |
|
|
323
349
|
|
|
324
|
-
|
|
350
|
+
## Troubleshooting
|
|
351
|
+
|
|
352
|
+
### "Permission Denied" errors
|
|
325
353
|
|
|
326
354
|
Ensure:
|
|
327
355
|
- You have Owner or Editor role on the GCP project
|
|
@@ -333,15 +361,15 @@ Run `doctor` to diagnose:
|
|
|
333
361
|
npx @_davideast/stitch-mcp doctor --verbose
|
|
334
362
|
```
|
|
335
363
|
|
|
336
|
-
|
|
364
|
+
### Authentication URL not appearing
|
|
337
365
|
|
|
338
|
-
The tool
|
|
366
|
+
The tool prints authentication URLs to the terminal with a 5-second timeout. If the URL doesn't appear:
|
|
339
367
|
|
|
340
368
|
1. Check your terminal output carefully
|
|
341
369
|
2. The URL starts with `https://accounts.google.com`
|
|
342
|
-
3. If
|
|
370
|
+
3. If using proxy with `--debug`, check `/tmp/stitch-proxy-debug.log`
|
|
343
371
|
|
|
344
|
-
|
|
372
|
+
### Already authenticated but showing logged in
|
|
345
373
|
|
|
346
374
|
The bundled gcloud SDK maintains separate authentication from your global gcloud installation. To fully clear authentication:
|
|
347
375
|
|
|
@@ -349,7 +377,7 @@ The bundled gcloud SDK maintains separate authentication from your global gcloud
|
|
|
349
377
|
npx @_davideast/stitch-mcp logout --force --clear-config
|
|
350
378
|
```
|
|
351
379
|
|
|
352
|
-
|
|
380
|
+
### API connection fails after setup
|
|
353
381
|
|
|
354
382
|
1. Run the doctor command:
|
|
355
383
|
```bash
|
|
@@ -369,7 +397,11 @@ npx @_davideast/stitch-mcp logout --force --clear-config
|
|
|
369
397
|
npx @_davideast/stitch-mcp init
|
|
370
398
|
```
|
|
371
399
|
|
|
372
|
-
###
|
|
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
|
|
373
405
|
|
|
374
406
|
```bash
|
|
375
407
|
# Install dependencies
|