@timelesscms-com/mcp-server 0.3.0 → 0.4.0

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
@@ -68,11 +68,17 @@ maps to one HTTP endpoint; the actual logic runs in the customer's portal
68
68
  the page's own `blocks`. Set `Page.template = "<template-id>"` to
69
69
  apply a template to a page.
70
70
 
71
- - **Block types.** Custom blocks (`origin: 'user'`) and installed
72
- third-party blocks (`origin: 'third_party'`) live in a per-site
73
- collection. Use `list_block_types` to see what's available. The
74
- `core/*` types (section, columns, prose, heading, image, button) are
75
- always available and don't appear in that list.
71
+ - **Block types.** A site has three sources of block types:
72
+ - **Core** (origin: 'core', ids like `core/section`) shipped in
73
+ the platform, always available.
74
+ - **User** (origin: 'user') created in the portal's block-types UI.
75
+ - **Third-party** (origin: 'third_party') imported from .tcblocks
76
+ packages via `import_block_types`.
77
+
78
+ `list_block_types` returns ALL of them in one list, with each entry's
79
+ full schema (field names, types, defaults). Always call this FIRST
80
+ before working with blocks — never hardcode block ids or field names,
81
+ the available set is per-site.
76
82
 
77
83
  - **Redirects.** `from_path → to_path` with status code 301 / 302.
78
84
  Auto-created when you change a page's slug.
@@ -108,8 +114,11 @@ goes through the MCP:
108
114
  `include_content: true` if you actually need the bodies inline.
109
115
  5. `list_collections` — what content types exist + their schemas +
110
116
  `route_template` (so you know if items have URLs).
111
- 6. `list_block_types` — registered block types (often empty today;
112
- fills in once the block editor lands).
117
+ 6. `list_block_types` — every block type usable on this site: core
118
+ (always available, ids like `core/section`), custom (origin: 'user'),
119
+ and third-party (origin: 'third_party'). Each entry includes the
120
+ full schema so you know what `data.X` fields each block accepts.
121
+ 7. `list_page_templates` — PageTemplate docs that wrap pages.
113
122
 
114
123
  You usually want at least #1 + #2 + a sampling from #3 before
115
124
  proposing any design change, so you mirror the conventions in use.
@@ -182,13 +191,20 @@ Edits to the block update every page that includes it. Use
182
191
  ### "Build a page using blocks (the default for new pages)"
183
192
 
184
193
  New pages default to `content_mode='blocks'` with a seeded heading +
185
- prose block. To add more:
194
+ prose block. Discover-then-build:
186
195
 
187
196
  ```
197
+ list_block_types
198
+ # → [{ id: "core/section", category: "layout", container: true, schema: [{ name: "width", type: "select", options: ["narrow","normal","wide","full"] }, …] },
199
+ # { id: "core/columns", container: "slots", slot_count: 2, slot_labels: ["Left","Right"], schema: [...] },
200
+ # { id: "hero_bold", origin: "user", schema: [...] }, ← any custom blocks on this site
201
+ # …]
202
+
188
203
  get_page_blocks page_id=home
189
- # returns { content_mode: 'blocks', blocks: [...] }
204
+ # { content_mode: 'blocks', blocks: [...] }
205
+
190
206
  add_block page_id=home block={ type: 'core/section', data: { width: 'wide' } }
191
- # returns { added_id: 'blk_xyz', blocks: [...] }
207
+ # { added_id: 'blk_xyz', blocks: [...] }
192
208
  add_block page_id=home parent_id="blk_xyz" block={
193
209
  type: 'core/heading', data: { text: 'Pricing', level: 'h2' }
194
210
  }
@@ -197,6 +213,10 @@ add_block page_id=home parent_id="blk_xyz" block={
197
213
  }
198
214
  ```
199
215
 
216
+ For an unfamiliar custom block, `read_block_type id="..."` gives the
217
+ full field list (types, defaults, required) so you don't ship invalid
218
+ `data`.
219
+
200
220
  Updating, moving, removing blocks: `update_block`, `move_block`,
201
221
  `remove_block` (all by `block_id`).
202
222
 
@@ -44,16 +44,24 @@ export const blockTypeTools = [
44
44
  },
45
45
  {
46
46
  name: 'list_block_types',
47
- description: 'List registered block types with their schemas. Most sites have none today; this fills in when the block editor ships.',
48
- inputSchema: { version: versionParam },
47
+ description: 'Discover every block type usable on this site. Returns ALL of them in one list: core blocks (id like "core/section", always available), custom blocks (origin: "user", created in the portal), and third-party blocks (origin: "third_party", imported from .tcblocks packages). Each entry includes id, label, category, container/slot info, origin, and the full schema (fields with name/type/label/required/options/default). Call this FIRST when starting block-mode work — never hardcode block ids; the available set is per-site.',
48
+ inputSchema: {
49
+ include_core: z.boolean().optional().describe('Default true. Set false to get only custom + third-party (rarely needed).'),
50
+ version: versionParam,
51
+ },
49
52
  handler: withErrorBoundary(async (args, { client, siteId }) => {
50
- const res = await client.get(siteId, 'block-types', v(args.version));
53
+ const query = {};
54
+ if (args.version)
55
+ query.version = args.version;
56
+ if (args.include_core === false)
57
+ query.include_core = 'false';
58
+ const res = await client.get(siteId, 'block-types', query);
51
59
  return ok(res);
52
60
  }),
53
61
  },
54
62
  {
55
63
  name: 'read_block_type',
56
- description: 'Read one block type\'s schema.',
64
+ description: "Full schema for one block type. Returns the BlockType doc with template, styles, optional script, and the field-definitions array. Use this when list_block_types' summary isn't enough — e.g. before add_block on a custom block whose data fields you haven't seen.",
57
65
  inputSchema: {
58
66
  type_id: z.string(),
59
67
  version: versionParam,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timelesscms-com/mcp-server",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Model Context Protocol server for the TimelessCMS public API. Use with Claude Code or any MCP-compatible client to manage a TimelessCMS site.",
5
5
  "license": "MIT",
6
6
  "type": "module",