@typeroll/mcp-server 0.17.0 → 0.18.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
@@ -140,9 +140,22 @@ maps to one HTTP endpoint; the actual logic runs in the customer's portal
140
140
  full-bleed for that section.
141
141
  - **`core/html`** is the raw-HTML escape hatch for block-mode pages —
142
142
  one `html` field rendered verbatim (then sanitized like HTML-mode
143
- content). Use it for the genuinely unique thing no block covers: a
144
- form embed with its signed `_token`, a third-party widget's markup,
145
- a hand-crafted one-off. Prefer real blocks when one fits.
143
+ content). Use it for the genuinely unique thing no block covers.
144
+ Prefer real blocks when one fits.
145
+ - **Forms 2.0** (template_capabilities_version 0.18.0): forms can
146
+ carry `steps[]` — each step is a Block[] tree mixing `form/*` field
147
+ blocks (text/email/phone/number, textarea, select/radio_group/
148
+ checkbox_group, toggle, slider, date, heading, help, consent,
149
+ hidden) with any content blocks. Place `{ type: 'core/form',
150
+ data: { form_id } }` on a page — the build renders step 1 + all
151
+ static steps with the signed token, honeypot and proof-of-work
152
+ runtime baked in; submissions accumulate per step (partial →
153
+ complete, 30-day TTL on abandoned partials). Per-step validation is
154
+ derived from the field blocks (required/pattern/min/max) — no
155
+ separate field list to keep in sync. `update_form` accepts steps,
156
+ styles (form-scoped CSS), kind and partial_ttl_days. Legacy
157
+ single-step forms (fields[] + core/html embed) keep working
158
+ unchanged.
146
159
  - **`script` on custom block types** (create/update_block_type) is
147
160
  accepted under your API key's authority — the same trust level that
148
161
  already lets the key write `scripts_head`/`custom_css`. Every
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeroll/mcp-server",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Model Context Protocol server for the Typeroll public API. Use with Claude Code or any MCP-compatible client to manage a Typeroll site.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -15,6 +15,31 @@ Submissions inbox. No third-party service needed.
15
15
  - Site exists and MCP is configured.
16
16
  - You know what fields the form needs.
17
17
 
18
+ ## Forms 2.0 — steps mode (template_capabilities_version ≥ 0.18.0)
19
+
20
+ Prefer this over the hand-built core/html embed when the portal supports
21
+ it. A form's `steps[]` are Block[] trees of `form/*` field blocks mixed
22
+ with content blocks; place `{ type: 'core/form', data: { form_id } }` on
23
+ the page and the build renders everything (token, honeypot, runtime,
24
+ proof-of-work) — you never hand-write the <form> markup.
25
+
26
+ ```
27
+ update_form form_id=ansokan patch={ steps: [
28
+ { id: 'steg1', title: 'Om företaget', blocks: [
29
+ { type: 'form/text', data: { name: 'foretag', label: 'Företag', required: true } },
30
+ { type: 'form/email', data: { name: 'epost', label: 'E-post', required: true } } ] },
31
+ { id: 'steg2', title: 'Detaljer', blocks: [
32
+ { type: 'form/textarea', data: { name: 'meddelande', label: 'Meddelande' } },
33
+ { type: 'form/consent', data: { name: 'gdpr', text: '<p>Jag godkänner …</p>' } } ] } ] }
34
+ add_block target={kind:'page', id:'kontakt'} block={ type: 'core/form', data: { form_id: 'ansokan' } }
35
+ ```
36
+
37
+ Validation derives from the field blocks (required/pattern/min/max) —
38
+ there is no separate field list to maintain. Partial submissions persist
39
+ per step (TTL `partial_ttl_days`, default 30). Form-scoped CSS goes in
40
+ `styles`; field look is themable via `--form-field-*` tokens in the
41
+ site's custom_css. On older portals, use the legacy recipe below.
42
+
18
43
  ## Recipe
19
44
 
20
45
  ### 1. Create the form definition