@typeroll/mcp-server 0.44.74 → 0.45.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -49,13 +49,10 @@ maps to one HTTP endpoint; the actual logic runs in the customer's portal
49
49
  - `html` — body lives in `html_content` as a single HTML string.
50
50
  Useful when you have hand-written markup to drop in directly.
51
51
 
52
- Slug is a single path segment — no slashes. `about` → `/about`,
53
- `kontakt` → `/kontakt`, empty string `""` → homepage. The v1 API
54
- rejects `services/design` and other slash-containing slugs with
55
- "Invalid slug … slugs must not contain slashes." For nested URLs
56
- like `/blog/{slug}` or `/services/{slug}`, the right primitive is a
57
- **collection with `route_template`** (see the `tr-blog` and
58
- `tr-directory` skills) — not a flat page with a slashed slug.
52
+ Every Page has a `content_type` (default `page`) and a `fields` object for
53
+ custom values. Slug is one segment; use an explicit `path` for a nested URL,
54
+ or let the content type's `route_template` derive it. All articles and
55
+ directory entries are Pages created with `create_page`.
59
56
 
60
57
  - **Partials = global blocks.** Three kinds:
61
58
  - `header` — auto-injected at the top of every page.
@@ -69,14 +66,14 @@ maps to one HTTP endpoint; the actual logic runs in the customer's portal
69
66
  it the same way as a page. Useful for header/footer authored with
70
67
  block types.
71
68
 
72
- - **Collections.** Repeatable content types (blog, team, events,
73
- products, restaurants for a directory site, etc.). Each has a schema
74
- (`fields[]`) and optional **per-item routing** via `route_template`
75
- (e.g. `/restaurants/{slug}`). When set, every published item gets its
76
- own static URL rendered through `item_template_blocks` (preferred) or
77
- `item_template_html`. Native `article` and `checklist` presets are available
78
- through `template_kind`. Set
79
- `route_template=""` to opt out and keep the collection listing-only.
69
+ - **Content types.** A field schema, URL pattern and optional default Page
70
+ template. Use `create_content_type`, `read_content_type`,
71
+ `update_content_type` and `list_content_types`. Title, slug, body, status and
72
+ SEO already belong to the Page; define only custom fields. An empty
73
+ `route_template` gives Pages no public detail URL while retaining their data.
74
+ List entries with `list_pages content_type=...`. Page IDs are unique within
75
+ the site, across all content types. `change_page_content_type` preserves a
76
+ saved Page's identity and existing URL and records a revision.
80
77
 
81
78
  - **Settings.** Site name, tagline, logo, favicon, colors, fonts,
82
79
  contact info, social links, SEO suffix, default meta description
@@ -118,10 +115,11 @@ maps to one HTTP endpoint; the actual logic runs in the customer's portal
118
115
  the final update.
119
116
 
120
117
  - **Page templates.** A `PageTemplate` is a Block[] tree that wraps a
121
- page's body. The template contains exactly one block of type
118
+ page's body. The template contains a block of type
122
119
  `template_content_slot` — at render time that block gets replaced by
123
120
  the page's own `blocks`. Set `Page.template = "<template-id>"` to
124
- apply a template to a page.
121
+ apply a template to a page, or set the content type’s `template` default.
122
+ Use `create_page_template starter="article"` for a native starting layout.
125
123
 
126
124
  - **Block types.** A site has three sources of block types:
127
125
  - **Core** (origin: 'core', ids like `core/section`) — shipped in
@@ -160,8 +158,8 @@ maps to one HTTP endpoint; the actual logic runs in the customer's portal
160
158
  visit time. Index = page content only (nav/footer excluded); noindex
161
159
  pages stay out. Editor preview shows a placeholder note (the index
162
160
  only exists on the deployed site).
163
- - **Archive pagination** (0.29.0+): a collection listing
164
- (`core/collection_list` / `core/repeater`) with `paginate: N` renders
161
+ - **Archive pagination** (0.29.0+): a Page listing
162
+ (`core/page_list` / `core/repeater`) with `paginate: N` renders
165
163
  N items per page + a pager, and the build generates `/page/2/`… routes
166
164
  automatically. `paginate` supersedes `limit`; one paginated listing
