0021. Remote MCP with OAuth, social sign-in with an age step, more AI providers, the docs site
- Status: Accepted 2026-11-28 (Phase 3b-2; owner decisions 2026-11-28: MCP edits go to the branch draft, user-typed model URLs public https only, Starlight for the docs site)
- Date: 2026-11-28
- Phase: 3
Context
Section titled “Context”Phase 3b-2 opens the platform to outside AI tools (MCP clients such as Claude Code and Claude Desktop), adds sign-in with Google, GitHub and Discord (which give no birth date, while accounts are 13+ and store only an age group, ADR 0019), lets the editor’s assistant use providers other than Anthropic (ADR 0013), and publishes the docs.
Decision
Section titled “Decision”- Remote MCP at
/mcp(Streamable HTTP,@modelcontextprotocol/serverv2): the 2026-07-28 protocol and, for older clients, stateless 2025 serving. Tools work on the signed-in creator’s editor workspaces (ADR 0020): every agent tool (ADR 0013) runs on a scratch copy of a branch draft, and what it changed is validated and saved to that draft (owner decision);commit,restore,list_commits,list_gamesandcreate_game(from a template) complete the set. One call at a time per game. Game code runs only through the sandbox runner. Screenshots are not offered (they would run game code in the server). - OAuth 2.1 through Better Auth’s
jwt,mcpandcimdplugins: the server is its own authorization server; clients register dynamically (2025 clients) or with client ID metadata documents (2026-07-28, fetched only from public HTTPS addresses), use PKCE, and get tokens bound to the/mcpresource. Scopes:games:read(read games, docs, run checks) andgames:write(change files, create, commit, restore); a token only sees the tools its scopes allow. The consent page (/oauth/consent) names the scopes in plain words and warns that apps name themselves. Connected apps on/accountlists and removes apps;/mcpchecks the consent on every request, so removal ends access at once. Personal access tokens work too (all scopes). Accounts that are banned, unverified or still in the age step cannot use MCP. - Social sign-in (Google, GitHub, Discord; each on when its client id and secret are set): a new account gets
a generated handle and no age group. Until the age step (
/welcome: date of birth, handle, terms) it is treated as signed out everywhere except finishing the step or signing out. Under 13: the account is deleted and nothing is kept. Only the age group is stored, as for email sign-up. An app’s OAuth request is resumed after social sign-in. - More AI providers through the Vercel AI SDK (
aiv7): OpenAI, any OpenAI-compatible server, and Ollama through its OpenAI-compatible API (no community package). Claude stays on the official Anthropic SDK and Opus 5.5 stays the default. Settings (key, base URL, model) are stored encrypted like Anthropic keys. User-typed URLs must be public https (owner decision): the address is checked when each connection is made, against the DNS answers the connection uses, and redirects are refused;PLATFORM_AI_ALLOW_PRIVATE_URLS(on in local mode) allows private addresses and http for a local Ollama. - Docs website: Astro Starlight in
apps/docs. A sync script copiesdocs/andrecipes/in (titles from headings, links rewritten), and publishesllms.txt, the JSON Schemas and the TypeDoc output; Pagefind search.docs/stays the single source.
Consequences
Section titled “Consequences”- Eight OAuth tables (migration 0003, generated from the plugins’ table list);
user.age_bracketis nullable (0004). - Access tokens are JWTs valid for an hour; other resource servers would not see a removed consent until expiry,
but
/mcpchecks it on every request. - Dynamic client registration is open, so the client table can grow with unused registrations; clean-up comes with production (Phase 7).
- Social sign-in needs OAuth apps registered with each provider (callback
<web origin>/api/auth/callback/<id>); without them the buttons are hidden. Tests use a stand-in Google provider. - MCP edits and the editor share drafts: an editor tab open on the same branch shows MCP changes after a reload.
- Mermaid diagrams in the docs show as code on the site until a diagram plugin is added.