Skip to content
Back to search

stitch-mcp

A CLI for moving AI-generated UI designs from Google’s Stitch platform into your development workflow.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/davideast--stitch-mcp/badge.svg)](/listings/davideast--stitch-mcp)

HTML

<a href="/listings/davideast--stitch-mcp"><img src="/api/listings/davideast--stitch-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

# Set up authentication and MCP client config
npx @_davideast/stitch-mcp init

# Serve all project screens on a local dev server
npx @_davideast/stitch-mcp serve -p <project-id>

# Build an Astro site by mapping screens to routes
npx @_davideast/stitch-mcp site -p <project-id>

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 254 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # stitch-mcp
  2. 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.
  3. ## Why
  4. 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.
  5. ## Quick start
  6. ```bash
  7. # Set up authentication and MCP client config
  8. npx @_davideast/stitch-mcp init
  9. # Serve all project screens on a local dev server
  10. npx @_davideast/stitch-mcp serve -p <project-id>
  11. # Build an Astro site by mapping screens to routes
  12. npx @_davideast/stitch-mcp site -p <project-id>
  13. ```
  14. ## Features
  15. - **Preview designs locally** — serve all screens from a project on a Vite dev server
  16. - **Build an Astro site from your designs** — map screens to routes and generate a deployable project
  17. - **Give your agent design context** — proxy Stitch tools to your IDE's coding agent with automatic token refresh
  18. - **Explore your design data** — browse projects, screens, and metadata in the terminal or via CLI
  19. - **Browse projects in your terminal** — navigate screens interactively with copy, preview, and open actions
  20. - **Set up in one command** — guided wizard handles gcloud, auth, and MCP client configuration
  21. ## MCP integration
  22. Add this to your MCP client config to give coding agents access to Stitch tools:
  23. ```json
  24. {
  25. "mcpServers": {
  26. "stitch": {
  27. "command": "npx",
  28. "args": ["@_davideast/stitch-mcp", "proxy"]
  29. }
  30. }
  31. }
  32. ```
  33. Supported clients: VS Code, Cursor, Claude Code, Gemini CLI, Codex, OpenCode.
  34. ### Virtual tools
  35. The proxy exposes these tools alongside the upstream Stitch MCP tools. They combine multiple API calls into higher-level operations for coding agents:
  36. - **`build_site`** — Builds a site from a project by mapping screens to routes. Returns the design HTML for each page.
  37. - **`get_screen_code`** — Retrieves a screen and downloads its HTML code content.
  38. - **`get_screen_image`** — Retrieves a screen and downloads its screenshot image as base64.
  39. `build_site` input schema:
  40. ```json
  41. {
  42. "projectId": "string (required)",
  43. "routes": [
  44. {
  45. "screenId": "string (required)",
  46. "route": "string (required, e.g. \"/\" or \"/about\")"
  47. }
  48. ]
  49. }
  50. ```
  51. Example:
  52. ```bash
  53. npx @_davideast/stitch-mcp tool build_site -d '{
  54. "projectId": "123456",
  55. "routes": [
  56. { "screenId": "abc", "route": "/" },
  57. { "screenId": "def", "route": "/about" }
  58. ]
  59. }'
  60. ```
  61. ## Explore your designs
  62. Use `view` and `tool` to browse your design data and understand what's available before prompting agents.
  63. ```bash
  64. # Browse all projects
  65. npx @_davideast/stitch-mcp view --projects
  66. # Inspect a specific screen
  67. npx @_davideast/stitch-mcp view --project <project-id> --screen <screen-id>
  68. # Invoke any MCP tool from the CLI
  69. npx @_davideast/stitch-mcp tool [toolName]
  70. ```
  71. Inside the `view` browser: `c` copies the selected value, `s` previews HTML in your browser, `o` opens the project in Stitch, and `q` quits. Use arrow keys to navigate and Enter to drill into nested data.
  72. Run `tool` without a name to list all available tools, or with `-s` to see a tool's schema.
  73. ---
  74. ## Installation
  75. Run directly with `npx` (no install needed):
  76. ```bash
  77. npx @_davideast/stitch-mcp <command>
  78. ```
  79. Or install globally:
  80. ```bash
  81. npm install -g @_davideast/stitch-mcp
  82. stitch-mcp <command>
  83. ```
  84. ## Commands
  85. | Command | Description |
  86. |---------|-------------|
  87. | **Setup** | |
  88. | `init` | Set up auth, gcloud, and MCP client config |
  89. | `doctor` | Verify configuration health |
  90. | `logout` | Revoke credentials |
  91. | **Development** | |
  92. | `serve -p <id>` | Preview project screens locally |
  93. | `screens -p <id>` | Browse screens in terminal |
  94. | `view` | Interactive resource browser |
  95. | **Build** | |
  96. | `site -p <id>` | Generate Astro project from screens |
  97. | `snapshot` | Save screen state to file |
  98. | **Integration** | |
  99. | `tool [name]` | Invoke MCP tools from CLI |
  100. | `proxy` | Run MCP proxy for agents |
  101. Run any command with `--help` for full options.
  102. ## Authentication
  103. **Automatic (recommended):** Run `init` and follow the wizard. It handles gcloud installation, OAuth, credentials, and project setup.
  104. ```bash
  105. npx @_davideast/stitch-mcp init
  106. ```
  107. **API key:** Set the `STITCH_API_KEY` environment variable to skip OAuth entirely.
  108. ```bash
  109. export STITCH_API_KEY="your-api-key"
  110. ```
  111. **Manual (existing gcloud):** If you already have gcloud configured:
  112. ```bash
  113. gcloud auth application-default login
  114. gcloud config set project <PROJECT_ID>
  115. gcloud beta services mcp enable stitch.googleapis.com --project=<PROJECT_ID>
  116. ```
  117. Then use the proxy with `STITCH_USE_SYSTEM_GCLOUD=1`:
  118. ```json
  119. {
  120. "mcpServers": {
  121. "stitch": {
  122. "command": "npx",
  123. "args": ["@_davideast/stitch-mcp", "proxy"],
  124. "env": {
  125. "STITCH_USE_SYSTEM_GCLOUD": "1"
  126. }
  127. }
  128. }
  129. }
  130. ```
  131. ## Environment variables
  132. | Variable | Description |
  133. |----------|-------------|
  134. | `STITCH_API_KEY` | API key for direct authentication (skips OAuth) |
  135. | `STITCH_ACCESS_TOKEN` | Pre-existing access token |
  136. | `STITCH_USE_SYSTEM_GCLOUD` | Use system gcloud config instead of isolated config |
  137. | `STITCH_PROJECT_ID` | Override project ID |
  138. | `GOOGLE_CLOUD_PROJECT` | Alternative project ID variable |
  139. | `STITCH_HOST` | Custom Stitch API endpoint |
  140. ## Troubleshooting
  141. ### "Permission Denied" errors
  142. Ensure you have Owner or Editor role, billing is enabled, and the Stitch API is enabled. Run `doctor --verbose` to diagnose.
  143. ### Authentication URL not appearing
  144. The tool prints authentication URLs to the terminal with a 5-second timeout. Look for a URL starting with `https://accounts.google.com`. If using proxy with `--debug`, check `/tmp/stitch-proxy-debug.log`.
  145. ### Already authenticated but showing logged in
  146. The bundled gcloud SDK maintains separate authentication from your global gcloud installation. To fully clear authentication:
  147. ```bash
  148. npx @_davideast/stitch-mcp logout --force --clear-config
  149. ```
  150. ### API connection fails after setup
  151. Run `doctor --verbose` to diagnose. Verify your project has billing and the Stitch API enabled. If issues persist, re-authenticate:
  152. ```bash
  153. npx @_davideast/stitch-mcp logout --force
  154. npx @_davideast/stitch-mcp init
  155. ```
  156. ### WSL / SSH / Docker environments
  157. 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.
  158. ## Development
  159. ```bash
  160. # Install dependencies
  161. bun install
  162. # Run locally
  163. bun run dev init
  164. # Run tests
  165. bun test
  166. # Build
  167. bun run build
  168. # Verify package
  169. bun run verify-pack
  170. ```
  171. ## License
  172. Apache 2.0 © David East
  173. ## Disclaimer
  174. > [!WARNING]
  175. > **Experimental Project** - This is an independent, experimental tool.
  176. This project is:
  177. - **NOT** affiliated with, endorsed by, or sponsored by Google LLC, Alphabet Inc., or the Stitch API team
  178. - Provided **AS-IS** with **NO WARRANTIES** of any kind
  179. - **NOT** guaranteed to be maintained, secure, or compatible with future API versions
  180. "Stitch" and "Google Cloud" are trademarks of Google LLC.
  181. **USE AT YOUR OWN RISK.**

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.