Building a Stateful AI Comic Studio Over Streamable HTTP MCP (for Claude Code, Cursor & Antigravity) StarVeil AI 2.0 shipped a stateful comic-generation server over Streamable HTTP MCP, exposing 18 agent-callable tools that split comic creation into four state transitions: a persistent character identity vault, chained page rendering that carries a previousTaskId forward, 3-zone bounding-box region patching for text edits, and art-preserving localization into six languages. The team reports that stateless text-to-image APIs fail on sequential pages with consistent characters and legible speech bubbles, and that a 2%–3% halo buffer around edited speech bubbles prevents lettering artifacts without full rerolls. The server supports OAuth 2.1 for Claude Code and revocable sv_live_ API keys for headless automation, and the team documented a Cloudflare Workers OAuth 2.1 JWKS issue hit during Glama certification. TL;DR : Calling stateless text-to-image APIs from an AI coding agent breaks down as soon as you need two consecutive comic pages with the same character and legible speech bubbles. This post walks through the 4-Stage Agent Comic State Machine we shipped over Streamable HTTP MCP https://starveilai.com/api/mcp , the 3-Zone Bounding-Box geometry that fixes typos without full rerolls, and a real Cloudflare Workers OAuth 2.1 JWKS gotcha we hit during Glama certification. AI coding agents Claude Code, Antigravity, Cursor, Codex, OpenClaw are great at multi-step tool loops, yet terrible at drawing sequential comics with raw image generators. The bottleneck isn't aesthetics — it's missing state : Following the open Model Context Protocol specification https://modelcontextprotocol.io/specification and IETF RFC 9728 https://datatracker.ietf.org/doc/rfc9728/ OAuth 2.0 Protected Resource Metadata, StarVeil AI 2.0 splits comic generation into four explicit state transitions across 18 agent-callable MCP tools plus an embedded MCP App side-pane : | Stage | MCP Tool s | What State It Locks | Cost | |---|---|---|---| | 1. Persistent Identity Vault | create character , list my characters | Canonical face, hair, proportions, and default silhouette characterIds | 0 cr upload photo / 20 cr AI ref sheet | | 2. Chained Page Render | create comic page , get comic page | Previous page context previousTaskId so Page 2+ keeps outfits & ink on fresh layouts | 25 cr per 3:4 page 1st page free on trial v1 | | 3. 3-Zone Region Patch | edit comic page | Anchor Zone locked + 2%–3% Halo Buffer + Active Rewrite Zone 0..1 bbox | 25 cr per edit 1st edit free on trial v1 | | 4. Art-Preserving Localization | translate comic , get translation status | Downstream 6-language derivatives en , zh-CN , zh-TW , ja , ko , es from sourceVersionId | 10 cr per page ~$0.06 on $6 pack | Claude Code OAuth 2.1 — one-click browser approval, no secrets in chat claude mcp add --transport http starveil https://starveilai.com/api/mcp Antigravity / Cursor / Codex / CLI installs plugin, starveil-cli, and SKILL.md curl -fsSL https://starveilai.com/install.sh | bash For headless automation OpenClaw , n8n , GitHub Actions, cron jobs , generate a revocable sv live Personal API Key at https://starveilai.com/app/agents and send Authorization: Bearer sv live ... to the exact same endpoint. { "tool": "create character", "arguments": { "name": "Mochi the Tabby", "description": "Warm orange tabby kitten wearing an indigo developer hoodie", "referenceImageUrl": "https://example.com/mochi-photo.jpg" } } previousTaskId { "tool": "create comic page", "arguments": { "title": "The Yarn Ball Incident - Page 2", "characterIds": "chr mochi 01" , "previousTaskId": "task page1 id", "artStyle": "warm watercolor healing storybook comic", "language": "en", "prompt": "Direct continuation after Page 1. Panel 1: Sleepy engineer enters with coffee staring at the red yarn web. Panel 2: Mochi peeks out: \"Good news: zero merge conflicts.\" Panel 3: Warm sunrise wide shot as the engineer laughs." } } Informed by masked diffusion inpainting RePaint, arXiv:2201.09865 https://arxiv.org/abs/2201.09865 , mask geometry matters as much as the prompt. Leave a 2%–3% halo buffer outside the black balloon stroke so old letters don't leave artifacts while everything outside the box stays anchored: { "tool": "edit comic page", "arguments": { "taskId": "task noir page1", "instruction": "Text-only edit inside the boxed white speech bubble: replace text with exact words \"He left at midnight.\" Keep face, rain lighting, and surrounding panels unchanged.", "region": { "x": 0.54, "y": 0.06, "width": 0.40, "height": 0.16 } } } When we submitted StarVeil MCP to Glama's connector directory https://glama.ai/mcp/connectors/com.starveilai/star-veil-ai , OAuth authorization succeeded in the browser, yet hourly tools/list health checks returned HTTP 500 . The culprit: Better Auth's mcpHandler { jwksUrl } fetches https://starveilai.com/api/auth/jwks over HTTP during token verification — which on Cloudflare Workers triggers a same-zone self-fetch back to the same Worker route and fails under edge proxy rules. The fix was replacing the remote JWKS HTTP fetch with an in-process local JWKS lookup directly against Cloudflare D1 jose.createLocalJWKSet + jwtVerify with exact issuer / audience verification . Latency dropped, the HTTP 500 disappeared permanently, and Glama's hourly introspection now reports Healthy with OAuth: Works in Glama . latestDownloadUrl or open open starveil studio before chaining Page 2+. New verified accounts receive 1 free full-color 3:4 page + 1 free box-edit + 0-credit photo OC uploads trial v1 . Never-expiring credit packs start at $6 Mini 1,000 credits, ~40 pages and immediately unlock 100% watermark-free commercial PNG downloads across Web, MCP, CLI, and API. com.starveilai/star-veil-ai@2.0.0