@mapled/mcp 0.13.2 → 0.14.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.
Files changed (3) hide show
  1. package/README.md +4 -3
  2. package/dist/tools.js +43 -11
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -46,7 +46,7 @@ For the first integration, propose one plan and let the owner approve it on a tr
46
46
  2. `propose_setup_plan` — the collections and singles (with fields and the records to import), the files you will change, the packages you will install. Nothing changes yet. Relation fields name their target — a collection of the plan by its display name, or an existing one by key; give a record a `"$ref": "jane"` and other records of the plan link to it as `"author": "jane"` (a list of refs for `many`), while links to existing collections use record ids from `list_records`. Group fields carry their sub-fields; their values are objects keyed by the sub-field keys. Mark a field — or a sub-field of a group — `sensitive: true` when editors keep it but the site must never get it. A link that does not resolve is answered right away with its path, so fix the plan before the owner sees it.
47
47
  3. Ask the user to open the returned `reviewUrl` and approve. Poll `get_setup_run` until its status is `approved` (or `rejected` — then propose a better plan).
48
48
  4. `apply_setup_plan` — Mapled creates everything in one go and tells you the keys it assigned.
49
- 5. Wire the site: `get_connection`, `configure_revalidation`, deploy, then close with `report_setup` (files changed, `buildPassed`, `secretsCommitted: false`). Mapled runs its own checks — the site reads content, the webhook delivered, the preview route responds, fields have help texts — and the run is completed only when they pass. Fix what failed and call `verify_setup`.
49
+ 5. Wire the site: `get_connection`, then `configure_revalidation` for a site with a server — or `set_site_url` for one rendered in the browser (a React single-page app, plain HTML: no webhook, no preview route) — deploy, then close with `report_setup` (files changed, `buildPassed`, `secretsCommitted: false`). Mapled runs its own checks — the site reads content, the webhook delivered, the preview route responds, fields have help texts — and the run is completed only when they pass. Fix what failed and call `verify_setup`.
50
50
  6. Leave a guide: `get_mapled_md` renders `MAPLED.md` from the project — what the site reads and where, the content model, the working rules, the commands that verify the integration. Write it to the repository root and commit it; the next agent (or person) starts from it. When the file exists, replace everything above its `<!-- mapled:notes -->` line and keep the notes below.
51
51
 
52
52
  ## Destructive and breaking changes
@@ -66,9 +66,10 @@ A rename or a conversion Mapled wouldn't take is refused at once with the reason
66
66
  | `add_records` | Insert draft records |
67
67
  | `list_records` | Read a collection's draft records, newest edit first — `query` searches their content, `limit` (1–200) and `cursor` (the previous answer's `nextCursor`) page through them; `total` counts every match |
68
68
  | `create_form` / `list_forms` | Set up public forms with spam protection |
69
- | `get_connection` (image values → `assetUrl(id, { width })` from @mapled/next) | Delivery key + API URL for wiring the site (`@mapled/next`) |
69
+ | `get_connection` | The delivery key and the API URL, plus — for the `framework` the agent names (`nextjs`, `react-spa`, `plain-html`, …) or the project's own — the package the site reads through (`@mapled/next`, `@mapled/react`, `@mapled/vanilla` — a script tag and `data-mapled-*` attributes for plain HTML — or `@mapled/client`), the env var of the key, whether the site renders on a server or in the browser, and the wire-up steps. Image values → `assetUrl(id, { width })` of the same package |
70
+ | `set_site_url` | Where the site is deployed — for a site rendered in the browser (a React single-page app, plain HTML), which has no webhook to learn it from: Preview opens the site there, verification checks that it answers |
70
71
  | `push_site_manifest` / `list_bindings` | Tell Mapled where each field is rendered; read every binding's health (type mismatch, outdated, missing on site). Keep the repository's copy in `mapled/manifest.json` — `npx @mapled/cli scan --write` derives it from the code and `bindings push` / `bindings pull` exchange it with Mapled. A push records the integration hash — the schema and these bindings — and `list_bindings` says whether it still matches (`integration.inSync`, with `schemaChanged` / `bindingsChanged` naming what moved) |
