@bettercms-ai/mcp 0.21.0 → 0.22.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/dist/index.js CHANGED
@@ -3784,6 +3784,7 @@ function registerTools(server, deps) {
3784
3784
  import { z as z2 } from "zod";
3785
3785
 
3786
3786
  // src/playbook.ts
3787
+ var PLAYBOOK_URI = "bettercms://playbook/schema";
3787
3788
  var SCHEMA_PLAYBOOK = `# Designing a BetterCMS project
3788
3789
 
3789
3790
  Read this BEFORE creating anything. Confirm the shape with the user before you build it.
@@ -3951,6 +3952,47 @@ is schema-first by design (\xA71) and should stay that way. Say so and move on.
3951
3952
  Either way: ask, do not choose. The 409 carries this project's actual page counts \u2014 how many
3952
3953
  are field-driven, block-driven, and how many place a reusable component \u2014 so quote those to
3953
3954
  the user rather than describing the choice in the abstract.
3955
+
3956
+ ## 11. The canvas: what makes an imported site EDITABLE
3957
+
3958
+ A deploy makes a site LIVE. It does not make it editable \u2014 those are different states, and the
3959
+ gap between them is the single most common disappointment after an import.
3960
+
3961
+ **The canvas is the real site when it can be.** When a page's draft matches its published copy
3962
+ structurally, the visual editor frames the project's OWN deployed build and paints unpublished
3963
+ text over it. Structural drafts (new sections, unpublished pages, changed components) render on
3964
+ the platform's own renderer instead \u2014 and that renderer previews in a GENERIC theme unless the
3965
+ deploy artifact declares \`bcms-presentation.json\` at its root. Put the file in \`public/\`
3966
+ (the build lands it at the artifact root) declaring the site's presentation \u2014 container width,
3967
+ type scale, nav position and background, footer surface \u2014 as DTCG \`{"$type": ..., "$value": ...}\`
3968
+ entries. Redeclare it on every deploy; absent means "declared nothing" and previews fall back
3969
+ to platform defaults that will not look like this site.
3970
+
3971
+ **Editing binds by VALUE.** The editor matches CMS field values against the text the site
3972
+ renders. Three consequences, each load-bearing:
3973
+
3974
+ 1. Content that exists ONLY in the build can never be click-to-edit. Bring it in, per
3975
+ route, in this order (get_next_steps reports the state until it is done):
3976
+
3977
+ a. create_page one per route, slug matching the route
3978
+ b. add_page_field the fields its content needs (or create_component +
3979
+ publish_component + component blocks, per your \xA710 answer)
3980
+ c. set_page_content values EXACTLY equal to the text the site renders \u2014
3981
+ binding matches by value, so a paraphrase binds nothing
3982
+ d. update_page status 'published' \u2014 the canvas binds the PUBLISHED copy
3983
+ 2. A value that renders in more than one place stays uneditable on the canvas (deliberate:
3984
+ binding it would edit all of them at once). It remains editable in the side panel.
3985
+ 3. Keep chrome semantic \u2014 \`<nav>\`, \`<footer>\`, page content inside \`<main>\`, mastheads
3986
+ as a top-level \`<header>\`. Chrome is edited through the project Layout, not the page,
3987
+ and semantic landmarks are how the editor keeps a nav edit from being written into page
3988
+ content. Div-built chrome outside \`<main>\` is still excluded; div-built chrome with no
3989
+ \`<main>\` anywhere loses that protection.
3990
+
3991
+ **Hosting decides whether a canvas exists at all.** A site deployed here is framed through a
3992
+ same-origin proxy \u2014 that is what the canvas requires. A site hosted elsewhere (your own Vercel,
3993
+ your own server) has NO canvas today: the SDK's draft mode with \`stega: true\` embeds invisible
3994
+ per-field provenance in fetched strings, which prepares the content for editing surfaces, but do
3995
+ not promise a canvas for an externally-hosted site.
3954
3996
  `;
3955
3997
 
3956
3998
  // src/prompts.ts
@@ -4344,6 +4386,44 @@ On 401/403, the MCP key needs (re)authorizing.`
4344
4386
 
4345
4387
  ${SEO_FLOW}
4346
4388
 
4389
+ On 401/403, the MCP key needs (re)authorizing.`
4390
+ }
4391
+ }
4392
+ ]
4393
+ })
4394
+ );
4395
+ server.registerPrompt(
4396
+ "import-site",
4397
+ {
4398
+ title: "Make an imported site editable (guided)",
4399
+ description: "After deploying an existing site: bring its content into the CMS so the visual editor can bind it, declare its presentation manifest, and publish everything that renders. A deploy makes a site LIVE, not EDITABLE \u2014 this flow closes that gap.",
4400
+ argsSchema: {
4401
+ request: z2.string().optional().describe("scope, e.g. 'all routes' or 'just the home page'")
4402
+ }
4403
+ },
4404
+ ({ request }) => ({
4405
+ messages: [
4406
+ {
4407
+ role: "user",
4408
+ content: {
4409
+ type: "text",
4410
+ text: `Make my imported site editable in BetterCMS.${request ? ` Scope: "${request}".` : ""}
4411
+
4412
+ Read bettercms://playbook/schema section 11 first, then work this order:
4413
+
4414
+ 1. AUTHORING GATE \u2014 if any deploy answered 409 AUTHORING_DECISION_REQUIRED, ask ME
4415
+ components-or-fields (do not choose), then set_authoring_preference.
4416
+ 2. CONTENT INTO THE CMS, per route: create_page (slug = route) -> add_page_field (or
4417
+ create_component + publish_component + component blocks) -> set_page_content with values
4418
+ EXACTLY equal to the rendered text (binding matches by value; a paraphrase binds nothing)
4419
+ -> update_page status 'published' (the canvas binds the PUBLISHED copy).
4420
+ 3. PRESENTATION MANIFEST \u2014 add bcms-presentation.json to public/ (container width, type
4421
+ scale, nav position/background, footer surface as DTCG {"$type","$value"} entries) and
4422
+ redeploy, or structural draft previews render in a generic theme, not this site's design.
4423
+ 4. VERIFY \u2014 call get_next_steps and fix what it lists (it knows about missing manifests,
4424
+ content still only in the build, and placed-but-unpublished components), or tell me why
4425
+ an item is being left.
4426
+
4347
4427
  On 401/403, the MCP key needs (re)authorizing.`
4348
4428
  }
4349
4429
  }
@@ -4366,7 +4446,19 @@ var SERVER_DISPLAY = {
4366
4446
  function buildServer(deps) {
4367
4447
  const server = new McpServer(
4368
4448
  { name: SERVER_NAME, version: SERVER_VERSION, ...SERVER_DISPLAY },
4369
- { capabilities: { tools: {}, prompts: {} } }
4449
+ { capabilities: { tools: {}, prompts: {}, resources: {} } }
4450
+ );
4451
+ server.registerResource(
4452
+ "schema-playbook",
4453
+ PLAYBOOK_URI,
4454
+ {
4455
+ title: "BetterCMS schema & components playbook",
4456
+ description: "How to design a components-first BetterCMS project: components vs collections, section anatomy, sectionType variants, kind:'block' + modular fields, the 'document' article body, the draft->publish order, and what makes an imported site editable.",
4457
+ mimeType: "text/markdown"
4458
+ },
4459
+ () => ({
4460
+ contents: [{ uri: PLAYBOOK_URI, mimeType: "text/markdown", text: SCHEMA_PLAYBOOK }]
4461
+ })
4370
4462
  );
4371
4463
  registerTools(server, {
4372
4464
  auth: deps.auth,