frameworc-mcp 0.4.0 → 0.5.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/README.md CHANGED
@@ -96,7 +96,7 @@ If the file is missing or empty, `use_site` errors with a pointer to where to ad
96
96
 
97
97
  ### Adding a new OctCMS site
98
98
 
99
- 1. Spin up the new OctCMS install with the FrameworC suite incl. the `crscompany/frameworcmcp` plugin (v1.1.0 or newer).
99
+ 1. Spin up the new OctCMS install with the FrameworC suite incl. the `crscompany/frameworcmcp` plugin (v1.2.0 or newer; media assignment needs v1.2.0).
100
100
  2. Backend → Settings → FrameworC → **MCP API** → paste a freshly generated random string (e.g. `openssl rand -hex 32`) → Save.
101
101
  3. Edit `~/.config/frameworc/sites.json` on your laptop, add one entry: `{ "label": "New Client", "url": "https://newsite.test", "token": "<that string>" }`.
102
102
  4. In your next chat (no Claude Desktop restart needed): *"Use `https://newsite.test`."* → MCP hot-reloads the file, finds the token, sends it. Done.
@@ -109,7 +109,7 @@ No env var, no chat-client config edit, no ToolHive touch, no repo push. The who
109
109
  - A leak of the file compromises every site listed in it. Treat it like an SSH private key — back it up, rotate tokens periodically, never commit it to git.
110
110
  - One-off override: `use_site("https://X", "token-string")` lets you pass a token inline (without storing it) for the duration of the chat session. Useful for testing a token before saving it.
111
111
 
112
- ## Tools (0.4.0)
112
+ ## Tools (0.5.0)
113
113
 
114
114
  | Tool | Description |
115
115
  |---|---|
@@ -124,10 +124,10 @@ No env var, no chat-client config edit, no ToolHive touch, no repo push. The who
124
124
  | `delete_page(id)` | Soft-delete a page. |
125
125
  | `create_translation(id, target_site_id, prefill?)` | Linked sibling of a page (or Prefill with `prefill:true`) on another multisite site. |
126
126
  | `add_block(page_id \| prefill_id, block, position?)` | Append (or insert at `position`) a block. |
127
- | `update_block(page_id \| prefill_id, block_id, block)` | Replace one block by row id (new id returned; human-assigned media carried over unless the type changes). |
127
+ | `update_block(page_id \| prefill_id, block_id, block)` | Replace one block by row id (new id returned). A media field you omit is inherited; one you send is written verbatim, so `""` clears it. |
128
128
  | `remove_block(page_id \| prefill_id, block_id)` | Remove one block by row id. |
129
129
  | `reorder_blocks(page_id \| prefill_id, order)` | Reorder blocks (order = array of all row ids in new order). |
130
- | `extract_block_to_prefill(page_id, block_id, title)` | Move a page block into a new Prefill entry (lossless, media survives) and reference it in place. |
130
+ | `extract_block_to_prefill(page_id, block_id, title)` | Move a page block into a new Prefill entry (lossless from plugin v1.2.0) and reference it in place. |
131
131
  | `list_forms` / `get_form(id)` | Form entries; `get_form` includes the `fwcFields` rows. |
132
132
  | `get_form_schema` | Live field-group catalogue for authoring forms. |
133
133
  | `create_form` / `update_form` / `delete_form` | Form CRUD. `fwcFields` rows: `{group, label, name, required, width, ...}`; delete guarded unless `force:true`. |
@@ -138,6 +138,8 @@ No env var, no chat-client config edit, no ToolHive touch, no repo push. The who
138
138
  | `get_page_meta(handle)` / `update_page_meta(handle, fields)` | Per-site singles: `Meta` (SEO), `Navigation` (navbar incl. `nav` menu link + buttons), `Footer` (incl. `socials` rows + `nav`). |
139
139
  | `get_settings` / `update_settings(fields)` | Global FrameworC settings: navbar options + custom SCSS variables. Integration secrets are not exposed. |