71
- | `configure_revalidation` | Point the publish webhook at the site, get the signing secret; the description also tells the agent how to add live updates for tabs that are already open (`createReleaseHandler` and `<MapledLive />`, `@mapled/next` 0.8.0+) |
72
+ | `configure_revalidation` | Point the publish webhook at the site (one with a server that caches what it reads), get the signing secret; the description also tells the agent how to add live updates for tabs that are already open (`createReleaseHandler` and `<MapledLive />`, `@mapled/next` 0.8.0+) |
72
73
  | `check_integration` | The site's integration as Mapled sees it — delivery reads, the webhook and its last delivery, the bindings summary, the integration hash (is the last push still in step with the schema and the bindings?), current package versions; `npx @mapled/cli doctor` shows the same from inside the repository |
73
74
  | `delete_collection` / `remove_field` / `clear_records` / `rename_field` / `convert_field` / `get_confirmation` | Destructive and breaking changes — each files a request a person confirms on a trusted Mapled screen (see above); `get_confirmation` reads its status |
74
75
  | `get_mapled_md` | `MAPLED.md` rendered from the project — the guide for the next agent: project, how the site reads it, content model, bindings by page, last setup run, working rules, verification commands. Never a secret. `npx @mapled/cli md pull` writes the same file; `mapled doctor` says when it is out of date |
