@xano/developer-mcp 2.2.6 → 2.3.0-beta.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 (37) hide show
  1. package/README.md +16 -5
  2. package/dist/cli_docs/index.js +4 -0
  3. package/dist/cli_docs/topics/function.js +2 -0
  4. package/dist/cli_docs/topics/knowledge.js +2 -1
  5. package/dist/cli_docs/topics/policy.d.ts +2 -0
  6. package/dist/cli_docs/topics/policy.js +91 -0
  7. package/dist/cli_docs/topics/skills.d.ts +2 -0
  8. package/dist/cli_docs/topics/skills.js +57 -0
  9. package/dist/cli_docs/topics/workspace.js +11 -4
  10. package/dist/meta_api_docs/index.js +6 -0
  11. package/dist/meta_api_docs/topics/mcp_primitive.d.ts +13 -0
  12. package/dist/meta_api_docs/topics/mcp_primitive.js +105 -0
  13. package/dist/meta_api_docs/topics/mcp_server.js +6 -2
  14. package/dist/meta_api_docs/topics/policy.d.ts +3 -0
  15. package/dist/meta_api_docs/topics/policy.js +135 -0
  16. package/dist/meta_api_docs/topics/prompt.d.ts +2 -0
  17. package/dist/meta_api_docs/topics/prompt.js +54 -0
  18. package/dist/meta_api_docs/topics/resource.d.ts +2 -0
  19. package/dist/meta_api_docs/topics/resource.js +49 -0
  20. package/dist/meta_api_docs/topics/tool.js +24 -2
  21. package/dist/tools/validate_xanoscript.js +14 -2
  22. package/dist/xanoscript.d.ts +5 -0
  23. package/dist/xanoscript.js +4 -0
  24. package/dist/xanoscript_docs/README.md +3 -0
  25. package/dist/xanoscript_docs/database.md +112 -3
  26. package/dist/xanoscript_docs/docs_index.json +31 -4
  27. package/dist/xanoscript_docs/essentials.md +12 -0
  28. package/dist/xanoscript_docs/mcp-servers.md +149 -4
  29. package/dist/xanoscript_docs/policies.md +308 -0
  30. package/dist/xanoscript_docs/prompts.md +153 -0
  31. package/dist/xanoscript_docs/resources.md +178 -0
  32. package/dist/xanoscript_docs/survival.md +5 -1
  33. package/dist/xanoscript_docs/tools.md +120 -1
  34. package/dist/xanoscript_docs/types.md +1 -1
  35. package/dist/xanoscript_docs/version.json +2 -2
  36. package/dist/xanoscript_docs/working.md +16 -0
  37. package/package.json +3 -2
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.7.1",
2
+ "version": "2.8.0",
3
3
  "description": "Machine-readable index for XanoScript documentation (version mirrors version.json)",
4
4
 
5
5
  "topics": {
@@ -71,7 +71,7 @@
71
71
  "types": {
72
72
  "file": "types.md",
73
73
  "description": "Data types, input blocks, and validation",
74
- "applyTo": ["function/**/*.xs", "api/**/*.xs", "ai/tool/*.xs", "ai/agent/*.xs"],
74
+ "applyTo": ["function/**/*.xs", "api/**/*.xs", "ai/tool/*.xs", "ai/agent/*.xs", "ai/prompt/*.xs", "ai/resource/*.xs"],
75
75
  "priority": 5,
76
76
  "aliases": ["validation", "input", "data-types"]
77
77
  },
@@ -112,8 +112,8 @@
112
112
  },
113
113
  "database": {
114
114
  "file": "database.md",
115
- "description": "All db.* operations: query, get, add, edit, patch, delete",
116
- "applyTo": ["function/**/*.xs", "api/**/*.xs", "task/*.xs", "ai/tool/*.xs"],
115
+ "description": "All db.* operations: query, get, add, edit, patch, increment, delete",
116
+ "applyTo": ["function/**/*.xs", "api/**/*.xs", "task/*.xs", "ai/tool/*.xs", "ai/prompt/*.xs", "ai/resource/*.xs"],
117
117
  "priority": 5,
118
118
  "aliases": ["db", "crud", "query", "sql"]
119
119
  },
@@ -138,6 +138,20 @@
138
138
  "priority": 3,
139
139
  "aliases": ["mcp", "model-context-protocol"]
140
140
  },