140
140
  | `get_block_schema(name)` | Field schema + usage notes for one block (live from the CMS). |
141
+ | `list_media(folder?, type?, sort?, limit?, offset?)` | Browse the media library. Returns files with their `path` — write that into a mediafinder field. |
142
+ | `search_media(q, folder?, type?, ...)` | Find library files by name across all folders. Every whitespace-separated word must appear in the path. |
141
143
 
142
144
  Form and Menu entries have no translation linking — create them per site by passing `site_id`.
143
145
 
@@ -197,14 +199,23 @@ Form and Menu entries have no translation linking — create them per site by pa
197
199
 
198
200
  ### Storage encoding (what the MCP understands)
199
201
 
200
- - Media fields (`image`, `imageMobile`, `backgroundImage`, `buttonIcon1..4`, `ogImage`, `images`, `file`) **must be empty** in the JSON — they are rejected if non-empty. Fill them in the OctCMS backend.
202
+ - Media fields hold **media library paths**, root-relative with a leading slash (`/images/hero.jpg`). Assignment only: the API cannot upload, and a path that is not in the library is a 422. Single-item fields (`maxItems: 1`) are strings and read as `""` when unset; multi fields are arrays and read as `[]`. Find paths with `search_media` / `list_media`.
201
203
  - `switch` fields accept booleans; the API normalises to `"1"` / `"0"` for storage.
202
204
  - `customCssClass` + `responsiveHide` are arrays of strings.
203
- - Multi-`mediafinder` fields (`images` for `Gallery` / `ImageStrip`) are arrays of path strings — but must be empty `[]` per the rule above.
205
+ - Multi-`mediafinder` fields are arrays of path strings: `Gallery.images` and `ImageStrip.images`, where **every** item renders, plus `Section.content.image` and the `Footer` single's `logo`, which are arrays in storage but of which the theme renders **only the first item**.
204
206
  - `entries` links are integers (or `{id: n}`): `form` (block level for `Form`), `content.menu` (for `MenuBlock`), `content.block` (for `Prefill`). Reads return them as `{id, title}`.
205
207
  - `Slider` accepts an optional `content.breakpoints = { tablet: number, mobile: number }`.
206
208
  - `Columns` blocks have `content.columns = [{ blockId, builder: [...blocks] }]` — recursive: each column's `builder` follows the exact same shape as the top-level `builder`.
207
209
 
210
+ ### Working with media
211
+
212
+ `mode: image` on a blueprint field is only a hint for the backend widget; October never enforces it, and real FrameworC content relies on the slack. The API therefore accepts any image, SVG or video extension in a `mode: image` field and rejects the rest (a `.pdf` in a hero would break `resize()`), which means:
213
+
214
+ - The `Navigation` logo is an SVG and `Header.image` holds an `.mp4` when `isVideoBg` is on. Both are valid.
215
+ - `buttonIcon1..4` and `Downloads`' `file` declare no `mode` at all, so any file type is accepted there.
216
+ - Whether SVG reports as `file_type: image` or `document` depends on the install's `media.image_extensions` config, so treat `list_media`'s `type` filter as a convenience rather than a guarantee.
217
+ - Folders are not selectable, and filenames containing `+ # % !` are unreachable through the API — an October media library limitation that applies to its own backend manager too.
218
+
208
219
  ## Catalogue drift
209
220
 
210
221
  The hand-authored block catalogue lives in `src/catalogue.ts`. It mirrors `plugins/crscompany/frameworc/blueprints/Blocks/*.yaml` + `Mixins/Buttons.yaml` + `Mixins/Buttons2.yaml` + `BaseBlock.yaml`. If a block blueprint changes (new field, new enum value, removed field), update `src/catalogue.ts` to match and rebuild. No generator script — kept manual because blocks change rarely per the FrameworC convention.