package/dist/tools.js CHANGED
@@ -286,7 +286,12 @@ export function createTools(api) {
286
286
  "image_alt, link, number, date, boolean, collection for a repeated list, route_param, form_field). " +
287
287
  "Push the full list every time; bindings you leave out are marked missing on the site. Mapled grades " +
288
288
  "each binding against the schema (healthy, type mismatch, outdated) and returns warnings for unknown " +
289
- "collections or fields. The answer's manifest.integrationHash is the hash of the schema and these " +
289
+ "collections or fields. `framework` is what the site is built with, as a short key: \"nextjs\", " +
290
+ "\"react-spa\" (a React single-page app — Vite and the like), \"plain-html\", or astro, remix, nuxt, " +
291
+ "sveltekit…; react-spa and plain-html tell Mapled the site renders in the browser, so verification " +
292
+ "expects no webhook and no preview route. A plain HTML page that shows one record keeps the slug in its " +
293
+ "query — name it \"/post.html?slug=[slug]\", with a route_param binding on the slug field. " +
294
+ "The answer's manifest.integrationHash is the hash of the schema and these " +
290
295
  "bindings — what the site is synced with from now on; check_integration reports inSync against it. " +
291
296
  "Needs the builder plan.",
292
297
  schema: {
@@ -484,21 +489,47 @@ export function createTools(api) {
484
489
  },
485
490
  {
486
491
  name: "get_connection",
487
- description: "Get what the site needs to read published Mapled content: the delivery key and API URL. " +
488
- "Wire-up: npm install @mapled/next, put the key in the site's env as MAPLED_KEY, then " +
489
- 'createClient({ key: process.env.MAPLED_KEY! }).getRecords("<collection>") in server components. ' +
492
+ description: "Get what the site needs to read published Mapled content: the delivery key, the API URL, the package " +
493
+ "for the site's framework (`sdk`), the env var the key goes in (`envVar`), how the site renders " +
494
+ "(`rendering`: server or browser) and `wireUp` — the steps for that framework; follow them. Pass " +
495
+ '`framework` as you see it in the repository: "nextjs" (@mapled/next), "react-spa" for a React ' +
496
+ 'single-page app such as Vite (@mapled/react), "plain-html" for pages without a build step ' +
497
+ "(@mapled/vanilla: one script tag and data-mapled-* attributes on the elements — no reading code to " +
498
+ "write, wireUp lists the attributes), or another short key (astro, remix, … — " +
499
+ "@mapled/client on the server); left out, the project's own is used. The JavaScript packages have the same reads: " +
500
+ 'createClient({ key }).getRecords("<collection>"), getSingle, getRecordBySlug. ' +
490
501
  "Reads take filter ({ field: value } or { field: { gte, lt, in, contains… } }), sort, limit/offset, " +
491
502
  "fields, and expand (relation fields, e.g. [\"author\"]) — linked records arrive under record.expanded; " +
492
503
  "getRecordBySlug(collection, slug) reads one record by its slug field. " +
493
- "Image values are asset ids: assetUrl(id, { width, format }) from @mapled/next gives the URL of a resized variant. " +
494
- "rich_text values are Markdown — render them with a Markdown component (e.g. react-markdown), never as raw HTML. " +
504
+ "Image values are asset ids: assetUrl(id, { width, format }) from the same package gives the URL of a resized variant. " +
505
+ "rich_text values are Markdown — render them with a Markdown component (e.g. react-markdown), never as raw HTML " +
506
+ "(@mapled/vanilla renders them itself: data-mapled-format=\"markdown\"). " +
495
507
  "Content appears on the site only after a human presses Publish in Mapled.",
496
- schema: {},
497
- handler: async () => api.request("GET", "/v1/agent/connection"),
508
+ schema: {
509
+ framework: z
510
+ .string()
511
+ .regex(/^[a-z0-9][a-z0-9.-]{0,39}$/)
512
+ .optional(),
513
+ },
514
+ handler: async (args) => api.request("GET", `/v1/agent/connection${args.framework ? `?framework=${encodeURIComponent(args.framework)}` : ""}`),
515
+ },
516
+ {
517
+ name: "set_site_url",
518
+ description: "Tell Mapled where the site is deployed — for a site without a publish webhook, that is one rendered in " +
519
+ 'the browser (framework "react-spa" or "plain-html"): Preview opens the site there and verification ' +
520
+ "checks that it answers. Pass the public URL of the deployed site; local and private addresses are " +
521
+ "rejected. Mapled keeps its origin as the project's production domain, which the owner sees in Project " +
522
+ "settings. A site with a webhook doesn't need this: its address comes from configure_revalidation.",
523
+ schema: {
524
+ url: z.string().min(4).max(2048),
525
+ },
526
+ handler: async (args) => api.request("PATCH", "/v1/agent/site", { url: args.url }),
498
527
  },
499
528
  {
500
529
  name: "configure_revalidation",
501
- description: "Point Mapled's publish webhook at the site so published changes appear instantly. " +
530
+ description: "Point Mapled's publish webhook at the site so published changes appear instantly. Only for a site with " +
531
+ "a server that caches what it reads (Next.js and the like); a site rendered in the browser (react-spa, " +
532
+ "plain-html) shows a publish on the next load and needs none — call set_site_url for it instead. " +
502
533
  "Pass the site's public revalidate URL (with @mapled/next: mount createRevalidateHandler " +
503
534
  "from \"@mapled/next/server\" at /api/mapled/revalidate and pass that URL here). " +
504
535
  "Returns the signing secret — store it in the site's env as MAPLED_WEBHOOK_SECRET. " +
@@ -529,8 +560,9 @@ export function createTools(api) {
529
560
  name: "check_integration",
530
561
  description: "See the site's integration as Mapled sees it: whether the site has read content with the delivery key " +
531
562
  "and when, the publish webhook's URL and its last delivery, the bindings summary of the last manifest, " +
532
- "the connection you hold, the package versions Mapled considers current (@mapled/next, @mapled/mcp, " +
533
- "the mapled CLI) and `integration` — the integration hash: `hash` is the schema and the bindings as " +
563
+ "`site` (the framework Mapled takes the site for, whether it renders on a server or in the browser, and " +
564
+ "the address Preview opens), the connection you hold, the package versions Mapled considers current " +
565
+ "and `integration` — the integration hash: `hash` is the schema and the bindings as " +
534
566
  "Mapled holds them now, `synced` what the last manifest push recorded; inSync false means the site was " +
535
567
  "wired against an older schema (schemaChanged) or bindings were edited in Mapled (bindingsChanged) — " +
536
568
  "re-sync it (schema diff, update the site, push the manifest again). The repository computes the same " +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapled/mcp",
3
- "version": "0.13.2",
3
+ "version": "0.14.1",
4
4
  "description": "Mapled MCP server: lets AI agents build schema and content for one Mapled project.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://mapled.io",