@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
@@ -0,0 +1,178 @@
1
+ ---
2
+ applyTo: "ai/resource/*.xs"
3
+ ---
4
+
5
+ # Resources
6
+
7
+ Data an MCP server shares with clients as context: documents, records, schemas. A client lists them with `resources/list` (and `resources/templates/list`) and reads one with `resources/read`.
8
+
9
+ > **TL;DR:** A `resource` has a `uri`, a `stack` and a `response`. A literal uri (`docs://readme`) is a static resource with no input. A uri with `{variables}` (`orders://{order_id}`) is a template: every variable must be declared in `input { }`, and nothing else may be. Attach it with `resources = [{ name: "<resource>" }]` on the `mcp_server`.
10
+
11
+ ---
12
+
13
+ ## Quick Reference
14
+
15
+ ```xs
16
+ resource "<name>" {
17
+ uri = "<scheme>://<path-with-optional-{variables}>"
18
+ mime_type = "application/json"
19
+ input { ... }
20
+ stack { ... }
21
+ response = $data
22
+ }
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Static Resource
28
+
29
+ ```xs
30
+ resource readme {
31
+ uri = "docs://readme"
32
+ mime_type = "text/markdown"
33
+
34
+ stack {
35
+ }
36
+
37
+ response = "# Readme"
38
+ }
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Template Resource
44
+
45
+ ```xs
46
+ // One order in a region
47
+ resource regional_order {
48
+ title = "Regional order"
49
+ uri = "orders://{region}/{order_id}"
50
+ mime_type = "application/json"
51
+ annotations = {
52
+ audience : ["user", "assistant"]
53
+ priority : 0.5
54
+ last_modified: "2025-01-12T15:00:58Z"
55
+ }
56
+
57
+ input {
58
+ // The region
59
+ enum region {
60
+ values = ["us", "eu"]
61
+ }
62
+
63
+ // The order id
64
+ int order_id
65
+ }
66
+
67
+ stack {
68
+ db.get order {
69
+ field_name = "id"
70
+ field_value = $input.order_id
71
+ } as $order
72
+ }
73
+
74
+ response = $order
75
+ }
76
+ ```
77
+
78
+ Reading `orders://eu/42` binds `region = "eu"` and `order_id = 42`, converted to the declared types before the stack runs. A value that does not convert (for example `orders://eu/abc`) is refused with an invalid-params error.
79
+
80
+ ---
81
+
82
+ ## Key Fields
83
+
84
+ | Field | Purpose | Required |
85
+ |-------|---------|----------|
86
+ | `uri` | A literal URI, or a template whose `{variables}` are the input fields | Yes |
87
+ | `stack` | Logic that produces the content | Yes |
88
+ | `response` | The content to return | No |
89
+ | `input` | The template variables. Must be omitted (or empty) for a static resource | No |
90
+ | `mime_type` | The content's MIME type, such as `text/markdown` | No |
91
+ | `annotations` | `audience`, `priority`, `last_modified` (see below) | No |
92
+ | `description` | Sent to the client | No |
93
+ | `title` | Human readable display name | No |
94
+ | `icons` | Same rules as tool icons (see `tools`) | No |
95
+ | `middleware`, `history`, `tags`, `docs`, `guid` | As on a tool | No |
96
+
97
+ The declaration name (`resource regional_order`) is the resource's name. It is never its uri.
98
+
99
+ ---
100
+
101
+ ## URI Rules
102
+
103
+ - It starts with a scheme: `docs:`, `orders:`, `file:`.
104
+ - It contains no whitespace.
105
+ - Only level-1 template variables are allowed: `{name}`. Operators (`{+path}`, `{#x}`, `{/x}`), modifiers (`{x*}`, `{x:3}`) and lists (`{a,b}`) are refused.
106
+ - Each variable appears at most once, and two variables may not be adjacent (`{a}{b}`), because a concrete URI could not be split back into them.
107
+ - A variable matches one path segment: `file:///{path}` does not match `file:///a/b`.
108
+ - Variable names are letters, digits and `_`, and each must be declared in `input` as a single (non-list) `text`, `int`, `decimal`, `bool`, `enum`, `email` or `uuid` field.
109
+ - Every `input` field must be a uri variable. A static resource has no input.
110
+
111
+ ---
112
+
113
+ ## Annotations
114
+
115
+ | Key | Value |
116
+ |-----|-------|
117
+ | `audience` | A list of `"user"` and/or `"assistant"` |
118
+ | `priority` | A number from 0 to 1 |
119
+ | `last_modified` | An ISO 8601 date, e.g. `"2025-01-12T15:00:58Z"` |
120
+
121
+ Any other key is an error.
122
+
123
+ ---
124
+
125
+ ## What `response` May Return
126
+
127
+ | Response | Content the client receives |
128
+ |----------|-----------------------------|
129
+ | A UTF-8 string | `text` |
130
+ | A string that is not valid UTF-8 (binary bytes) | `blob` (base64) |
131
+ | A file resource or file variable | `blob` (base64 of the file bytes) |
132
+ | `{text: ...}` or `{blob: ...}` (optionally with `mime_type`, `uri`), or a list of them | Those items as written. A `blob` must already be base64 |
133
+ | Any other object or list | JSON `text` |
134
+ | A number, bool or null | `text` |
135
+
136
+ The content's MIME type is, in order: an explicit `{text}`/`{blob}` item's own `mime_type`, then the resource's `mime_type`, then the file's own type, then `text/plain`, `application/json` or `application/octet-stream` by shape.
137
+
138
+ ---
139
+
140
+ ## Argument Completions
141
+
142
+ For a template resource, an `enum` variable gives the client completions: `completion/complete` answers with the enum `values` that start with what the user typed. No stack runs.
143
+
144
+ ---
145
+
146
+ ## Elicitation and Progress
147
+
148
+ A resource's stack can use `mcp.elicit` and `mcp.progress`, exactly as a tool can. See `mcp-servers`.
149
+
150
+ ---
151
+
152
+ ## Attaching to a Server
153
+
154
+ ```xs
155
+ mcp_server "Orders" {
156
+ canonical = "orders-mcp"
157
+ tools = [{ name: "search_orders" }]
158
+ resources = [
159
+ { name: "readme" },
160
+ { name: "regional_order", auth: "user" }
161
+ ]
162
+ }
163
+ ```
164
+
165
+ Entry fields are `name` (required), `active` (default `true`) and `auth` (an auth-enabled table name; omitted = public). Two resources attached to one server may not share a uri.
166
+
167
+ > **Legacy:** before first-class resources, a tool reference could be advertised as a resource with `{ name: "...", type: "resource", resource_uri: "..." }` in the `tools` block. That still works for existing servers, but new work should use a `resource` object. If both exist on one uri, the first-class resource wins.
168
+
169
+ ---
170
+
171
+ ## Related Topics
172
+
173
+ | Topic | Description |
174
+ |-------|-------------|
175
+ | `mcp-servers` | Attaching resources, elicitation, progress, protocol versions |
176
+ | `prompts` | The other first-class MCP primitive |
177
+ | `tools` | Tool metadata and icon rules |
178
+ | `types` | Input field types |
@@ -156,6 +156,10 @@ input {
156
156
  }
