kof-stitch-mcp

kof-stitch-mcp

Enables AI-powered UI/UX design generation and management via Google Stitch, handling OAuth authentication automatically for MCP clients like Claude Code and Cursor.

Category
访问服务器

README

@keeponfirst/kof-stitch-mcp

Part of KOF Agentic Workflow - A complete agentic workflow for building modern applications. Check out the full workflow if you're interested in how this tool fits into the bigger picture.


☕ Support this project

If this project helps you, you can support development here:

👉 https://buymeacoffee.com/keeponfirst

<a href="https://www.buymeacoffee.com/keeponfirst" target="_blank"> <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" height="45" /> </a>


MCP (Model Context Protocol) Server for Google Stitch - AI-powered UI/UX design tool.

Works with Claude Code, Cursor, and any MCP-compatible client.

Why This Package?

Google Stitch provides an official MCP endpoint at stitch.googleapis.com/mcp, but it requires:

  • Dynamic OAuth tokens from Google Cloud ADC
  • Proper authentication headers

Most MCP clients (Claude Code, Cursor) don't support Google's google_credentials auth type natively. This package wraps the official API as a stdio MCP server that handles authentication automatically.

Your MCP Client → kof-stitch-mcp → Google Stitch API
     (stdio)         (handles auth)      (HTTP)

Features

Official Stitch Tools (via Google API)

  • list_projects - List all your Stitch projects
  • get_project - Get project details
  • create_project - Create a new project
  • list_screens - List screens in a project
  • get_screen - Get screen details
  • generate_screen_from_text - Generate UI design from text prompt

Additional Tools (by this package)

  • fetch_screen_code - Download screen HTML code directly
  • fetch_screen_image - Download screen screenshot as PNG
  • export_project - Batch export all screens (HTML + PNG) with manifest
  • fetch_design_md - Download project's DESIGN.md design system spec (supports Stitch Vibe Design)
  • init_stitch_project - NEW Initialize .stitch/ directory for stitch-skills compatibility

Prerequisites

  1. Node.js 18+

  2. Google Cloud CLI with Application Default Credentials:

    # Install gcloud: https://cloud.google.com/sdk/docs/install
    
    # Login
    gcloud auth application-default login
    
    # Set project
    gcloud config set project YOUR_PROJECT_ID
    
  3. Enable Stitch MCP API:

    gcloud beta services mcp enable stitch.googleapis.com --project=YOUR_PROJECT_ID
    

Installation

Option 1: npx (Recommended)

No installation needed. Configure directly in your MCP client.

Option 2: Global Install

npm install -g @keeponfirst/kof-stitch-mcp

Option 3: Local Install

npm install @keeponfirst/kof-stitch-mcp

Configuration

Claude Code

Create .mcp.json in your project root:

{
  "mcpServers": {
    "stitch": {
      "command": "npx",
      "args": ["-y", "@keeponfirst/kof-stitch-mcp"],
      "env": {
        "GOOGLE_CLOUD_PROJECT": "your-project-id"
      }
    }
  }
}

Or add via CLI:

claude mcp add stitch --command "npx" --args "-y" "@keeponfirst/kof-stitch-mcp" \
  --env GOOGLE_CLOUD_PROJECT=your-project-id

Cursor

Add to Cursor MCP settings:

{
  "mcpServers": {
    "stitch": {
      "command": "npx",
      "args": ["-y", "@keeponfirst/kof-stitch-mcp"],
      "env": {
        "GOOGLE_CLOUD_PROJECT": "your-project-id"
      }
    }
  }
}

Other MCP Clients

Any client supporting stdio MCP servers can use:

GOOGLE_CLOUD_PROJECT=your-project-id npx @keeponfirst/kof-stitch-mcp

Usage Examples

After configuration, you can use natural language in your MCP client:

"List my Stitch projects"
→ Uses list_projects tool

"Generate a mobile login screen with email and social login"
→ Uses generate_screen_from_text tool