141
+ "prompts": {
142
+ "file": "prompts.md",
143
+ "description": "MCP prompts: reusable prompt templates an MCP server offers, with arguments and completions",
144
+ "applyTo": ["ai/prompt/*.xs"],
145
+ "priority": 3,
146
+ "aliases": ["prompt", "mcp-prompts"]
147
+ },
148
+ "resources": {
149
+ "file": "resources.md",
150
+ "description": "MCP resources: static and URI-template resources an MCP server shares as context",
151
+ "applyTo": ["ai/resource/*.xs"],
152
+ "priority": 3,
153
+ "aliases": ["resource", "mcp-resources", "resource-templates"]
154
+ },
141
155
  "unit-testing": {
142
156
  "file": "unit-testing.md",
143
157
  "description": "Unit tests, mocks, and assertions within functions, APIs, and middleware",
@@ -288,6 +302,14 @@
288
302
  "applyTo": ["workspace/**/*.xs"],
289
303
  "priority": 3,
290
304
  "aliases": ["env", "environment", "preferences"]
305
+ },
306
+ "policies": {
307
+ "file": "policies.md",
308
+ "description": "Workspace policies: human descriptions and deterministic check rules, validated by the platform",
309
+ "applyTo": ["policies/*.xs"],
310
+ "exclusive": true,
311
+ "priority": 3,
312
+ "aliases": ["policy", "governance"]
291
313
  }
292
314
  },
293
315
 
@@ -355,6 +377,8 @@
355
377
  "agent": { "file": "agents.md", "tools": "tools.md" },
356
378
  "tool": { "file": "tools.md", "mcp": "mcp-servers.md" },
357
379
  "mcp_server": { "file": "mcp-servers.md", "triggers": "triggers.md" },
380
+ "prompt": { "file": "prompts.md", "mcp": "mcp-servers.md" },
381
+ "resource": { "file": "resources.md", "mcp": "mcp-servers.md" },
358
382
  "table_trigger": { "file": "triggers.md", "section": "table-trigger" },
359
383
  "realtime_trigger": { "file": "triggers.md", "section": "realtime-trigger" },
360
384
  "workspace_trigger": { "file": "triggers.md", "section": "workspace-trigger" },