@@ -1,6 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ApiClient = void 0;
4
+ /** Renders the defined params as a leading-`?` query string, or "" when empty. */
5
+ function qs(params) {
6
+ const search = new URLSearchParams();
7
+ for (const [key, value] of Object.entries(params)) {
8
+ if (value !== undefined && value !== null && value !== "") {
9
+ search.set(key, String(value));
10
+ }
11
+ }
12
+ const rendered = search.toString();
13
+ return rendered ? `?${rendered}` : "";
14
+ }
4
15
  class ApiClient {
5
16
  session;
6
17
  constructor(session) {
@@ -60,6 +71,13 @@ class ApiClient {
60
71
  getBlockSchema(name) {
61
72
  return this.request(`/blocks/${encodeURIComponent(name)}`);
62
73
  }
74
+ // --- media library (global) -------------------------------------------
75
+ listMedia(params = {}, siteId) {
76
+ return this.request(this.q(`/media${qs(params)}`, siteId));
77
+ }
78
+ searchMedia(query, params = {}, siteId) {
79
+ return this.request(this.q(`/media/search${qs({ q: query, ...params })}`, siteId));
80
+ }
63
81
  // --- pages ------------------------------------------------------------
64
82
  listPages(siteId) {
65
83
  return this.request(this.q("/pages", siteId));
package/dist/catalogue.js CHANGED
@@ -6,7 +6,7 @@ const buttonsMixin = [
6
6
  { name: "buttonVariant1", type: "dropdown", enum: ["default", "outline", "blurLight", "blurDark", "plain"], default: "default" },
7
7
  { name: "buttonContrast1", type: "switch", default: false },
8
8
  { name: "buttonLink1", type: "text", comment: "Pagefinder path or URL for button 1 (left blank = no link)" },
9
- { name: "buttonIcon1", type: "media-single", comment: "Must stay empty — human fills via backend" },
9
+ { name: "buttonIcon1", type: "media-single", comment: "Media library path, e.g. \"/icons/arrow.svg\". Find one with search_media. No mode restriction, so any file type is accepted." },
10
10
  { name: "buttonBlank1", type: "switch", default: false },
11
11
  { name: "buttonLabel2", type: "text", comment: "Text of button 2" },
12
12
  { name: "buttonVariant2", type: "dropdown", enum: ["default", "outline", "blurLight", "blurDark", "plain"], default: "default" },
@@ -35,7 +35,7 @@ const baseBlock = [
35
35
  { name: "elevated", type: "switch", default: false, comment: "Lifts this block up into the previous block visually." },
36
36
  { name: "containerWidth", type: "dropdown", enum: ["default", "narrow", "full", "pop"], default: "default" },
37
37
  { name: "backgroundColor", type: "dropdown", enum: ["default", "accent", "contrast", "image", "containerAccent", "containerContrast", "containerImage"], default: "default" },
38
- { name: "backgroundImage", type: "media-single", comment: "Must stay empty — leave for human to fill in backend." },
38
+ { name: "backgroundImage", type: "media-single", comment: "Media library path from list_media/search_media. Only renders when backgroundColor is 'image' or 'containerImage'." },
39
39
  { name: "backgroundImageMobile", type: "media-single" },
40
40
  { name: "customCssClass", type: "taglist", enum: ["animate", "noSpacing", "noSpacingTop", "noSpacingBottom", "narrowSpacing", "centerButtons"], comment: "Array of class keys to apply as Builder-container--<class>." },
41
41
  { name: "aliasOverride", type: "text", comment: "Custom component alias (theme partial hook). Leave blank unless specifically needed." },
@@ -53,7 +53,7 @@ exports.BLOCKS = [
53
53
  whenToUse: "Always first block on a page. Use H1/H2 here (other blocks use H2/H3). One per page.",
54
54
  base: baseBlock,
55
55
  content: [
56
- { name: "image", type: "media-single", comment: "Must stay empty for MCP; human fills via backend." },
56
+ { name: "image", type: "media-single", comment: "Media library path. Declared mode:image, but an .mp4 is valid here when isVideoBg is on." },
57
57
  { name: "imageMobile", type: "media-single" },
58
58
  { name: "isVideoBg", type: "switch", default: false, comment: "If true, 'image' is treated as a video file and 'imageMobile' as poster." },
59
59
  ...buttonsMixin,
@@ -71,7 +71,7 @@ exports.BLOCKS = [
71
71
  content: [
72
72
  { name: "variant", type: "dropdown", enum: sectionVariants, default: "halfAndHalf" },
73
73
  { name: "reverse", type: "switch", default: false, hiddenWhen: { field: "variant", equals: ["noText", "noImage", "embedOnly"] }, comment: "Swap sides (image left vs right)." },
74
- { name: "image", type: "media-single", hiddenWhen: { field: "variant", equals: ["noImage", "embedHalfAndHalf", "embedOnly", "embed30", "embed70", "textAndText"] } },
74
+ { name: "image", type: "media-multi", comment: "Stored as an ARRAY of paths (the blueprint sets no maxItems) but the theme renders only the FIRST item, so send [\"/photo.jpg\"].", hiddenWhen: { field: "variant", equals: ["noImage", "embedHalfAndHalf", "embedOnly", "embed30", "embed70", "textAndText"] } },
75
75
  { name: "embed", type: "codeeditor", shownWhen: { field: "variant", equals: ["embedHalfAndHalf", "embedOnly", "embed30", "embed70"] }, comment: "Raw embed HTML (iframe etc.)." },
76
76
  ...buttonsMixin,
77
77
  { name: "headline2", type: "richeditor", shownWhen: { field: "variant", equals: ["textAndText"] }, comment: "Second column text (only when variant is 'textAndText')." },
@@ -102,7 +102,7 @@ exports.BLOCKS = [
102
102
  description: "One repeater item per tile/card.",
103
103
  items: [
104
104
  { name: "headline", type: "text", required: true, comment: "Tile title." },
105
- { name: "image", type: "media-single", comment: "Tile image. Leave empty for text-only tiles." },
105
+ { name: "image", type: "media-single", comment: "Tile image: a media library path, or \"\" for a text-only tile." },
106
106
  { name: "text", type: "richeditor", comment: "Tile body text." },
107
107
  ...buttonsMixin,
108
108
  ],
@@ -205,10 +205,10 @@ exports.BLOCKS = [
205
205
  content_group: "Gallery",
206
206
  name: "Gallery (masonry)",
207
207
  description: "Masonry image gallery.",
208
- whenToUse: "Multiple images shown together in a grid. Lightbox on expand. Use 'images' array (must be empty in MCP — human fills via backend).",
208
+ whenToUse: "Multiple images shown together in a grid, lightbox on expand. 'images' is an array of media library paths and every item renders.",
209
209
  base: baseBlock,
210
210
  content: [
211
- { name: "images", type: "media-multi", comment: "Array of image paths; MUST be empty in MCP." },
211
+ { name: "images", type: "media-multi", comment: "Array of media library paths, e.g. [\"/a.jpg\",\"/b.jpg\"]. Each must already exist; find them with search_media." },
212
212
  { name: "columns", type: "number", default: 3, comment: "Number of columns (blank = 3)." },
213
213
  ],
214
214
  },
@@ -216,7 +216,7 @@ exports.BLOCKS = [
216
216
  content_group: "Downloads",
217
217
  name: "Downloads",
218
218
  description: "List of downloadable files (name + icon + description + file each).",
219
- whenToUse: "Document / spec / PDF lists. Each row has a name, an icon dropdown, an optional description, and a file (which must remain empty in MCP — human fills).",
219
+ whenToUse: "Document / spec / PDF lists. Each row has a name, an icon dropdown, an optional description, and a file taken from the media library.",
220
220
  base: baseBlock,
221
221
  content: [],
222
222
  nestedRepeaters: [
@@ -227,7 +227,7 @@ exports.BLOCKS = [
227
227
  { name: "name", type: "text", required: true },
228
228
  { name: "icon", type: "dropdown", enum: ["none", "file", "pdf", "dl"], default: "none" },
229
229
  { name: "description", type: "richeditor" },
230
- { name: "file", type: "media-single", comment: "Must stay empty — human fills via backend." },
230
+ { name: "file", type: "media-single", comment: "Media library path to the document, e.g. \"/docs/spec.pdf\". No mode restriction, so any file type is accepted." },
231
231
  ],
232
232
  },
233
233
  ],
@@ -288,7 +288,7 @@ exports.BLOCKS = [
288
288
  whenToUse: "Brand/logos row, partners strip, photo strip with horizontal scroll. Optional auto-scroll.",
289
289
  base: baseBlock,
290
290
  content: [
291
- { name: "images", type: "media-multi", comment: "Array of image paths; MUST be empty in MCP." },
291
+ { name: "images", type: "media-multi", comment: "Array of media library paths; every item renders, side by side." },
292
292
  { name: "centered", type: "switch", default: false, comment: "Center the strip horizontally." },
293
293
  { name: "autoScroll", type: "switch", default: false },
294
294
  { name: "stopOnHover", type: "switch", default: false },
@@ -308,7 +308,30 @@ exports.BLOCKS = [
308
308
  ],
309
309
  },
310
310
  ];
311
- exports.BLOCK_CATALOGUE_TEXT = exports.BLOCKS.map((b) => {
311
+ /**
312
+ * Lands once, ahead of every block, rather than being repeated per field.
313
+ * Media is the part of a block payload that models get wrong most often.
314
+ */
315
+ const MEDIA_PREAMBLE = [
316
+ "## Media fields",
317
+ "",
318
+ "`media-single` takes ONE path string; `media-multi` takes an ARRAY of path",
319
+ "strings. Paths are root-relative with a leading slash, exactly as stored:",
320
+ '"/hero.jpg", "/logos/brand.svg".',
321
+ "",
322
+ "The file must ALREADY EXIST in the library. Call search_media (by name) or",
323
+ "list_media (by folder) and copy the `path` from the result — never the `url`,",
324
+ "and never invent a filename: a path that does not resolve is rejected. This",
325
+ "server cannot upload. If what the user wants is not in the library, say so",
326
+ "and ask them to add it in Backend > Media.",
327
+ "",
328
+ 'To leave a field unset send "" (single) or [] (multi). On update_block a',
329
+ "media key you OMIT keeps whatever is stored, while a key you SEND is written",
330
+ 'as given — so sending "" is how you clear an image.',
331
+ "",
332
+ "",
333
+ ].join("\n");
334
+ exports.BLOCK_CATALOGUE_TEXT = MEDIA_PREAMBLE + exports.BLOCKS.map((b) => {
312
335
  const lines = [];
313
336
  lines.push(`### ${b.name} (content_group="${b.content_group}")`);
314
337
  lines.push(`When to use: ${b.whenToUse}`);
package/dist/index.js CHANGED
@@ -93,7 +93,7 @@ const tools = [
93
93
  },
94
94
  {
95
95
  name: "create_page",
96
- description: "Create a new FrameworC page. Send a `page` object (title, slug, fullslug, is_enabled, metaTitle, metaDescription, menuStyle, menuHide) and a `builder` array of block objects per the frameworc://blocks resource. Pages are created with is_enabled=false (draft) by default. Media fields must be left empty — the human fills them in the backend. After creating, surface the returned page id so the user can assign images and flip is_enabled to publish.",
96
+ description: "Create a new FrameworC page. Send a `page` object (title, slug, fullslug, is_enabled, metaTitle, metaDescription, menuStyle, menuHide) and a `builder` array of block objects per the frameworc://blocks resource. Pages are created with is_enabled=false (draft) by default. Media fields take a media library path such as \"/images/hero.jpg\" — find one with search_media or list_media; the file must already exist, as this server cannot upload. Leave a media field as \"\" (single) or [] (multi) to leave it unset. After creating, surface the returned page id so the user can review and flip is_enabled to publish.",
97
97
  inputSchema: {
98
98
  type: "object",
99
99
  properties: {
@@ -114,7 +114,7 @@ const tools = [
114
114
  },
115
115
  {
116
116
  name: "update_page",
117
- description: "Update an existing page. Partial updates: send only `page` (meta edits) and/or `builder` (full rebuild — all existing blocks are deleted and the new array is written). To only add/edit/remove one block, use add_block / update_block / remove_block instead.",
117
+ description: "Update an existing page. Partial updates: send only `page` (meta edits) and/or `builder` (full rebuild — all existing blocks are deleted and the new array is written). A rebuild also rewrites media, so send the builder array exactly as get_page returned it, paths included, or the existing images are cleared. To add, edit or remove one block, prefer add_block / update_block / remove_block. `page.ogImage` takes a media library path.",
118
118
  inputSchema: {
119
119
  type: "object",
120
120
  properties: {
@@ -157,7 +157,7 @@ const tools = [
157
157
  },
158
158
  {
159
159
  name: "update_block",
160
- description: "Replace a single block by id (the row id from get_page's builder[].id) on a page — or a prefill via prefill_id. The new `block` must include `content_group` plus `base` + `content`. The block is replaced, not patched: the returned row id is NEW. Media a human assigned in the backend is carried over automatically wherever your payload leaves the field empty — unless you change content_group. Other blocks are untouched.",
160
+ description: "Replace a single block by id (the row id from get_page's builder[].id) on a page — or a prefill via prefill_id. The new `block` must include `content_group` plus `base` + `content`. The block is replaced, not patched: the returned row id is NEW. A media field you OMIT is inherited from the old block; one you SEND is written verbatim, so sending \"\" (or [] for a multi field) is how you clear an image. Keep each repeater row's `id` from get_page so media follows the right row. Inheritance is skipped when you change content_group. Other blocks are untouched.",
161
161
  inputSchema: {
162
162
  type: "object",
163
163
  properties: {
@@ -203,7 +203,7 @@ const tools = [
203
203
  },
204
204
  {
205
205
  name: "extract_block_to_prefill",
206
- description: "Move an existing page block into a NEW Prefill entry and replace it in place with a `Prefill` reference block. Lossless — media a human assigned survives the move. Use this whenever a section should appear on more than one page: extract it once, then add_block a `Prefill` block ({content_group:'Prefill', content:{block:<prefill id>}}) on the other pages. This is the intended FrameworC workflow; never copy the same section onto multiple pages.",
206
+ description: "Move an existing page block into a NEW Prefill entry and replace it in place with a `Prefill` reference block. Lossless: assigned media survives the move (requires the frameworcmcp plugin at v1.2.0 or newer; older versions silently dropped it). Use this whenever a section should appear on more than one page: extract it once, then add_block a `Prefill` block ({content_group:'Prefill', content:{block:<prefill id>}}) on the other pages. This is the intended FrameworC workflow; never copy the same section onto multiple pages.",
207
207
  inputSchema: {
208
208
  type: "object",
209
209
  properties: {
@@ -405,7 +405,7 @@ const tools = [
405
405
  },
406
406
  {
407
407
  name: "update_prefill",
408
- description: "Update a Prefill entry. `prefill` merges title/slug/is_enabled; a `builder` array fully rebuilds the blocks (prefer the per-block tools with prefill_id — a rebuild loses human-assigned media). Edits apply everywhere the prefill is referenced.",
408
+ description: "Update a Prefill entry. `prefill` merges title/slug/is_enabled; a `builder` array fully rebuilds the blocks (prefer the per-block tools with prefill_id — a rebuild rewrites media from your payload, so send the blocks as get_prefill returned them or the images are cleared). Edits apply everywhere the prefill is referenced.",
409
409
  inputSchema: {
410
410
  type: "object",
411
411
  properties: {
@@ -451,6 +451,42 @@ const tools = [
451
451
  required: ["fields"],
452
452
  },
453
453
  },
454
+ {
455
+ name: "list_media",
456
+ description: "Browse the media library one folder at a time. Returns {folder, parent, folders:[{path,name,item_count}], files:[{path,name,file_type,extension,size,last_modified,url}], total_files, truncated}. To put a file on a page, write its `path` — the root-relative form with a leading slash, e.g. \"/logos/brand.svg\" — into a mediafinder field; never the `url`. This server CANNOT upload: if the file the user wants is not here, say so and ask them to add it in Backend > Media. Prefer search_media when you know part of the name. Note that `file_type` buckets follow the install's media config (SVG may report as image or as document), so treat `type` as a convenience filter rather than a guarantee. The library is global: site_id is accepted and ignored.",
457
+ inputSchema: {
458
+ type: "object",
459
+ properties: {
460
+ folder: { type: "string", description: "Folder to list, root-relative with a leading slash. Defaults to \"/\". A folder that does not exist is a 404." },
461
+ type: { type: "string", enum: ["image", "video", "audio", "document"], description: "Filter files by kind." },
462
+ sort: { type: "string", enum: ["title", "size", "modified"], description: "Defaults to title." },
463
+ direction: { type: "string", enum: ["asc", "desc"], description: "Defaults to asc." },
464
+ limit: { type: "integer", description: "Max files to return (default 100, max 500). Folders are never paged." },
465
+ offset: { type: "integer", description: "Files to skip, for paging." },
466
+ site_url: { type: "string" },
467
+ site_id: { type: "integer", description: "Accepted and ignored; the media library is global." },
468
+ },
469
+ },
470
+ },
471
+ {
472
+ name: "search_media",
473
+ description: "Find files anywhere in the media library by name. The query is lowercased and split on spaces, and EVERY word must appear somewhere in the file's full path — so \"logo dark\" matches \"/brand/logo-dark.svg\" and \"2024 pdf\" matches \"/reports/2024-annual.pdf\". It matches the whole path, not just the filename. Returns the same file shape as list_media; write the returned `path` into a mediafinder field. Prefer this over list_media whenever the user names a file. This server cannot upload files. Filenames containing + # % or ! are not addressable through this API (an October media library limit), so do not retry those.",
474
+ inputSchema: {
475
+ type: "object",
476
+ properties: {
477
+ q: { type: "string", description: "Search words; at least 2 characters." },
478
+ folder: { type: "string", description: "Optional: keep only results inside this folder subtree." },
479
+ type: { type: "string", enum: ["image", "video", "audio", "document"] },
480
+ sort: { type: "string", enum: ["title", "size", "modified"] },
481
+ direction: { type: "string", enum: ["asc", "desc"] },
482
+ limit: { type: "integer", description: "Max files (default 50, max 200)." },
483
+ offset: { type: "integer", description: "Files to skip, for paging." },
484
+ site_url: { type: "string" },
485
+ site_id: { type: "integer", description: "Accepted and ignored; the media library is global." },
486
+ },
487
+ required: ["q"],
488
+ },
489
+ },
454
490
  {
455
491
  name: "get_block_schema",
456
492
  description: "Get the JSON schema + usage notes for one block by content_group name. Fetched live from the CMS, which derives it from the actual Tailor blueprints, so it is always current. Use this to recall field enums, defaults and conditional visibility.",
@@ -479,7 +515,7 @@ const tools = [
479
515
  },
480
516
  {
481
517
  name: "update_page_meta",
482
- description: "Update a per-site single (Meta / Navigation / Footer). Send only the fields you want to change, e.g. {handle:'Meta', fields:{metaTitle:'...', description:'...'}}. Media fields must be left empty. Affects every page on that site, so confirm with the user first.",
518
+ description: "Update a per-site single (Meta / Navigation / Footer). Send only the fields you want to change, e.g. {handle:'Meta', fields:{metaTitle:'...', description:'...'}}. Media fields take a media library path from search_media: Meta.ogImage and Navigation.logo / logoDark are single paths, while Footer.logo is an ARRAY of paths of which only the first renders. Affects every page on that site, so confirm with the user first.",
483
519
  inputSchema: {
484
520
  type: "object",
485
521
  properties: {
@@ -510,7 +546,7 @@ const tools = [
510
546
  },
511
547
  },
512
548
  ];
513
- const server = new index_js_1.Server({ name: "frameworc-mcp", version: "0.4.0" }, { capabilities: { tools: {}, resources: {} } });
549
+ const server = new index_js_1.Server({ name: "frameworc-mcp", version: "0.5.0" }, { capabilities: { tools: {}, resources: {} } });
514
550
  server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
515
551
  tools,
516
552
  }));
@@ -704,6 +740,28 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (req) => {
704
740
  const r = await client.deletePrefill(Number(args.id), Boolean(args.force), site);
705
741
  return { content: [{ type: "text", text: JSON.stringify(r, null, 2) }] };
706
742
  }
743
+ case "list_media": {
744
+ const r = await client.listMedia({
745
+ folder: args.folder,
746
+ type: args.type,
747
+ sort: args.sort,
748
+ direction: args.direction,
749
+ limit: args.limit,
750
+ offset: args.offset,
751
+ }, site);
752
+ return { content: [{ type: "text", text: JSON.stringify(r, null, 2) }] };
753
+ }
754
+ case "search_media": {
755
+ const r = await client.searchMedia(String(args.q ?? ""), {
756
+ folder: args.folder,
757
+ type: args.type,
758
+ sort: args.sort,
759
+ direction: args.direction,
760
+ limit: args.limit,
761
+ offset: args.offset,
762
+ }, site);
763
+ return { content: [{ type: "text", text: JSON.stringify(r, null, 2) }] };
764
+ }
707
765
  case "get_settings": {
708
766
  const r = await client.getSettings();
709
767
  return { content: [{ type: "text", text: JSON.stringify(r, null, 2) }] };
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
- {
2
- "name": "frameworc-mcp",
3
- "version": "0.4.0",
4
- "description": "MCP server for the FrameworC OctoberCMS plugin — programmatically create/edit FrameworC pages and blocks.",
5
- "license": "MIT",
6
- "type": "commonjs",
7
- "bin": {
8
- "frameworc-mcp": "dist/index.js"
9
- },
10
- "main": "dist/index.js",
11
- "files": [
12
- "dist",
13
- "README.md"
14
- ],
15
- "scripts": {
16
- "build": "tsc",
17
- "start": "node dist/index.js",
18
- "prepublishOnly": "npm run build"
19
- },
20
- "dependencies": {
21
- "@modelcontextprotocol/sdk": "^1.0.0"
22
- },
23
- "devDependencies": {
24
- "@types/node": "^20.0.0",
25
- "typescript": "^5.4.0"
26
- },
27
- "engines": {
28
- "node": ">=18.0.0"
29
- },
30
- "publishConfig": {
31
- "@yourorg:registry": "https://gitlab.com/api/v4/projects/<YOUR-PROJECT-ID>/packages/npm/"
32
- }
33
- }
1
+ {
2
+ "name": "frameworc-mcp",
3
+ "version": "0.5.1",
4
+ "description": "MCP server for the FrameworC OctoberCMS plugin — programmatically create/edit FrameworC pages and blocks.",
5
+ "license": "MIT",
6
+ "type": "commonjs",
7
+ "bin": {
8
+ "frameworc-mcp": "dist/index.js"
9
+ },
10
+ "main": "dist/index.js",
11
+ "files": [
12
+ "dist",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "start": "node dist/index.js",
18
+ "prepublishOnly": "npm run build"
19
+ },
20
+ "dependencies": {
21
+ "@modelcontextprotocol/sdk": "^1.0.0"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "^20.0.0",
25
+ "typescript": "^5.4.0"
26
+ },
27
+ "engines": {
28
+ "node": ">=18.0.0"
29
+ },
30
+ "publishConfig": {
31
+ "@yourorg:registry": "https://gitlab.com/api/v4/projects/<YOUR-PROJECT-ID>/packages/npm/"
32
+ }
33
+ }