157
157
  ```
158
158
 
159
+ ### Workspace policies
160
+
161
+ If the project has a `policies/` folder, the branch has governance policies. Keep to the active mandatory ones while you write code (their findings block merges), then evaluate after changing code: `xano policy evaluate`, the `policy_check` a `xano workspace push` returns, or `xano_evaluate_policies`. `topic: "policies"` has the details.
162
+
159
163
  ### Available Topics
160
164
 
161
- survival, working, readme, essentials, syntax, syntax/string-filters, syntax/array-filters, syntax/functions, types, database, functions, apis, tables, tasks, triggers, agents, tools, mcp-servers, security, performance, debugging, unit-testing, workflow-tests, middleware, addons, realtime, streaming, schema, integrations, integrations/cloud-storage, integrations/search, integrations/redis, integrations/external-apis, integrations/utilities, workspace, branch, run, frontend
165
+ survival, working, readme, essentials, syntax, syntax/string-filters, syntax/array-filters, syntax/functions, types, database, functions, apis, tables, tasks, triggers, agents, tools, mcp-servers, security, performance, debugging, unit-testing, workflow-tests, middleware, addons, realtime, streaming, schema, integrations, integrations/cloud-storage, integrations/search, integrations/redis, integrations/external-apis, integrations/utilities, workspace, branch, run, frontend, policies
@@ -59,6 +59,10 @@ tool "get_user_by_email" {
59
59
  | `input` | Parameters with descriptions | Sent to AI |
60
60
  | `stack` | Execution logic | Not sent to AI |
61
61
  | `response` | Return value | Sent to AI |
62
+ | `title` | Human readable display name (MCP) | Shown by MCP clients |
63
+ | `annotations` | Behavior hints (MCP) | Sent to MCP clients |
64
+ | `icons` | Icons a client may show (MCP) | Sent to MCP clients |
65
+ | `output` | Output schema; enables structured results (MCP) | Sent to MCP clients |
62
66
 
63
67
  **Important:** `instructions` and input `description` fields are sent to the AI. Write them clearly.
64
68
 
@@ -80,6 +84,119 @@ input {
80
84
 
81
85
  ---
82
86
 
87
+ ## MCP Metadata
88
+
89
+ When a tool is exposed through an `mcp_server`, these optional fields describe it to MCP clients. Agents ignore them.
90
+
91
+ ```xs
92
+ tool lookup_order {
93
+ title = "Look up an order"
94
+ annotations = {
95
+ read_only_hint : true
96
+ destructive_hint: false
97
+ idempotent_hint : true
98
+ open_world_hint : false
99
+ }
100
+
101
+ icons = [
102
+ {
103
+ src : "https://cdn.example.com/icons/order.webp"
104
+ sizes: ["any"]
105
+ theme: "light"
106
+ }
107
+ ]
108
+
109
+ input {
110
+ int order_id
111
+ }
112
+
113
+ stack {
114
+ var $order {
115
+ value = {id: $input.order_id, status: "open"}
116
+ }
117
+ }
118
+
119
+ response = $order
120
+
121
+ output {
122
+ int id
123
+ enum status {
124
+ values = ["open", "closed"]
125
+ }
126
+ }
127
+ }
128
+ ```
129
+
130
+ ### `title`
131
+
132
+ A human readable name, e.g. `"Look up an order"`. The tool name stays the identifier.
133
+
134
+ ### `annotations`
135
+
136
+ Hints about the tool's behavior. Clients use them to decide, for example, whether to ask the user before calling it. They are hints only: nothing enforces them.
137
+
138
+ | Key | Meaning |
139
+ |-----|---------|
140
+ | `read_only_hint` | The tool does not change anything |
141
+ | `destructive_hint` | The tool may delete or overwrite data |
142
+ | `idempotent_hint` | Calling it twice with the same input has no extra effect |
143
+ | `open_world_hint` | The tool reaches systems outside Xano (external APIs, the web) |
144
+
145
+ Any other key is an error.
146
+
147
+ ### `icons`
148
+
149
+ A list of `{ src, mime_type?, sizes?, theme? }`:
150
+
151
+ - `src` is an `https://` URL (at most 2048 characters) or a base64 `data:` URI of `image/png`, `image/jpeg` or `image/webp` (at most 64 KB decoded). SVG and every other scheme (`http:`, `javascript:`, `file:`) are refused, because an icon must never carry script. Xano never fetches the URL.
152
+ - `mime_type` is `image/png`, `image/jpeg` or `image/webp`.
153
+ - `sizes` is a list of `"WxH"` strings or `"any"`.
154
+ - `theme` is `light` or `dark`.
155
+
156
+ `prompt` and `resource` accept the same `title` and `icons`.
157
+
158
+ ### `output`
159
+
160
+ Declares the shape of the tool's result, with the same field syntax as `input`. When it is set, the MCP server returns the response as `structuredContent` (plus the same JSON as text) and validates it first: a response that does not match is returned as a tool error naming the first failing field. Without `output`, the response is returned as one text block, unless the stack returns a complete MCP `CallToolResult` itself (an object with a `content` list, optionally `structuredContent` and `isError`), which is passed through as-is. When `output` is set, the `structuredContent` of such a hand-built result is validated too.
161
+
162
+ ---
163
+
164
+ ## MCP Statements
165
+
166
+ `mcp.elicit` asks the MCP client a question and waits for the answer; `mcp.progress` reports progress. Both work in tools, prompts and resources. Read the rules in `mcp-servers` before using `mcp.elicit`: **the client retries the whole call with each answer, so put writes after the last elicit, and always handle `cancel`**.
167
+
168
+ ```xs
169
+ tool delete_order {
170
+ instructions = "Delete an order after the user confirms."
171
+ input {
172
+ int order_id
173
+ }
174
+
175
+ stack {
176
+ mcp.elicit {
177
+ key = "confirm"
178
+ message = "Delete order " ~ $input.order_id ~ "?"
179
+ input {
180
+ bool proceed
181
+ }
182
+ } as $answer
183
+
184
+ precondition ($answer.action == "accept" && $answer.content.proceed) {
185
+ error = "Not confirmed"
186
+ }
187
+
188
+ db.del order {
189
+ field_name = "id"
190
+ field_value = $input.order_id
191
+ }
192
+ }
193
+
194
+ response = {deleted: $input.order_id}
195
+ }
196
+ ```
197
+
198
+ ---
199
+
83
200
  ## Tool-Specific Statements
