Catalog row #1 (mode) · README · starters/catalog.json
A backend-only package. It registers one schema and serves it through createCmsApiHandler() on a plain Node HTTP server. Callers reach that schema three ways: the versioned HTTP API, the typed client, and MCP. Every caller authenticates with an API key.
CMS features it relies on: one collection, API keys with built-in roles, the versioned ops endpoint, the /api/mcp endpoint, @tanstack/cms-client, and the review queue for agent-tool writes.
starters/headless-api/src/cms.definition.ts: the collections (definition). It imports only@tanstack/cms-core/definition, so client code and Vite config can load it.starters/headless-api/src/cms.config.ts:registerHeadlessCms()and a bootstrapauth.getUser.starters/headless-api/src/server.ts:createHeadlessHandler()wrapscreateCmsApiHandler()innode:http. It is the only starter whosedevscript starts a server (port3031).starters/headless-api/tests/contract.test.ts: the S3/S5 contract suite.
contentItemhas these fields:title(text, required),slug(slug fromtitle),channel(select:web/ios/android/agent),priority(number), andbody(richtext).blockTypes: []. Storage is the default SQLite store at<dataDir>/cms.db.
- Writes made through the agent tool
save_document(withcreate: true), whether from the typed client or from MCP, are always staged withstageWrite. The test asserts that both writes sit inlistPending(), thatgetAs(ctx, { …, staged: false })returnsnullfor them, and that they become visible only afterapprove().
auth.getUsermaps anx-cms-rolerequest header to a session. That header exists only to bootstrap keys: the test mintseditorandviewerkeys through the built-increateApiKeyop.- Real callers send
Authorization: Bearer <key>. The CMS resolves the key's role itself, sogetUserreturnsnullfor those requests. - The
viewerkey gets403onsave_document, because the built-inviewerrole has nocontent.write.
- HTTP:
POST /api/cms/v1/ops/:namethroughcreateCmsApiHandler(). - Typed client:
createCmsClient({ baseUrl, fetch, getAuthHeader })withclient.call('save_document', …), wherefetchis wired straight to the handler. - MCP: JSON-RPC
tools/callposted to/api/mcpon the same handler, with the same bearer key.
- No admin UI (
@tanstack/cms-ui-reactisn't a dependency) and no public rendering. Both are out of scope in the catalog. - No custom
defineOpoperations, hooks, events, blocks, relations, media, search, import/export, orcreateDbAuth. @tanstack/aiand@tanstack/ai-mcpare dev dependencies but nothing imports them.- The
x-cms-roleheader stub grants any role to any caller who sends it. Replace it before deploying, for example by bootstrapping the first admin key from a CLI or seed script. - The catalog's "TanStack DB companion" is
examples/db-sqlite. This package doesn't import it.
- The README's "Agent contracts used: none (external MCP callers)" and "per-agent actors" both describe API-key roles. The code has no per-agent actor mapping beyond the key's name and role.
docs/api/cms-api.md:createCmsApiHandler,invokeAnyOp.docs/api/cms-client.md:createCmsClient.docs/mcp/http-mcp-server.mdanddocs/mcp/operations-registry.md.docs/api/routes-and-endpoints.md:/api/cms/v1/ops/:name,/api/mcp.docs/architecture/authentication.md: API keys, roles.docs/agents/review-queue.md: why agent writes are staged.