mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-13 13:22:57 +00:00
fake-upstream/src/catalogue.ts ports infra/fake-storyteller-web's catalogue: the real model ids, creators and display names for image, video, audio, mesh and splat, with one representative capability profile per kind. The image and video endpoints' own `provider` filter (OmniGen*ModelsProvider: "artcraft" — the default — or "all") is mirrored, including a 400 for other values; audio, mesh and splat declare no filter and list everything. All five catalogues validate against the spec. src/mcp/tools/list-models.ts always asks upstream for "all" so the catalogue is complete, applies the caller's GenerationProvider filter client-side via the providers block, and passes each model's capability fields through verbatim — what lets a client build a valid estimate_cost call from one source of truth. Typecheck caught the contract mismatch on the way: the tool first sent GenerationProvider values as the endpoint's query, which the fake accepted and production would reject; the generated types refused it. Tests (5 tool + 8 fake): normalisation and pass-through, "all" query for image/video, client-side provider filtering for every kind, every kind served; spec-valid catalogues, upstream's default and enum, no-filter kinds listing everything. Server and handler suites list the tool under read:catalog. Claude-Session: https://claude.ai/code/session_01H3gfN2NCx3hBXSrZXYHUQ3
Artcraft MCP server
Cloudflare Worker at mcp.getartcraft.com. Read CLAUDE.md first — it holds the constraints,
the architecture, and the working method; this file is only how to run things.
Run locally
corepack enable # once; provides the pinned pnpm
pnpm install
cp .dev.vars.example .dev.vars
pnpm --filter @artcraft/mcp-fake-upstream dev # fake API on http://localhost:12345
pnpm dev # MCP server on http://localhost:8787
Local never talks to production: wrangler.toml's top-level block points at the fake, and
src/config.ts refuses to start otherwise.
Check everything
pnpm check # typecheck (regenerates Worker types) · lint · format · test
pnpm test # vitest, inside workerd with the local bindings
Deploy
Deploys run from .github/workflows/mcp.yml on main once the Cloudflare secrets exist
(docs/infra-request.md). Manual deploys, when needed:
pnpm deploy:preview # workers.dev, talks to the deployed fake
pnpm deploy:production # mcp.getartcraft.com, talks to api.storyteller.ai
Layout
See CLAUDE.md → Layout.