167
165
  per page.
@@ -232,24 +230,24 @@ maps to one HTTP endpoint; the actual logic runs in the customer's portal
232
230
  Prefer real blocks when one fits.
233
231
  - **Structured records at scale** (template_capabilities_version ≥ 0.31.0).
234
232
  Four things landed together for directory-shaped sites:
235
- - `collection_completeness` — **start an enrichment pass here**, not by
233
+ - `page_completeness` — **start an enrichment pass here**, not by
236
234
  paging every item. Returns per-field gap counts plus the N worst
237
235
  records (missing fields, never-verified fields, fields whose last write
238
236
  is older than the staleness window), computed at read time. Fields no
239
237
  API key may write are excluded by default: a gap you can't close is
240
238
  noise.
241
- - **Per-field write authority.** A collection field can declare
239
+ - **Per-field write authority.** A content type field can declare
242
240
  `writable_by` (`portal | owner | agent | app | import`). A write you're
243
241
  not permitted, or one that would overwrite a higher-precedence writer
244
242
  (a human correction, the listed business's own edit), comes back as
245
243
  **409 with the losing field names** — never a silent no-op. Treat that
246
244
  as "already handled" and record it; retrying will lose again.
247
- - **Item references.** `item_ref` / `item_ref_list` fields point at items
248
- in another collection (`ref_collection`). The reverse direction is
245
+ - **Item references.** `page_ref` / `page_ref_list` fields point at items
246
+ in another content type (`ref_content_type`). The reverse direction is
249
247
  computed at render time — don't try to maintain backlinks yourself.
250
248
  Render them with a `core/repeater` whose `source_type` is `related`
251
- (a ref field on the current item) or `backlinks` (who points at it).
252
- - **Taxonomy pages.** `CollectionDef.facets` generates one page per
249
+ (a ref field on the current Page) or `backlinks` (who points at it).
250
+ - **Taxonomy pages.** `ContentType.facets` generates one page per
253
251
  distinct field value. ⚠️ This turns record count into ROUTE count, and
254
252
  route count is what the build timeout measures. `min_items` (default 2)
255
253
  keeps thin-content pages out, and combination pages must be listed
@@ -314,10 +312,10 @@ maps to one HTTP endpoint; the actual logic runs in the customer's portal
314
312
  a content diff — trust it for stakeholder review.
315
313
 
316
314
  - **Deploys.** Customers see live changes only after a deploy. Preview
317
- always sees drafts. `trigger_deploy` enqueues; `get_deploy_status`
315
+ sees saved content unless `include_working_copy:true` is requested. `trigger_deploy` enqueues; `get_deploy_status`
318
316
  reports `queued → running → succeeded | failed`.
319
317
  `trigger_deploy dry_run=true` builds without publishing — use it to prove
320
- a structural change compiles (new collection, schema edit, template
318
+ a structural change compiles (new content type, schema edit, template
321
319
  rewrite) without touching the live site.
322
320
  A finished job carries `cost`: total, cpu/memory/request split,
323
321
  `duration_s`, per-phase timings, and output size. Estimates from a rate
@@ -349,7 +347,7 @@ maps to one HTTP endpoint; the actual logic runs in the customer's portal
349
347
  that build.
350
348
  - **THE BUFFER MODEL — every content write is a draft; saving is always
351
349
  explicit.** All content writes (update_page, replace_page, block tools,
352
- update_partial, update_collection_item, batch/bulk tools) land in a
350
+ update_partial, batch/bulk tools) land in a
353
351
  per-doc *working copy* — the same draft layer the portal editor
354
352
  autosaves into. Deploys and plain preview links see SAVED content only;
355
353
  your drafts are invisible to them until committed. The loop:
@@ -404,8 +402,8 @@ not optional discovery.
404
402
  4. `list_partials` — what shared blocks already exist. **Defaults to
405
403
  summary mode** (no html_content, just bytes count) — pass
406
404
  `include_content: true` if you actually need the bodies inline.
407
- 5. `list_collections` — what content types exist + their schemas +
408
- `route_template` (so you know if items have URLs).
405
+ 5. `list_content_types` — what content types exist + their schemas +
406
+ `route_template` (so you know which Pages have public URLs).
409
407
  6. `get_site_capabilities` — renderer version and feature flags. Never infer
410
408
  support from remembered release notes.
411
409
  7. `list_block_types` — every block type usable on this site: core
@@ -460,8 +458,8 @@ list_pages limit=200 → inventory
460
458
  batch_read_pages page_ids=[…] → bulk-load bodies
461
459
  list_partials → shared blocks (summary)
462
460
  find_pages_using_block partial_id=<id> → blast radius per block
463
- list_collections → content types + routing
464
- list_collection_items collection=<name> → items (richtext hidden)
461
+ list_content_types → content types + routing
462
+ list_pages content_type=<name> → Pages of that type
465
463
  ```
466
464
 
467
465
  `find_pages_using_block` for the header or footer returns the full
@@ -579,49 +577,25 @@ which preserves the raw HTML losslessly. Run with `convert_page_to_blocks
579
577
  dry_run=true` first if you want to inspect the proposal before
580
578
  committing.
581
579
 
582
- ### "Build a directory site / import structured data"
580
+ ### "Build a directory or migrate a content family"
583
581
 
584
- ```
585
- create_collection
586
- name="restaurants"
587
- label_singular="Restaurant" label_plural="Restaurants"
588
- fields=[ ...title, slug, address, phone, cuisine, body... ]
589
- route_template="/restaurants/{slug}"
590
- template_kind="article"
591
-
592
- # For each row in your source data:
593
- create_collection_item collection="restaurants" fields={…} status="published"
594
-
595
- # Each published item now lives at /restaurants/{slug}, included in
596
- # sitemap.xml. Preview a specific one:
597
- get_preview_link collection_name="restaurants" item_id="<id>"
598
-
599
- # Optional listing page:
600
- list_collection_items collection="restaurants" limit=200
601
- update_page page_id=restaurants patch={ html_content: "<hand-written listing>" }
602
- ```
603
-
604
- For articles and checklists, prefer the native `article` / `checklist`
605
- `template_kind` presets or an explicit `item_template_blocks` tree. Exact
606
- bindings such as `core/button.href = "{{item.pdf_url}}"` are supported on
607
- typed text/URL/image fields. `template/item_body.field`,
608
- `template/page_date.field`, and `core/table_of_contents.source_field` select
609
- the named item field. Breadcrumbs and outlines exist in initial HTML. Use
610
- explicit neighbor fields on `template/item_navigation` only when imported
611
- navigation must differ from collection sort order.
582
+ Read `tr-directory` or `tr-blog` for the full recipe. Create a reusable layout
583
+ with `create_page_template`, then a Content type whose `template` references
584
+ it. Create each entry with `create_page`, passing `content_type`, top-level
585
+ metadata, `fields` for custom values, and `blocks` for the body. Do not define
586
+ another body or title in the custom schema.
612
587
 
613
- ### "Migrate a content type (e.g. WP custom post type)"
588
+ A listing Page uses `core/page_list` with `content_type`; it updates from saved
589
+ Pages at every preview/build. Template tools target `{ kind: "template", id }`.
590
+ The shared layout uses `template_content_slot` for the body, `template/page_*`
591
+ metadata blocks, and `{{page.field}}` bindings. Repeater children use
592
+ `{{item.field}}` for the current listed Page.
614
593
 
615
- ```
616
- list_collections # what exists today?
617
- read_collection name=blog # what fields are writable?
618
- batch_read_collection_items … # load items (richtext hidden)
619
- # Transform locally; then:
620
- update_collection_item … (or) create_collection_item …
621
- ```
622
-
623
- Fields outside the schema are silently dropped — call `read_collection`
624
- first if you're unsure what's writable.
594
+ For migration updates, read the content type and Page first, then use
595
+ `update_page page_id=... patch={fields:{...}} save=true` for authorized changes.
596
+ Unknown fields return an error. `page_completeness content_type=...` reports
597
+ missing/stale fields without loading every Page body. References use `page_ref`
598
+ or `page_ref_list` with `ref_content_type`. Preview with the returned Page ID.
625
599
 
626
600
  ### "Add images to a page"
627
601
 
@@ -1028,7 +1002,8 @@ preview.
1028
1002
  | **Pages — meta** | `get_page_preview` |
1029
1003
  | **Global blocks (partials)** | `list_partials` (summary by default), `read_partial`, `create_free_block`, `update_partial`, `replace_partial`, `set_partial_mode`, `delete_partial`, `find_pages_using_block`, `list_blocks_with_usage` |
1030
1004
  | **Block types** | `list_block_types`, `read_block_type`, `find_pages_using_block_type`, `export_block_types`, `import_block_types` |
1031
- | **Collections** | `create_collection`, `update_collection_schema`, `delete_collection`, `list_collections`, `read_collection`, `list_collection_items` (richtext hidden by default), `read_collection_item`, `batch_read_collection_items`, `create_collection_item`, `update_collection_item`, `delete_collection_item`, `regenerate_collection_listing` |
1005
+ | **Content types** | `list_content_types`, `read_content_type`, `create_content_type`, `update_content_type`, `delete_content_type`, `change_page_content_type`, `page_completeness` |
1006
+ | **Page templates** | `list_page_templates`, `read_page_template`, `create_page_template`, `update_page_template`, `delete_page_template` |
1032
1007
  | **Media** | `list_media`, `read_media`, `create_upload_url`, `upload_media_from_url`, `upload_media_inline`, `update_media`, `delete_media`, `finalize_media`, `finalize_all_media`, `generate_image_variants`, `suggest_alt_text_context` |
1033
1008
  | **Redirects** | `list_redirects`, `create_redirect`, `delete_redirect`. `from_path` may be a PATTERN: a trailing `*` (with `:splat` in the target) or `:name` for one segment — one rule retires a whole family of dead URLs (`/category/*` → `/blogg/:splat`). Mid-path splats and query strings are refused, as is any rule that would hide a live page. |
1034
1009
  | **Migration inventory + launch gate** | `get_migration_readiness` (preflight — CALL FIRST), `list_migration_urls`, `add_migration_urls`, `update_migration_url`, `update_migration_urls`, `delete_migration_url`, `import_sitemap`, `import_gsc_performance`, `repair_migration_plain_text`, `verify_migration_urls`, `record_migration_seo_acceptance`, `get_migration_launch_report`. Sitemap indexes are recursive. GSC supports direct Search Console access or CSV and aggregates fragment variants. Plain-text repair is allowlisted and dry-run-first. A complete unfiltered URL check and reviewed SEO evidence are bound to the latest hosted deploy; the launch report fails closed when either is stale or incomplete. |
@@ -1037,7 +1012,7 @@ preview.
1037
1012
  | **Core modules** | `list_apps`, `read_app`, `update_app` (legacy API name; admin; schema-driven config, masked secrets, redeploy when `affects_build` is true) |
1038
1013
  | **Extension installations** | `list_extension_installations`, `read_extension_installation`, `update_extension_installation_config` (admin; schema-driven config, masked secrets preserved, production deploy queued by default) |
1039
1014
  | **Analytics attribution** | `read_funnel_attribution`, `update_funnel_attribution` (specialized Analytics module tools; admin; redeploy after changes) |
1040
- | **Search + bulk** | `search_pages`, `check_internal_links`, `bulk_replace_text`. The link check is database-driven. Bulk replace defaults to pages but can target partials, collection items or all resources, always dry-run first. |
1015
+ | **Search + bulk** | `search_pages`, `check_internal_links`, `bulk_replace_text`. The link check is database-driven. Bulk replace defaults to pages but can target partials, Pages or all resources, always dry-run first. |
1041
1016
  | **Branches** | `create_branch`, `read_version`, `delete_branch`, `merge_branch` |
1042
1017
  | **Deploy** | `get_publication_impact`, `trigger_deploy`, `list_deploys`, `get_deploy_status` |
1043
1018
  | **Preview** | `get_preview_link`, `get_page_preview` |
@@ -1045,3 +1020,17 @@ preview.
1045
1020
  Every tool's input is validated server-side; the MCP server only does
1046
1021
  auth + shape. If a tool returns `isError: true`, the body carries
1047
1022
  `{ error, status, body }` from the underlying HTTP response.
1023
+
1024
+
1025
+ Content types also own `sort_field`/`sort_dir` and optional `allowed_templates`.
1026
+ Types define content; templates define presentation. Multiple compatible Page
1027
+ templates can be allowed, with `template` selecting the default. Null/absent
1028
+ `allowed_templates` is unrestricted, `[]` allows none, and a configured default
1029
+ must be in an explicit allowed list. Page overrides must be allowed; null/empty
1030
+ `Page.template` restores inheritance. Page template changes use Save/Discard.
1031
+
1032
+ Listings inherit type sorting unless explicitly overridden. `Page.sort_order`
1033
+ is the manual numeric order; null clears it. Missing sort values come last and
1034
+ IDs break ties. Explicit ID lists keep their order. Typed `list_pages` queries
1035
+ inherit type sorting and accept `sort_by`/`sort_order`; unfiltered API lists
1036
+ default to stable IDs. See the public Content types guide for editor steps.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The `@typeroll/mcp-server` package connects MCP-compatible AI clients to the
4
4
  [Typeroll CMS](https://typeroll.com) public API. Manage sites through tools to read and
5
- write pages, partials, collections, media, redirects, versions; trigger
5
+ write pages, partials, content types, media, redirects, versions; trigger
6
6
  deploys; mint preview links.
7
7
 
8
8
  The server is a **thin transport adapter** — tools call the Typeroll REST API,
@@ -10,6 +10,21 @@ with a few workflow tools composing consecutive API calls such as config plus
10
10
  deploy. Auth happens at the API layer with a site- or org-scoped key; the MCP
11
11
  just carries the bearer through.
12
12
 
13
+ ## One Page model
14
+
15
+ Core 0.2.0 and MCP 0.45.0 use one content entity: **Page**. Every article,
16
+ checklist, product, directory entry and ordinary page uses the same API, editor,
17
+ blocks, history, preview and status. `content_type` selects a schema, URL pattern
18
+ and default Page template. Custom values belong in `fields`; title, slug, path,
19
+ body, SEO and status are built-in Page properties. Use `page_ref`/`page_ref_list`
20
+ for references and a blank type route pattern for records without detail URLs.
21
+
22
+ Use `create_page`, `list_pages content_type=...` and the Content type/Page template
23
+ tools. Use the Page ID and the same site `version` throughout editing, references,
24
+ previews and builds. Existing installations must migrate before running this
25
+ release. See the [model guide](https://typeroll.com/docs/tools/content-types/) and
26
+ [upgrade procedure](https://typeroll.com/docs/guides/unified-pages-upgrade/).
27
+
13
28
  ## Two ways to connect
14
29
 
15
30
  - **Remote MCP — enter a URL.** Use a client with Streamable HTTP support
@@ -75,11 +90,11 @@ client using it stops working immediately.
75
90
  3. **Tell the agent what kind of work you want.** A good first message:
76
91
 
77
92
  > "Connect to Typeroll and tell me what you find — site name,
78
- > number of pages, what global blocks exist, what collections are
93
+ > number of pages, what global blocks exist, what content types are
79
94
  > defined. Then I'll give you a task."
80
95
 
81
96
  The agent can call `get_site`, `get_site_capabilities`, `list_pages`,
82
- `list_partials`, `list_collections`, and `list_block_types` in sequence and
97
+ `list_partials`, `list_content_types`, and `list_block_types` in sequence and
83
98
  report back. The capabilities + block palette are mandatory before it
84
99
  chooses HTML mode or reports a missing site-building feature.
85
100
 
@@ -143,7 +158,7 @@ the full reference + concrete operation recipes.
143
158
  - **Blocks (instances)** — `get_page_blocks`, `add_block`,
144
159
  `update_block`, `move_block`, `remove_block`, `duplicate_block`,
145
160
  `set_block_responsive`. All take a `target` (page, partial, page
146
- template, or collection item-template), so one tool family edits
161
+ template), so one tool family edits
147
162
  every block container.
148
163
  - **Global blocks (partials)** — list (summary mode by default), read,
149
164
  create free block, update, replace, delete, `set_partial_mode`,
@@ -154,15 +169,14 @@ the full reference + concrete operation recipes.
154
169
  client-side JS (`script`) is honoured only when the site has enabled
155
170
  "Allow AI to write block scripts" (a human-set portal setting) —
156
171
  otherwise it's stripped with a warning.
157
- - **Collections + items** — create/update/delete the collection schema
158
- itself (incl. `route_template` for per-item URLs and native `article` /
159
- `checklist` template presets); list/read/batch-
160
- read/create/update/delete items. Existing-collection tools consistently
161
- use `collection` (the old `name` argument remains accepted as an alias).
162
- Collection repeaters support `group_by`, and item templates can place
163
- `template/item_navigation` for deterministic or explicitly field-bound
164
- previous/next links. Typed context bindings, breadcrumbs, selected body
165
- fields, and table-of-contents links render server-side.
172
+ - **Content types** — `list_content_types`, `read_content_type`,
173
+ `create_content_type`, `update_content_type`, `delete_content_type`.
174
+ Every record is a Page; `list_pages` filters by `content_type`.
175
+ `change_page_content_type` reclassifies a Page without changing its identity
176
+ or existing URL. `page_completeness` reports missing and stale values.
177
+ - **Page templates** — list/read/create/update/delete reusable block layouts,
178
+ including article/checklist starters. Set a default per content type or an
179
+ override per Page. The body remains the Page's own editable block tree.
166
180
  - **Media** — `get_import_readiness`, list/read, signed upload URLs,
167
181
  `upload_media_from_url`, `upload_media_batch_from_urls` (1–50 sources, max
168
182
  25 MiB each, with partial-success results), `upload_media_inline`, metadata
@@ -203,10 +217,10 @@ the full reference + concrete operation recipes.
203
217
  Analytics provisioning runs on the platform. Deploy after updates whose
204
218
  response has `affects_build: true`.
205
219
  - **Search + link integrity** — `search_pages` plus `check_internal_links`,
206
- which resolves saved database content against pages, collection/facet routes,
220
+ which resolves saved database content against pages, Page/facet routes,
207
221
  media and redirect chains without crawling the public site.
208
222
  - **Bulk** — `bulk_replace_text` with dry-run across pages, partials,
209
- block data and schema-defined collection-item fields.
223
+ block data and custom Page fields.
210
224
  - **Migration inventory** — bulk add/update decisions, recursive
211
225
  `import_sitemap`, direct or CSV-fallback `import_gsc_performance`, and compact
212
226
  `verify_migration_urls` (successful rows omitted unless requested), plus
@@ -218,7 +232,7 @@ the full reference + concrete operation recipes.
218
232
  status. A finished job reports `cost`: what the build consumed in server
219
233
  time, broken down per phase. Estimates from a rate card, not billing records.
220
234
  - **Preview** — `get_preview_link` (signed URL for browser navigation;
221
- supports `page_id`, `slug`, or `collection_name + item_id`; pass
235
+ supports `page_id`, `slug`, or `path`; pass
222
236
  `include_working_copy: true` to also render unsaved drafts).
223
237
  - **Drafts (the buffer model)** — every content write lands in a per-doc
224
238
  unsaved draft (working copy); deploys and plain previews see saved
@@ -238,7 +252,7 @@ curl -H "Authorization: Bearer typeroll_live_..." \
238
252
  ```
239
253
 
240
254
  The MCP server is purely an ergonomics layer on top of that. The complete v1
241
- contract, including payload envelopes and collection-item slug addressing, is
255
+ contract, including payload envelopes and Page IDs and content-type routing, is
242
256
  documented in [`docs/v1-api.md`](../../docs/v1-api.md).
243
257
 
244
258
  ## Security model
@@ -271,7 +285,7 @@ documented in [`docs/v1-api.md`](../../docs/v1-api.md).
271
285
  [docs/claude-code-mcp-setup.md](../../docs/claude-code-mcp-setup.md)
272
286
  - Agent operations briefing: [AGENTS.md](./AGENTS.md)
273
287
  - Boilerplate skills (site building, brand, forms, SEO, blog,
274
- collections, migration, image generation, redesign, …):
288
+ content types, migration, image generation, redesign, …):
275
289
  [skills/](./skills/)
276
290
 
277
291
  ## License