Stitch MCP Server
Enables AI coding assistants to generate, edit, and scaffold HTML UIs from natural language using Google Stitch API.
README
Stitch MCP Server
Enterprise-ready Model Context Protocol (MCP) server for Google Stitch SDK — Generate beautiful web UIs from text prompts using AI.
The Stitch MCP Server bridges your AI coding assistant (Claude, Cursor, Cline, Copilot, etc.) with Google's Stitch UI Generation API. Design, generate, and scaffold production-ready HTML components directly into your workspace using natural language.
Features
| Feature | Description |
|---|---|
| AI UI Generation | Generate complete HTML screens from text descriptions |
| Edit and Iterate | Modify existing screens with natural language prompts |
| Design Variants | Generate multiple design variations to explore options |
| Auto-Scaffold | Save generated UI directly to your project files |
| Multi-Client Support | Works with Claude Desktop, Cursor, Cline (VS Code), and any MCP client |
| One-Click Setup | Interactive installer configures everything automatically |
Quick Start
Prerequisites
- Node.js 18.0.0 or higher
- Stitch API Key — Get one here (sign in with Google)
Installation (30 seconds)
Run the interactive setup wizard:
npx stitch-mcp-server setup
This will:
- Ask which AI tools you want to configure (Claude, Cursor, Cline)
- Prompt for your Stitch API key
- Automatically update your MCP configuration files
- Done - restart your AI tool and start generating UIs
Manual Configuration
If you prefer manual setup, add this to your MCP config file:
<details> <summary><strong>Claude Desktop</strong> — <code>~/Library/Application Support/Claude/claude_desktop_config.json</code></summary>
{
"mcpServers": {
"stitch": {
"command": "npx",
"args": ["-y", "stitch-mcp-server@latest"],
"env": {
"STITCH_API_KEY": "your-api-key-here"
}
}
}
}
</details>
<details> <summary><strong>Cursor</strong> — <code>.cursor/mcp.json</code> in your workspace</summary>
{
"mcpServers": {
"stitch": {
"command": "npx",
"args": ["-y", "stitch-mcp-server@latest"],
"env": {
"STITCH_API_KEY": "your-api-key-here"
}
}
}
}
</details>
<details> <summary><strong>Cline (VS Code)</strong> — MCP Settings in Cline extension</summary>
{
"mcpServers": {
"stitch": {
"command": "npx",
"args": ["-y", "stitch-mcp-server@latest"],
"env": {
"STITCH_API_KEY": "your-api-key-here"
}
}
}
}
</details>
Available Tools
Core Tools
| Tool | Description | Example Prompt |
|---|---|---|
create_project |
Create a new Stitch project | "Create a project called 'My App'" |
list_projects |
List all your projects | "Show my Stitch projects" |
generate_screen |
Generate a UI from description | "Create a login page with email and password" |
edit_screen |
Modify an existing screen | "Make the background dark and add a sidebar" |
generate_variants |
Create design alternatives | "Show me 3 different color schemes" |
Advanced Tools
| Tool | Description | Use Case |
|---|---|---|
get_screen_code |
Fetch HTML source code | Get the raw HTML for a generated screen |
get_screen_image |
Get screenshot URL | Preview the generated design |
generate_and_fetch_code |
Generate + fetch in one call | Streamlined workflow for quick prototyping |
scaffold_project_files |
Save HTML to local files | Export directly to src/components/ |
Resources
stitch://projects— List all projects as contextstitch://projects/{id}/screens— List screens in a project
Prompts
create_web_app— Guided workflow to build a complete web app from idea to scaffolded files
Usage Examples
Generate a Landing Page
Create a modern landing page for a SaaS product with:
- Hero section with headline and CTA button
- Features grid with 3 columns
- Testimonials carousel
- Footer with links
Create a Dashboard
Generate an admin dashboard with:
- Sidebar navigation
- Stats cards at the top
- Data table with pagination
- Dark mode theme
Edit an Existing Design
Take the login screen and:
- Add social login buttons (Google, GitHub)
- Make it mobile responsive
- Add a "Remember me" checkbox
Local Development
# Clone the repo
git clone https://github.com/0x-Professor/Stitch-mcp-server.git
cd Stitch-mcp-server
# Install dependencies
npm install
# Build
npm run build
# Run locally
STITCH_API_KEY=your-key npm start
Running Tests
STITCH_API_KEY=your-key npm test
Tech Stack
- Runtime: Node.js 18+
- Language: TypeScript
- MCP SDK: @modelcontextprotocol/sdk
- Stitch SDK: @google/stitch-sdk
- Validation: Zod
- Build: tsup
- Testing: Vitest
Security
This server implements several security measures:
- Path Traversal Protection — Prevents writing files outside your workspace
- Input Validation — All inputs validated with Zod schemas
- Secure Config Storage — API keys stored with restricted file permissions (0600)
- HTTP Response Validation — Proper error handling for all network requests
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
MIT - 0x-Professor
Links
- npm: npmjs.com/package/stitch-mcp-server
- GitHub: github.com/0x-Professor/Stitch-mcp-server
- Issues: Report a bug
- Stitch SDK: github.com/AugmentedCode/stitch-sdk
- MCP Protocol: modelcontextprotocol.io
<p align="center"> <sub>Built for the AI-assisted development community</sub> </p>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。