Sign inSign up

hayone/craft-ai-hub

By hayone

•Updated 6 days ago

Launcher, proxy and Claude Code assistant overlay for the storytold craft web apps

Image
0

350

hayone/craft-ai-hub repository overview

⁠craft-ai-hub

A front door for the storytold craft apps⁠ (PhotoCraft, VectorCraft, LightCraft, FilmCraft, EffectCraft and the rest) with an AI assistant built in.

  • Launcher: one page that lists your apps.
  • Proxy: serves every app under /<app>/ from its own container, by URL or port.
  • Assistant overlay: a chat on top of every app that collapses to an "Ask AI" button, floats (drag, resize) or docks to the side while the canvas makes room. The apps carry no chat code.
  • Chat on Claude Code: replies come from Claude Code signed in with a Claude subscription (each person's own, or one shared by the hub), so you don't need an API key. Claude works on the document open in your tab.
  • A full chat composer, like Claude Code's: pick the model and effort, show or hide thinking, choose a mode (Manual, Edit automatically, Plan, Bypass permissions; Shift+Tab cycles), attach or paste images, stop a reply, expand each tool call's input and result, see tokens and time per turn, switch between earlier chats, and use slash commands (/model, /effort, /mode, /clear, /compact, /help).
  • Your own Claude Code too: the overlay's Connect tab gives each tab its own MCP URL and a claude mcp add command, so a Claude Code session or a claude.ai connector can drive several tabs and apps at once.

Works from any browser, an iPad included: the app runs in the tab, Claude runs on the server.

⁠How it works

browser ──▶ craft-ai-hub ──▶ /<app>/        app containers (hayone/<app>:remote)
               │         ──▶ /_relay/…      craft-mcp: the tab's WebSocket and the MCP endpoints
               └─ chat: Claude Code ──MCP──▶ craft-mcp ──▶ app CLI ──▶ the user's tab
  • craft-mcp⁠ relays MCP calls to the tab. Each browser mints its own signed, expiring relay key per app, and chats are tied to that key, so no two browsers or users share a session.
  • The :remote app images (built in hayone1/Docker_Images⁠) add the page API and MCP connector the overlay uses. Apps without them still open from the launcher, without the assistant.

⁠Run it

Pick an example, copy its .env.example to .env, fill it in, and docker compose up -d:

ExampleFor
basic-auth⁠Trying it out: everything on one machine, user names and passwords in BASIC_AUTH
caddy-https⁠Your own domain with automatic HTTPS (Caddy, Let's Encrypt) and basic auth
oauth2-proxy⁠Sign-in with your OpenID Connect provider (Google, Entra, Keycloak, Authentik, …) through oauth2-proxy⁠
cloud-storage⁠Sign-in through craft-mcp plus personal and shared cloud folders in an S3 bucket, for Open and Save
external-apps⁠Apps that already run elsewhere (other ports or servers): just the hub and the relay
kubernetes⁠The hub, the relay and an app as Deployments, behind an Ingress

Each one publishes only the front door; the apps and the relay stay on the private network.

⁠Claude accounts

Chat runs on Claude subscription tokens from Claude Code. Create one on any computer signed in to Claude Code (Pro or Max plan):

claude setup-token

CHAT_TOKENS decides whose account a chat uses:

CHAT_TOKENS
personalEveryone adds their own token in the overlay's Account tab. The default without a shared token.
bothTheir own token if they added one, otherwise the hub's CLAUDE_CODE_OAUTH_TOKEN. The default with one.
sharedEveryone uses CLAUDE_CODE_OAUTH_TOKEN.
offNo in-app chat; the Connect tab still works.

A personal token stays in that person's browser: the hub encrypts it (AES-GCM, HUB_SECRET) into an HttpOnly cookie that only /_hub/ receives, so neither the apps' scripts nor the hub's disk ever hold it. People set it up once per browser, from a computer, and then chat from anywhere, an iPad included.

⁠Configuration

VariableDefault
APPS(required)name=url pairs: photocraft=http://photocraft:8080,vectorcraft=http://localhost:8082. Order is the launcher's.
RELAY_URLcraft-mcp's internal URL. Without it there is no assistant.
MCP_KEYThe same value craft-mcp has. craft-mcp's PUBLIC_HOST must be <hub origin>/_relay.
CHAT_TOKENSpersonal, or both with a shared tokenWhose Claude account chats use (see above).
CLAUDE_CODE_OAUTH_TOKENThe hub's shared token.
HUB_SECRETderived from MCP_KEYEncrypts personal tokens. Changing it signs every browser's token out.
CHAT_MODEL, CHAT_EFFORTClaude Code'sDefaults when the composer leaves them on Default and Auto.
CHAT_MODELSOpus, Sonnet, Haiku 5.5, Fable 5.1The composer's model menu, as JSON [{"value": "<model id>", "label": "<name>"}].
BASIC_AUTHuser:password pairs, comma separated.
REQUIRE_SIGN_INfalsetrue signs people in through craft-mcp's own OpenID Connect client (its AUTH_* settings).
PUBLIC_ORIGINfrom the requesthttps://<host>, used for the sign-in callback.
PORT8080
⁠Sign-in

Choose one:

  • An auth proxy (recommended): oauth2-proxy, Pomerium, Authelia, Cloudflare Access, or your ingress's auth. Let /_relay/ through without sign-in: MCP clients and the tab's WebSocket authenticate with their relay key, and claude.ai connectors can't sign in.
  • BASIC_AUTH: built in. /_relay/ and /healthz stay open for the same reason.
  • REQUIRE_SIGN_IN: if craft-mcp already signs people in for cloud storage, the hub can use that session. Register <hub origin>/_storage/callback with the provider.

Keep the hub private. Claude subscription tokens are for personal use: with a shared token, every chat on the hub uses that one plan.

⁠Routes

Path
/Launcher
/<app>/…The app, with the overlay injected into its pages
/<app>/_assistant/sessionMints the tab's relay key (craft-mcp /mint)
/<app>/_storage/…, /_storage/…craft-mcp cloud storage and its sign-in
/_relay/…craft-mcp: the tab's WebSocket, /<key>/<app>/mcp
/_hub/overlay.js, /_hub/chat, /_hub/chat/permission, /_hub/tokenThe overlay, its chat and permission answers, and the person's own token
/healthzHealth check

⁠Develop

npm install
APPS=photocraft=http://localhost:4101 node server.mjs

Node 22. No build step: server.mjs (proxy, launcher, auth), chat.mjs (Claude Code), public/overlay.js (the overlay).

⁠License

MIT⁠. The craft apps themselves are © their authors under their own licenses (MIT or Apache-2.0); see storytold⁠.

Tag summary

Content type

Image

Digest

sha256:540770d5e…

Size

302 MB

Last updated

6 days ago

docker pull hayone/craft-ai-hub