"Download the HTML code for screen abc123 in project xyz789"
→ Uses fetch_screen_code tool

"Download the DESIGN.md from my Stitch project xyz789"
→ Uses fetch_design_md tool
→ Saves DESIGN.md to your working directory
→ AI coding agents can now follow your design system when generating UI

DESIGN.md Workflow (Vibe Design)

Google Stitch's new DESIGN.md feature (launched 2026-03-18) lets you define your design system in a portable Markdown file — colors, typography, spacing, and component patterns — that AI agents can read and follow.

1. Design in Stitch → export DESIGN.md from project settings
2. fetch_design_md → saves DESIGN.md to your repo
3. Claude Code reads DESIGN.md → generates consistent UI components

stitch-skills Integration

stitch-skills is Google's official Agent Skills library that adds advanced workflows on top of Stitch — multi-page loops, React component conversion, Remotion video walkthroughs, and more.

kof-stitch-mcp is the authentication layer that makes stitch-skills work in Claude Code and Cursor, where Google OAuth is not natively supported.

Why use them together?

Without stitch-skills With stitch-skills
Manual prompt for each screen stitch-loop auto-generates all pages in sequence
AI guesses design rules Every screen enforced against DESIGN.md
Raw HTML output react-components converts to modular React/Vite components
Static designs remotion generates interactive video walkthroughs

Setup (one-time)

Step 1 — Configure kof-stitch-mcp (authentication bridge)

Add to your .mcp.json:

{
  "mcpServers": {
    "stitch": {
      "command": "npx",
      "args": ["-y", "@keeponfirst/kof-stitch-mcp"],
      "env": { "GOOGLE_CLOUD_PROJECT": "your-project-id" }
    }
  }
}

Step 2 — Install stitch-skills

# Install the skills you need
npx skills add google-labs-code/stitch-skills --skill stitch-design
npx skills add google-labs-code/stitch-skills --skill stitch-loop
npx skills add google-labs-code/stitch-skills --skill design-md
npx skills add google-labs-code/stitch-skills --skill react-components

Step 3 — Initialize your project

In Claude Code, run:

Initialize my Stitch project <projectId> with init_stitch_project

This creates:

.stitch/
├── metadata.json   ← screens map + project config (stitch-skills format)
├── DESIGN.md       ← design system template pre-filled from your Stitch theme
├── SITE.md         ← site vision and page checklist
└── designs/        ← output directory for HTML + PNG exports

Step 4 — Fill in the templates

Edit .stitch/DESIGN.md to complete your color palette, typography, and component rules. Edit .stitch/SITE.md to describe your site goals and pages.

Or let the design-md skill analyze your existing screens and fill in DESIGN.md automatically.

Step 5 — Run advanced workflows

Run stitch-loop to generate all pages in my site
Convert my Stitch screens to React components

Environment Variables

Variable Required Description
GOOGLE_CLOUD_PROJECT Yes Your Google Cloud Project ID
GCLOUD_PROJECT Alt Alternative to GOOGLE_CLOUD_PROJECT

Troubleshooting

"gcloud CLI not found"

Install Google Cloud SDK: https://cloud.google.com/sdk/docs/install

"Your default credentials were not found"

gcloud auth application-default login

"Stitch API has not been used in project"

Enable the MCP API:

gcloud beta services mcp enable stitch.googleapis.com --project=YOUR_PROJECT_ID

"Permission denied"

Ensure your account has the required role:

gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
  --member="user:your-email@gmail.com" \
  --role="roles/serviceusage.serviceUsageConsumer"

How It Works

  1. On startup, the server verifies gcloud authentication
  2. For each MCP tool call:
    • Gets fresh OAuth token via gcloud auth application-default print-access-token
    • Calls https://stitch.googleapis.com/mcp with proper headers
    • Returns result to MCP client

Related

License

MIT © KeepOnFirst

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选