Use when generating, editing, or creating variants of UI screens in Google Stitch. MUST load before any stitch_generate_screen or stitch_edit_screens tool calls.
Stitch tools are registered as native OpenCode tools via the Stitch plugin (.opencode/plugin/stitch.ts), using @google/stitch-sdk for direct HTTP to stitch.googleapis.com/mcp. No MCP subprocess needed.
gcloud) installed and initializedroles/serviceusage.serviceUsageAdminroles/mcp.toolUser (to call MCP tools)gcloud config set project PROJECT_ID
gcloud beta services mcp enable stitch.googleapis.com --project=PROJECT_ID
API Key auth (recommended):
export STITCH_API_KEY="your-api-key"
Or OAuth auth:
export STITCH_ACCESS_TOKEN=$(gcloud auth print-access-token)
export GOOGLE_CLOUD_PROJECT="your-project-id"
Tools are available immediately after env vars are set and OpenCode restarts.
| Tool | Description |
|---|---|
stitch_create_project | Create a new Stitch project |
stitch_get_project | Get project details by resource name |
stitch_list_projects | List all projects (optional filter) |
stitch_list_screens | List screens in a project |
stitch_get_screen | Get screen details with HTML code |
stitch_generate_screen | Generate UI from text prompt |
stitch_edit_screens | Edit existing screens with a prompt |
stitch_generate_variants | Generate design variants of screens |
stitch_list_projects({});
stitch_create_project({ title: "My E-commerce App" });
stitch_generate_screen({
projectId: "my-project-123",
prompt:
"Create a modern login page with email and password fields, social login buttons, and a forgot password link",
deviceType: "MOBILE",
});
stitch_edit_screens({
projectId: "my-project-123",
selectedScreenIds: ["screen-abc"],
prompt: "Make the login button larger and change the color scheme to dark mode",
});
stitch_generate_variants({
projectId: "my-project-123",
selectedScreenIds: ["screen-abc"],
prompt: "Create variants with different color schemes",
variantCount: 3,
creativeRange: "MEDIUM",
});
DEVICE_TYPE_UNSPECIFIED | MOBILE | DESKTOP | TABLET | AGNOSTIC
MODEL_ID_UNSPECIFIED | GEMINI_3_PRO | GEMINI_3_FLASH
variantCount: Number of variants (1-10)creativeRange: LOW | MEDIUM | HIGHaspects: Comma-separated aspects to vary (e.g. "color,layout")# API key auth
export STITCH_API_KEY="your-key"
# Or OAuth (token expires after ~1 hour)
export STITCH_ACCESS_TOKEN=$(gcloud auth print-access-token)
gcloud beta services mcp enable stitch.googleapis.com --project=YOUR_PROJECT_ID
GEMINI_3_PRO produces higher quality; GEMINI_3_FLASH is faster