@typeroll/mcp-server 0.17.0 → 0.19.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
@@ -46,7 +46,6 @@ export const formTools = [
46
46
  fields: z.array(fieldSchema).min(1),
47
47
  submit_text: z.string().optional(),
48
48
  success_message: z.string().optional(),
49
- actions: z.array(z.object({ type: z.string(), config: z.record(z.unknown()) })).optional(),
50
49
  },
51
50
  handler: withErrorBoundary(async (args, { client, siteId }) => {
52
51
  const res = await client.post(siteId, 'forms', args);
@@ -63,7 +62,6 @@ export const formTools = [
63
62
  fields: z.array(fieldSchema).optional(),
64
63
  submit_text: z.string().optional(),
65
64
  success_message: z.string().optional(),
66
- actions: z.array(z.object({ type: z.string(), config: z.record(z.unknown()) })).optional(),
67
65
  }),
68
66
  },
69
67
  handler: withErrorBoundary(async (args, { client, siteId }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeroll/mcp-server",
3
- "version": "0.17.0",
3
+ "version": "0.19.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
@@ -266,6 +291,11 @@ portal at `/app/sites/{siteId}/forms/kontakt/submissions`.
266
291
  unique per site — use descriptive names: `kontakt`, `boka`, `nyhetsbrev`.
267
292
  - **Honeypot must be invisible.** `_hp` field must have `display:none`.
268
293
  If it's visible and a real user fills it, their submission is rejected.
269
- - **No email notifications yet.** Submissions are stored and visible in
270
- the portal's Submissions inbox; the email action handler isn't wired
271
- platform-side. Confirm with the customer that they'll check the inbox.
294
+ - **Email notifications are admin-only not settable via MCP.** Submissions
295
+ are stored and visible in the portal's Forms → Submissions inbox. A site
296
+ admin can also configure post-submission emails (admin notification +
297
+ autoresponder) under **Forms → <form> → Email**, after setting up an email
298
+ connector under **Settings → Email & notifications**. These carry recipient
299
+ addresses + templates over submission data, so they're deliberately off the
300
+ agent surface (`create_form`/`update_form` ignore `actions`). Point the
301
+ customer at those screens; you can't set them up for them.