@@ -373,12 +397,15 @@
373
397
  "operations": {
374
398
  "realtime.publish": { "file": "realtime-v2.md" },
375
399
  "realtime.get_session": { "file": "realtime-v2.md" },
400
+ "mcp.elicit": { "file": "mcp-servers.md" },
401
+ "mcp.progress": { "file": "mcp-servers.md" },
376
402
  "db.query": { "file": "database.md" },
377
403
  "db.get": { "file": "database.md" },
378
404
  "db.has": { "file": "database.md" },
379
405
  "db.add": { "file": "database.md" },
380
406
  "db.edit": { "file": "database.md" },
381
407
  "db.patch": { "file": "database.md" },
408
+ "db.increment": { "file": "database.md" },
382
409
  "db.del": { "file": "database.md" },
383
410
  "db.truncate": { "file": "database.md" },
384
411
  "api.request": { "file": "integrations/external-apis.md" },
@@ -693,6 +693,18 @@ db.truncate "session" { reset = true }
693
693
 
694
694
  See `xano_xanoscript_docs({ topic: "database" })` for all delete operations.
695
695
 
696
+ ### 16. Read-then-edit counters (lost updates)
697
+
698
+ `db.get` → add → `db.edit` races: two concurrent requests both read `5` and write `6`. Use `db.increment` (atomic; negative `value` decrements; guard with `where`, no clamping; the key is `field_name`).
699
+
700
+ ```xs
701
+ db.increment "product" {
702
+ where = $db.product.id == $input.id && $db.product.stock >= 1
703
+ field_name = "stock"
704
+ value = -1
705
+ } as $products
706
+ ```
707
+
696
708
  ---
697
709
 
698
710
  ## Validation is syntax-only
@@ -4,7 +4,7 @@ applyTo: "ai/mcp_server/*.xs"
4
4
 
5
5
  # MCP Servers
6
6
 
7
- Model Context Protocol servers that expose tools to external AI clients.
7
+ Model Context Protocol servers that expose tools, prompts and resources to external AI clients.
8
8
 
9
9
  ## Quick Reference
10
10
 
@@ -15,6 +15,8 @@ mcp_server "<name>" {
15
15
  instructions = "How to use this server's tools"
16
16
  tags = ["category"]
17
17
  tools = [{ name: "<tool-name>" }]
18
+ prompts = [{ name: "<prompt-name>" }]
19
+ resources = [{ name: "<resource-name>" }]
18
20
  }
19
21
  ```
20
22
 
@@ -49,6 +51,8 @@ mcp_server "Customer Support" {
49
51
  | `tags` | Organization/categorization | No |
50
52
  | `docs` | Internal team notes | No |
51
53
  | `tools` | List of exposed tools | Yes |
54
+ | `prompts` | List of exposed prompts (see `prompts`) | No |
55
+ | `resources` | List of exposed resources (see `resources`) | No |
52
56
 
53
57
  ---
54
58
 
@@ -77,7 +81,7 @@ change the tool itself or how any other server exposes it.
77
81
  | `name` | Tool file name in `ai/tool/` | — (required) |
78
82
  | `active` | Whether connections to this entry are allowed | `true` |
79
83
  | `auth` | Name of an auth-enabled table required to call it | omitted = no auth |
80
- | `type` | `"tool"` or `"resource"` | `"tool"` |
84
+ | `type` | `"tool"`, or the legacy `"resource"` | `"tool"` |
81
85
  | `resource_uri` | URI identifying the resource (`type: "resource"` only) | `""` |
82
86
  | `tool_meta` | MCP `_meta` payload sent with the tool (`type: "tool"` only) | `""` |
83
87
 
@@ -108,7 +112,9 @@ Set `auth` to the name of a table that has authentication enabled. Only requests
108
112
  with a valid access token for that table may call the tool. Omit `auth` to leave
109
113
  the tool public. An unknown table name resolves to no auth rather than an error.
110
114
 
111
- ### `type` and `resource_uri`
115
+ ### `type` and `resource_uri` (legacy)
116
+
117
+ > **Legacy:** `type: "resource"` predates first-class resources. It still works for existing servers, but new work should create a `resource` object and list it in the server's `resources` block (see below and the `resources` topic). If a first-class resource and a legacy reference share a uri, the first-class resource wins.
112
118
 
113
119
  `type` chooses what MCP object the connected tool is advertised as:
114
120
 
@@ -142,6 +148,143 @@ the server is exported.
142
148
 
143
149
  ---
144
150
 
151
+ ## Prompts and Resources Blocks
152
+
153
+ First-class prompts (`ai/prompt/`) and resources (`ai/resource/`) are attached the same way as tools. These blocks exist on `mcp_server` only; an `agent` cannot have them.
154
+
155
+ ```xs
156
+ mcp_server "Orders" {
157
+ canonical = "orders-mcp"
158
+ tools = [{ name: "search_orders" }]
159
+ prompts = [
160
+ { name: "summarize_order", auth: "user" },
161
+ { name: "old_prompt", active: false }
162
+ ]
163
+ resources = [{ name: "regional_order" }]
164
+ }
165
+ ```
166
+
167
+ Each entry takes `name` (required, the file name), `active` (default `true`) and `auth` (an auth-enabled table name; omitted = public). A client only sees, fetches and completes the prompts and resources attached to the server it connected to.
168
+
169
+ ---
170
+
171
+ ## Elicitation
172
+
173
+ `mcp.elicit` asks the user a question in the middle of a tool, prompt or resource, and gives the stack the answer.
174
+
175
+ ```xs
176
+ tool refund_order {
177
+ instructions = "Refund an order after the user confirms the amount."
178
+ input {
179
+ int order_id
180
+ }
181
+
182
+ stack {
183
+ mcp.elicit {
184
+ key = "confirm_refund"
185
+ message = "Refund order " ~ $input.order_id ~ "?"
186
+ input {
187
+ bool proceed
188
+ text reason? filters=max:200
189
+ }
190
+ } as $answer
191
+
192
+ conditional {
193
+ if ($answer.action == "accept" && $answer.content.proceed) {
194
+ db.edit order {
195
+ field_name = "id"
196
+ field_value = $input.order_id
197
+ data = {status: "refunded", refund_reason: $answer.content.reason}
198
+ } as $order
199
+ }
200
+
201
+ else {
202
+ var $order {
203
+ value = null
204
+ }
205
+ }
206
+ }
207
+ }
208
+
209
+ response = {refunded: $order != null}
210
+ }
211
+ ```
212
+
213
+ - `key` (required) names the answer. Use a different key for each elicit in the stack.
214
+ - `message` (required) is the question shown to the user.
215
+ - `input` (optional) is the form. It supports `text`, `email`, `date`, `int`, `decimal`, `bool`, `enum` and `enum[]` fields, with `min`/`max` filters, descriptions and defaults. Nested objects, other lists, files, json, timestamps, `password` and `sensitive` fields are refused.
216
+ - The result is `{action, content}`. `action` is `accept`, `decline` or `cancel`; `content` holds the form fields on `accept`.
217
+
218
+ ### Rule 1: always handle `cancel`
219
+
220
+ Input is only collected from clients on MCP `2026-07-28` that support form elicitation. **Every other client gets `{action: "cancel"}` immediately**, and so does a run outside MCP (an agent, a function test, or a debug run with no simulated answer for that key). A stack that treats anything but `accept` as "stop" is correct everywhere.
221
+
222
+ ### Rule 2: writes go after the last elicit
223
+
224
+ The server does not pause. It ends the call with an `input_required` result, and the client calls the tool again with the answer attached. **The whole stack runs again from the top on every retry**, so a `db.add` placed before the elicit runs once per round trip. Put writes, emails, non-GET `api.request` calls and `function.run` after the last `mcp.elicit`. The editor warns when one comes first.
225
+
226
+ Other elicitation rules:
227
+
228
+ - It cannot run inside an async-shared function.
229
+ - An elicit inside `db.transaction` commits that transaction's earlier writes on each attempt.
230
+ - Debug runs (`debugTool`, `debugPrompt`, `debugResource` in the Meta API) take simulated answers keyed by elicit key, e.g. `{"confirm_refund": {"action": "accept", "content": {"proceed": true}}}`; an elicit with no simulated answer gets `cancel`.
231
+
232
+ ---
233
+
234
+ ## Progress
235
+
236
+ `mcp.progress` sends a progress update to the client during a long tool, prompt or resource:
237
+
238
+ ```xs
239
+ tool import_rows {
240
+ input {
241
+ object[] rows {
242
+ schema {
243
+ text name
244
+ }
245
+ }
246
+ }
247
+
248
+ stack {
249
+ var $count {
250
+ value = $input.rows|count
251
+ }
252
+
253
+ for ($count) {
254
+ each as $idx {
255
+ db.add row_import {
256
+ data = {name: $input.rows[$idx].name}
257
+ }
258
+
259
+ mcp.progress {
260
+ progress = $idx + 1
261
+ total = $count
262
+ message = "Imported row " ~ ($idx + 1)
263
+ }
264
+ }
265
+ }
266
+ }
267
+
268
+ response = {imported: $count}
269
+ }
270
+ ```
271
+
272
+ `progress` must increase on every call; a value that does not is dropped. `total` and `message` are optional. Outside MCP, or when the client did not ask for progress, no notification is sent; a debug run (`debugTool`, `debugPrompt`, `debugResource`) captures the calls in its response instead.
273
+
274
+ ---
275
+
276
+ ## Change Notifications
277
+
278
+ When a tool, prompt or resource attached to a server changes, clients on MCP `2026-07-28` that hold a `subscriptions/listen` stream receive `notifications/tools/list_changed` (or `prompts/`, `resources/`). A client only hears about changes to the server it is connected to. **This requires a Swoole instance**; elsewhere the server does not advertise `listChanged` and clients re-list instead.
279
+
280
+ ---
281
+
282
+ ## Protocol Versions
283
+
284
+ A server answers MCP `2026-07-28` clients and older clients (`2024-11-05` through `2025-11-25`) on the same URL, chosen per request. You do not configure anything. Older clients get every feature their version has; what they miss is listed above (elicitation answers and change notifications).
285
+
286
+ ---
287
+
145
288
  ## Examples
146
289
 
147
290
  ### Task Management Server
@@ -267,6 +410,8 @@ The MCP protocol handles:
267
410
 
268
411
  | Topic | Description |
269
412
  |-------|-------------|
270
- | `tools` | AI tool definitions used by MCP servers |
413
+ | `tools` | AI tool definitions and MCP tool metadata |
414
+ | `prompts` | First-class MCP prompts |
415
+ | `resources` | First-class MCP resources |
271
416
  | `agents` | AI agent configuration |
272
417
  | `triggers` | MCP server triggers for connection events |