84
201
 
85
202
  > **Where these belong:** `api.call`, `task.call`, and `tool.call` are for **tools**. Use them to compose a tool from other Xano constructs. Don't reach for them in API endpoints, functions, or tasks. (To call a function from a regular stack, use `function.run`.)
@@ -307,6 +424,8 @@ tool "cancel_order" {
307
424
  | Topic | Description |
308
425
  |-------|-------------|
309
426
  | `agents` | AI agents that use tools |
310
- | `mcp-servers` | MCP servers that expose tools |
427
+ | `mcp-servers` | MCP servers that expose tools; elicitation and progress |
428
+ | `prompts` | MCP prompts |
429
+ | `resources` | MCP resources |
311
430
  | `functions` | Similar structure to tools |
312
431
  | `types` | Input type definitions |
@@ -1,5 +1,5 @@
1
1
  ---
2
- applyTo: "function/**/*.xs, api/**/*.xs, ai/tool/*.xs, ai/agent/*.xs"
2
+ applyTo: "function/**/*.xs, api/**/*.xs, ai/tool/*.xs, ai/agent/*.xs, ai/prompt/*.xs, ai/resource/*.xs"
3
3
  ---
4
4
 
5
5
  # Types & Inputs
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "2.7.1",
3
- "updated": "2026-08-03"
2
+ "version": "2.8.0",
3
+ "updated": "2026-09-28"
4
4
  }
@@ -392,6 +392,7 @@ function.run "send_notification" {
392
392
  ```
393
393
  Read: db.get (single by ID) | db.has (exists?) | db.query (filtered list)
394
394
  Write: db.add (insert) | db.edit (update known fields) | db.patch (dynamic fields) | db.add_or_edit (upsert)
395
+ Counter: db.increment (atomic add/subtract on a numeric field, rows matching where)
395
396
  Delete: db.del (single) | db.truncate (all)
396
397
  ```
397
398
 
@@ -458,6 +459,16 @@ conditional {
458
459
  db.patch "product" { field_name = "id" field_value = $input.id data = $updates } as $product
459
460
  ```
460
461
 
462
+ ### db.increment — Atomic counter (no read-then-edit race)
463
+ ```xs
464
+ // Negative value decrements; guard with where (no clamping). return = {type: "count"} returns the row count.
465
+ db.increment "product" {
466
+ where = $db.product.id == $input.id && $db.product.stock >= 1
467
+ field_name = "stock"
468
+ value = -1
469
+ } as $products
470
+ ```
471
+
461
472
  ### db.del — Delete
462
473
  ```xs
463
474
  db.del "product" { field_name = "id" field_value = $input.product_id }
@@ -640,6 +651,10 @@ var $msg { value = ($status|to_text) ~ ": " ~ ($data|json_encode) }
640
651
 
641
652
  ---
642
653
 
654
+ ## Workspace policies
655
+
656
+ If the project has a `policies/` folder, the branch has governance policies. Keep to the active mandatory ones while you write code (their findings block merges), then evaluate after changing code: `xano policy evaluate`, the `policy_check` a `xano workspace push` returns, or `xano_evaluate_policies`. `topic: "policies"` has the details.
657
+
643
658
  ## Topic Index
644
659
 
645
660
  | Topic | Description | Size |
@@ -667,3 +682,4 @@ var $msg { value = ($status|to_text) ~ ": " ~ ($data|json_encode) }
667
682
  | `middleware` | Request/response interceptors | ~6KB |
668
683
  | `realtime` | WebSocket channels and events | ~9KB |
669
684
  | `streaming` | Large file/data streaming | ~8KB |
685
+ | `policies` | Workspace policy documents: syntax, checks, authoring and fix rules | ~78KB |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xano/developer-mcp",
3
- "version": "2.2.6",
3
+ "version": "2.3.0-beta.1",
4
4
  "description": "MCP server and library for Xano development - XanoScript validation, Meta API, Run API, and CLI documentation",
5
5
  "mcpName": "io.github.xano-inc/xano-developer-mcp",
6
6
  "type": "module",
@@ -37,6 +37,7 @@
37
37
  "test": "vitest run",
38
38
  "test:watch": "vitest",
39
39
  "test:coverage": "vitest run --coverage",
40
+ "gen:policy-docs": "node scripts/gen-policy-check-docs.mjs",
40
41
  "prepublishOnly": "./scripts/check-publish-tag.sh && npm run build",
41
42
  "publish:beta": "./scripts/bump-version.sh beta && npm publish --tag beta",
42
43
  "publish:latest": "./scripts/bump-version.sh patch && npm publish"
@@ -62,7 +63,7 @@
62
63
  "license": "MIT",
63
64
  "dependencies": {
64
65
  "@modelcontextprotocol/sdk": "^1.26.0",
65
- "@xano/xanoscript-language-server": "^12.14.0",
66
+ "@xano/xanoscript-language-server": "^12.18.0",
66
67
  "minimatch": "^10.1.2",
67
68
  "zod": "^4.0.0"
68
69
  },