The fetcher module (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/BaselAshraf81/holystitch/llms.txt
Use this file to discover all available pages before exploring further.
pipeline/fetcher.ts) retrieves raw screen HTML from a Stitch project using the @google/stitch-sdk. It is only invoked when a projectId is provided to the convert_stitch_to_react tool — if you pass htmlScreens directly, the fetcher is never called.
fetchScreens
RawScreen[].
Parameters
The Stitch project ID, taken directly from the Stitch project URL. Passed through to
stitchApi.project(projectId).A valid Stitch API key. In the MCP server, this is read from the
STITCH_API_KEY environment variable and passed here. Never hardcode API keys — always use the MCP server’s env config block.Optional list of screen IDs to fetch. When provided, only screens whose
id appears in this list are returned. When omitted, all screens in the project are fetched. An empty array is treated the same as omitting the parameter.Return type: RawScreen[]
The screen’s unique identifier from the Stitch API.
Human-readable screen name. The fetcher reads
screen.data.displayName first, then screen.data.title, and falls back to screen.id if neither field is present.Full HTML string for the screen, as returned by
screen.getHtml(). This is the raw Stitch export — it includes <head>, font links, Tailwind config scripts, and the full <body>.SDK usage
The fetcher uses@google/stitch-sdk v0.0.x, which exports two classes:
StitchToolClient— low-level transport. Accepts{ apiKey }and requiresconnect()to be called before use.Stitch— high-level domain API. WrapsStitchToolClientand exposesproject(id).
Promise.all.
Optional SDK dependency
The@google/stitch-sdk package is a runtime-optional dependency. It is dynamically imported inside fetchScreens so that the MCP server starts successfully even if the SDK is not installed — the error only surfaces when you actually call convert_stitch_to_react with a projectId.
If the SDK is not installed, you will see:
Error cases
| Condition | Error message |
|---|---|
@google/stitch-sdk is not installed | @google/stitch-sdk is not installed. Run: npm install @google/stitch-sdk |
| Project has no screens | No screens found in project {projectId} |
screenIds provided but none match | No screens found in project {projectId} matching screen IDs: {ids} |
| Invalid API key or project ID | Error propagated from the Stitch SDK (network / auth error) |
MCP server configuration
Skipping the fetcher
If you have the HTML already — from a Stitch export, a prior fetch, or a local file — pass it directly viahtmlScreens to skip the fetcher entirely. This requires no API key and no SDK installation: