AI
MCP server
Add /mcp to Claude, sign in on the site, and let it run the site.
createCMS returns the MCP server as its own router, cms.mcp, which the reference app mounts at the site root: https://<host>/mcp (pass mcp: false so the REST router under /api does not serve it too). It is stateless Streamable HTTP: JSON-RPC 2.0 over POST with JSON responses, so it fits a single Workers request and needs no session store. Every tool goes through the same access checks as REST.
Connect Claude
Add https://<host>/mcp as a custom connector in Claude (or run the command below in Claude Code). Nothing else is needed: the first call gets a 401 that points to /.well-known/oauth-protected-resource/mcp, Claude registers itself, opens the site's sign-in page, and asks you to allow access on /consent. It then acts with your account's permissions.
claude mcp add --transport http cms https://<host>/mcpSign-in is OAuth 2.1 from Better Auth's @better-auth/mcp plugin with the jwt plugin (configured in auth.ts): dynamic client registration, PKCE, and access tokens bound to the /mcp resource. The /mcp route verifies them against the signing keys in D1.
API keys
Agents that cannot sign in interactively (CI, scheduled jobs) use an API key from /admin/api-keys as a Bearer token instead:
claude mcp add --transport http cms https://<host>/mcp --header "Authorization: Bearer cms_..."To keep a human in the loop, connect with an editor account or key: the agent drafts and requests review, and an admin publishes and approves proposals.
Resources
cms://guide: how to operate the CMS and build pagescms://catalog: the host's page components (site.specGuide)cms://collections: every definition
Tools
get_overview,get_collection,propose_schema_change,list_proposals,approve_proposal,reject_proposallist_documents,get_document,create_document,update_document,patch_document,delete_documentpublish_document,unpublish_document,request_review,withdraw_review,schedule_publish,cancel_scheduled_publishlist_revisions,restore_revision,translate_document,list_tags,search,get_activityget_global,update_global,list_media,upload_media,delete_mediapreview_page,validate_spec
Engine errors come back inside the tool result with isError so the agent can read them and retry; read-only tools carry readOnlyHint. A typical page edit is: read cms://catalog, update the page, check it with preview_page, fix details with patch_document (JSON Patch), then request review.