Upload-to-Stitch
Upload local assets (images, mockups, HTML, and markdown files) to a Stitch project using the
provided upload script, which bypasses the MCP tool's base64 output token limits.
[!NOTE]
The AI model cannot upload files via MCP tools directly because the base64
encoding of even a small file exceeds the model's output token limit (~16K
tokens). This script reads the file and sends it directly over HTTP.
Steps
1. Identify Target Project
Use list_projects to find the correct projectId.
2. Get the API Key
Locate the active Stitch MCP configuration or approved secret store and use
the configured API key without printing or copying it into chat. Claude Code
typically keeps its MCP configuration in ~/.claude.json; Codex and other
hosts may expose an equivalent active configuration or environment secret.
Extract:
- API Key: From the
X-Goog-Api-Key header or auth argument
- MCP URL (optional): From the
httpUrl or endpoint argument (defaults to
https://stitch.googleapis.com)
[!IMPORTANT]
If no approved secret source is available, stop and report the blocker. Do
not ask the user to paste an API key into chat and do not proceed with a
guessed or exposed credential.
3. Run Upload Script
[!WARNING]
Checkpoint — User Confirmation Required.
Before running the upload script, you MUST pause and present the file(s)
to be uploaded (paths, sizes, and types) to the user and wait for explicit
approval. Do NOT execute the upload script until the user confirms.
Use run_command to execute the Python script:
python3 <SKILL_DIR>/scripts/upload_to_stitch.py \
--project-id <PROJECT_ID> \
--file-path <PATH_TO_FILE> \
--api-key <API_KEY> \
[--api-url <STITCH_API_URL>] \
[--title <SCREEN_TITLE>] \
[--generated-by <GENERATED_BY>]
[!TIP]
macOS / SSL Certificate Troubleshooting:
If the upload fails with ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] unable to get local issuer certificate, this means your Python installation does not have root certificate authorities configured.
The script automatically attempts to use the certifi package to load the CA bundle if it is installed in your python environment. If certifi is not installed, you can either install it (pip install certifi) or manually supply the SSL_CERT_FILE environment variable when running the script:
SSL_CERT_FILE=$(python3 -c "import certifi; print(certifi.where())") python3 <SKILL_DIR>/scripts/upload_to_stitch.py \
--project-id <PROJECT_ID> \
--file-path <PATH_TO_FILE> \
--api-key <API_KEY> \
[--api-url <STITCH_API_URL>] \
[--title <SCREEN_TITLE>] \
[--generated-by <GENERATED_BY>]
Supported File Types
| Extension |
MIME Type |
.png |
image/png |
.jpg, .jpeg |
image/jpeg |
.webp |
image/webp |
.html, .htm |
text/html |
.md |
text/markdown |
The script auto-detects MIME type from the file extension.
Script Options
--project-id: Required. The Stitch project ID.
--file-path: Required. Path to the local file to upload.
--api-key: Required. API key for Stitch authorization.
--api-url: Optional. Base URL of the Stitch API. Defaults to https://stitch.googleapis.com.
--title: Optional. Title for the uploaded screen. When uploading extracted HTML from a web app, set this to the route path of the page (e.g., '/dashboard', '/settings/profile', '/inbox') so that the screen name/title in Stitch clearly identifies the route.
--generated-by: Optional. Specify how the uploaded file was generated (for
example, stitch::extract-static-html, Claude Code, or Codex).
Cross-Client Portability
This skill is written to stay usable across GitHub Copilot, Claude Code, and Codex.
- GitHub Copilot: keep the folder in a Copilot-visible skill path or wrap the
workflow in project instructions when folder discovery is unavailable.
- Claude Code: keep the folder in a local skills directory or a compatible plugin source.
- Codex: install or sync the folder into
$CODEX_HOME/skills/stitch-upload-to-stitch and restart Codex after major changes.
MCP Availability And Fallback
Preferred MCP Server: Stitch MCP
- Fallback prompt: "Use the Upload-to-Stitch skill without MCP. Follow the documented local or manual fallback, show the selected tool surface, and report the verification evidence."
- Use local
.stitch/ artifacts, exported HTML or screenshots, bundled scripts, and the Stitch web UI when the host does not expose the needed Stitch MCP operation.
- Do not claim screen lookup, generation, editing, or variant MCP calls unless those tools are present in the active host tool list.
- Do not claim an MCP operation was used when the active host does not expose it.
Anti-Patterns
- Claiming a Stitch screen-generation, screen-editing, or screen-retrieval MCP call succeeded when the active host does not expose that tool.
- Uploading files, screenshots, HTML, markdown, or design assets to Stitch without user-approved destination and artifact details.
- Reading, printing, storing, or committing Stitch API keys, MCP config secrets, cookies, or credential-bearing files.
- Treating generated design or code as final without local render, syntax, or artifact verification.
- Collapsing this workflow into a broader frontend/design skill when Stitch-specific files, project IDs, or design-system assets matter.
Verification Protocol
Before claiming this skill was applied successfully:
- Pass/fail: The file type is supported:
.html, .htm, .md, .png, .jpg, .jpeg, or .webp.
- Pass/fail: User approval covers the actual file and destination project.
- Pass/fail: The response returned expected IDs, or the failure response is captured without leaking secrets.
- Pass/fail: Local metadata was updated without credentials.
- Pressure-test scenario: Repeat the workflow with Stitch MCP screen tools unavailable and confirm the fallback path remains honest and actionable.
- Success metric: The user can identify the exact artifact, project/design-system target, and verification evidence without relying on unstated MCP behavior.
Related Skills
1---2name: stitch-upload-to-stitch3description: Upload approved local HTML, markdown, or image assets to a Stitch project using direct MCP for small DESIGN.md files or the bundled API script for larger files.4license: Apache-2.05---6# Upload-to-Stitch
7
8Upload local assets (images, mockups, HTML, and markdown files) to a Stitch project using the
9provided upload script, which bypasses the MCP tool's base64 output token limits.
10
11> [!NOTE]
12> The AI model cannot upload files via MCP tools directly because the base64
13> encoding of even a small file exceeds the model's output token limit (~16K
14> tokens). This script reads the file and sends it directly over HTTP.
15
16## Steps
17
18### 1. Identify Target Project
19
20Use `list_projects` to find the correct `projectId`.
21
22### 2. Get the API Key
23
24Locate the active Stitch MCP configuration or approved secret store and use
25the configured API key without printing or copying it into chat. Claude Code
26typically keeps its MCP configuration in `~/.claude.json`; Codex and other
27hosts may expose an equivalent active configuration or environment secret.
28
29Extract:
30- **API Key**: From the `X-Goog-Api-Key` header or auth argument
31- **MCP URL** (optional): From the `httpUrl` or endpoint argument (defaults to
32 `https://stitch.googleapis.com`)
33
34> [!IMPORTANT]
35> If no approved secret source is available, stop and report the blocker. Do
36> not ask the user to paste an API key into chat and do not proceed with a
37> guessed or exposed credential.
38
39### 3. Run Upload Script
40
41> [!WARNING]
42> **Checkpoint — User Confirmation Required.**
43> Before running the upload script, you **MUST** pause and present the file(s)
44> to be uploaded (paths, sizes, and types) to the user and wait for explicit
45> approval. Do **NOT** execute the upload script until the user confirms.
46
47Use `run_command` to execute the Python script:
48
49```bash
50python3 <SKILL_DIR>/scripts/upload_to_stitch.py \
51 --project-id <PROJECT_ID> \
52 --file-path <PATH_TO_FILE> \
53 --api-key <API_KEY> \
54 [--api-url <STITCH_API_URL>] \
55 [--title <SCREEN_TITLE>] \
56 [--generated-by <GENERATED_BY>]
57```
58
59> [!TIP]
60> **macOS / SSL Certificate Troubleshooting:**
61> If the upload fails with `ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] unable to get local issuer certificate`, this means your Python installation does not have root certificate authorities configured.
62>
63> The script automatically attempts to use the `certifi` package to load the CA bundle if it is installed in your python environment. If `certifi` is not installed, you can either install it (`pip install certifi`) or manually supply the `SSL_CERT_FILE` environment variable when running the script:
64> ```bash
65> SSL_CERT_FILE=$(python3 -c "import certifi; print(certifi.where())") python3 <SKILL_DIR>/scripts/upload_to_stitch.py \
66> --project-id <PROJECT_ID> \
67> --file-path <PATH_TO_FILE> \
68> --api-key <API_KEY> \
69> [--api-url <STITCH_API_URL>] \
70> [--title <SCREEN_TITLE>] \
71> [--generated-by <GENERATED_BY>]
72> ```
73
74### Supported File Types
75
76| Extension | MIME Type |
77|:---|:---|
78| `.png` | `image/png` |
79| `.jpg`, `.jpeg` | `image/jpeg` |
80| `.webp` | `image/webp` |
81| `.html`, `.htm` | `text/html` |
82| `.md` | `text/markdown` |
83
84The script auto-detects MIME type from the file extension.
85
86### Script Options
87
88- `--project-id`: **Required**. The Stitch project ID.
89- `--file-path`: **Required**. Path to the local file to upload.
90- `--api-key`: **Required**. API key for Stitch authorization.
91- `--api-url`: Optional. Base URL of the Stitch API. Defaults to `https://stitch.googleapis.com`.
92- `--title`: Optional. Title for the uploaded screen. When uploading extracted HTML from a web app, set this to the **route path** of the page (e.g., `'/dashboard'`, `'/settings/profile'`, `'/inbox'`) so that the screen name/title in Stitch clearly identifies the route.
93- `--generated-by`: Optional. Specify how the uploaded file was generated (for
94 example, `stitch::extract-static-html`, `Claude Code`, or `Codex`).
95
96<!-- MCP:START -->
97
98<!-- PORTABILITY:START -->
99## Cross-Client Portability
100
101This skill is written to stay usable across GitHub Copilot, Claude Code, and Codex.
102
103- GitHub Copilot: keep the folder in a Copilot-visible skill path or wrap the
104 workflow in project instructions when folder discovery is unavailable.
105- Claude Code: keep the folder in a local skills directory or a compatible plugin source.
106- Codex: install or sync the folder into
107 `$CODEX_HOME/skills/stitch-upload-to-stitch` and restart Codex after major changes.
108
109<!-- PORTABILITY:END -->
110
111## MCP Availability And Fallback
112
113Preferred MCP Server: Stitch MCP
114
115- Fallback prompt: "Use the Upload-to-Stitch skill without MCP. Follow the documented local or manual fallback, show the selected tool surface, and report the verification evidence."
116- Use local `.stitch/` artifacts, exported HTML or screenshots, bundled scripts, and the Stitch web UI when the host does not expose the needed Stitch MCP operation.
117- Do not claim screen lookup, generation, editing, or variant MCP calls unless those tools are present in the active host tool list.
118- Do not claim an MCP operation was used when the active host does not expose it.
119
120<!-- MCP:END -->
121
122## Anti-Patterns
123
124- Claiming a Stitch screen-generation, screen-editing, or screen-retrieval MCP call succeeded when the active host does not expose that tool.
125- Uploading files, screenshots, HTML, markdown, or design assets to Stitch without user-approved destination and artifact details.
126- Reading, printing, storing, or committing Stitch API keys, MCP config secrets, cookies, or credential-bearing files.
127- Treating generated design or code as final without local render, syntax, or artifact verification.
128- Collapsing this workflow into a broader frontend/design skill when Stitch-specific files, project IDs, or design-system assets matter.
129
130## Verification Protocol
131
132Before claiming this skill was applied successfully:
133
1341. Pass/fail: The file type is supported: `.html`, `.htm`, `.md`, `.png`, `.jpg`, `.jpeg`, or `.webp`.
1352. Pass/fail: User approval covers the actual file and destination project.
1363. Pass/fail: The response returned expected IDs, or the failure response is captured without leaking secrets.
1374. Pass/fail: Local metadata was updated without credentials.
1385. Pressure-test scenario: Repeat the workflow with Stitch MCP screen tools unavailable and confirm the fallback path remains honest and actionable.
1396. Success metric: The user can identify the exact artifact, project/design-system target, and verification evidence without relying on unstated MCP behavior.
140
141## Related Skills
142
143- [stitch-code-to-design](../stitch-code-to-design/SKILL.md): Use when the task also needs this adjacent Stitch workflow.
144- [stitch-manage-design-system](../stitch-manage-design-system/SKILL.md): Use when the task also needs this adjacent Stitch workflow.
145- [stitch-extract-static-html](../stitch-extract-static-html/SKILL.md): Use when the task also needs this adjacent Stitch workflow.