@xano/developer-mcp 1.0.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.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +261 -0
  3. package/api_docs/addon.md +193 -0
  4. package/api_docs/agent.md +154 -0
  5. package/api_docs/api_group.md +236 -0
  6. package/api_docs/authentication.md +68 -0
  7. package/api_docs/file.md +190 -0
  8. package/api_docs/function.md +217 -0
  9. package/api_docs/history.md +263 -0
  10. package/api_docs/index.md +104 -0
  11. package/api_docs/mcp_server.md +139 -0
  12. package/api_docs/middleware.md +205 -0
  13. package/api_docs/realtime.md +153 -0
  14. package/api_docs/table.md +151 -0
  15. package/api_docs/task.md +191 -0
  16. package/api_docs/tool.md +216 -0
  17. package/api_docs/triggers.md +344 -0
  18. package/api_docs/workspace.md +246 -0
  19. package/dist/index.d.ts +2 -0
  20. package/dist/index.js +495 -0
  21. package/package.json +49 -0
  22. package/xanoscript_docs/README.md +1 -0
  23. package/xanoscript_docs/api_query_examples.md +1255 -0
  24. package/xanoscript_docs/api_query_guideline.md +129 -0
  25. package/xanoscript_docs/build_from_lovable.md +715 -0
  26. package/xanoscript_docs/db_query_guideline.md +427 -0
  27. package/xanoscript_docs/ephemeral_environment_guideline.md +529 -0
  28. package/xanoscript_docs/expression_guideline.md +1086 -0
  29. package/xanoscript_docs/frontend_guideline.md +67 -0
  30. package/xanoscript_docs/function_examples.md +1406 -0
  31. package/xanoscript_docs/function_guideline.md +130 -0
  32. package/xanoscript_docs/functions.md +2155 -0
  33. package/xanoscript_docs/input_guideline.md +227 -0
  34. package/xanoscript_docs/mcp_server_examples.md +36 -0
  35. package/xanoscript_docs/mcp_server_guideline.md +69 -0
  36. package/xanoscript_docs/query_filter.md +489 -0
  37. package/xanoscript_docs/table_examples.md +586 -0
  38. package/xanoscript_docs/table_guideline.md +137 -0
  39. package/xanoscript_docs/task_examples.md +511 -0
  40. package/xanoscript_docs/task_guideline.md +103 -0
  41. package/xanoscript_docs/tips_and_tricks.md +144 -0
  42. package/xanoscript_docs/tool_examples.md +69 -0
  43. package/xanoscript_docs/tool_guideline.md +139 -0
  44. package/xanoscript_docs/unit_testing_guideline.md +328 -0
  45. package/xanoscript_docs/version.json +3 -0
  46. package/xanoscript_docs/workspace.md +17 -0
@@ -0,0 +1,344 @@
1
+ # Triggers API
2
+
3
+ Triggers are event-driven functions that execute automatically in response to specific events.
4
+
5
+ ## Trigger Types
6
+
7
+ | Type | Description |
8
+ |------|-------------|
9
+ | Table Triggers | Respond to database events (insert, update, delete) |
10
+ | Workspace Triggers | Respond to branch events (merge, set live, create) |
11
+ | Agent Triggers | Extend agent functionality with custom hooks |
12
+ | MCP Server Triggers | Extend MCP server functionality |
13
+ | Realtime Triggers | Respond to realtime channel events |
14
+
15
+ ---
16
+
17
+ # Table Triggers
18
+
19
+ Execute code when database records are created, updated, or deleted.
20
+
21
+ ## Endpoints
22
+
23
+ | Method | Endpoint | Description |
24
+ |--------|----------|-------------|
25
+ | GET | `/workspace/{workspace_id}/table/trigger` | List triggers |
26
+ | GET | `/workspace/{workspace_id}/table/trigger/{trigger_id}` | Get trigger |
27
+ | POST | `/workspace/{workspace_id}/table/trigger` | Create trigger |
28
+ | PUT | `/workspace/{workspace_id}/table/trigger/{trigger_id}` | Update trigger |
29
+ | DELETE | `/workspace/{workspace_id}/table/trigger/{trigger_id}` | Delete trigger |
30
+ | PUT | `/workspace/{workspace_id}/table/trigger/{trigger_id}/security` | Update security |
31
+
32
+ ## XanoScript Syntax
33
+
34
+ ```xanoscript
35
+ table_trigger foo {
36
+ table = "user"
37
+ input {
38
+ json new
39
+ json old
40
+ enum action {
41
+ values = ["insert", "update", "delete", "truncate"]
42
+ }
43
+ text datasource
44
+ }
45
+
46
+ stack {
47
+ var $x1 {
48
+ value = $input.score + 1
49
+ }
50
+ }
51
+
52
+ actions = {insert: true, update: true}
53
+ }
54
+ ```
55
+
56
+ ### Fields
57
+
58
+ | Field | Type | Description |
59
+ |-------|------|-------------|
60
+ | `table` | text | Name of the table to watch |
61
+ | `actions` | object | Which events trigger execution |
62
+
63
+ ### Available Actions
64
+
65
+ | Action | Description |
66
+ |--------|-------------|
67
+ | `insert` | New record created |
68
+ | `update` | Record modified |
69
+ | `delete` | Record deleted |
70
+ | `truncate` | Table truncated |
71
+
72
+ ### Input Variables
73
+
74
+ The trigger receives these inputs automatically:
75
+
76
+ | Variable | Description |
77
+ |----------|-------------|
78
+ | `$input.new` | New record data (insert/update) |
79
+ | `$input.old` | Previous record data (update/delete) |
80
+ | `$input.action` | The action type |
81
+ | `$input.datasource` | The datasource that triggered the event |
82
+
83
+ ### Example: Audit Log Trigger
84
+
85
+ ```xanoscript
86
+ table_trigger user_audit {
87
+ table = "user"
88
+ input {
89
+ json new
90
+ json old
91
+ enum action { values = ["insert", "update", "delete", "truncate"] }
92
+ text datasource
93
+ }
94
+
95
+ stack {
96
+ db.insert audit_log {
97
+ data = {
98
+ table: "user",
99
+ action: $input.action,
100
+ old_data: $input.old,
101
+ new_data: $input.new,
102
+ timestamp: now()
103
+ }
104
+ }
105
+ }
106
+
107
+ actions = {insert: true, update: true, delete: true}
108
+ }
109
+ ```
110
+
111
+ ---
112
+
113
+ # Workspace Triggers
114
+
115
+ Execute code when workspace branch events occur.
116
+
117
+ ## Endpoints
118
+
119
+ | Method | Endpoint | Description |
120
+ |--------|----------|-------------|
121
+ | GET | `/workspace/{workspace_id}/trigger` | List triggers |
122
+ | GET | `/workspace/{workspace_id}/trigger/{trigger_id}` | Get trigger |
123
+ | POST | `/workspace/{workspace_id}/trigger` | Create trigger |
124
+ | PUT | `/workspace/{workspace_id}/trigger/{trigger_id}` | Update trigger |
125
+ | DELETE | `/workspace/{workspace_id}/trigger/{trigger_id}` | Delete trigger |
126
+
127
+ ## XanoScript Syntax
128
+
129
+ ```xanoscript
130
+ workspace_trigger foo {
131
+ input {
132
+ object to_branch? {
133
+ schema {
134
+ int id?
135
+ text label? filters=trim
136
+ }
137
+ }
138
+ object from_branch? {
139
+ schema {
140
+ int id?
141
+ text label? filters=trim
142
+ }
143
+ }
144
+ enum action {
145
+ values = ["branch_live", "branch_merge", "branch_new"]
146
+ }
147
+ }
148
+
149
+ stack {
150
+ // Your logic here
151
+ }
152
+
153
+ actions = {branch_live: true, branch_merge: true, branch_new: true}
154
+ }
155
+ ```
156
+
157
+ ### Available Actions
158
+
159
+ | Action | Description |
160
+ |--------|-------------|
161
+ | `branch_live` | Branch set as live |
162
+ | `branch_merge` | Branches merged |
163
+ | `branch_new` | New branch created |
164
+
165
+ ---
166
+
167
+ # Agent Triggers
168
+
169
+ Extend agent functionality with custom hooks.
170
+
171
+ ## Endpoints
172
+
173
+ | Method | Endpoint | Description |
174
+ |--------|----------|-------------|
175
+ | GET | `/workspace/{workspace_id}/agent/trigger` | List triggers |
176
+ | GET | `/workspace/{workspace_id}/agent/trigger/{trigger_id}` | Get trigger |
177
+ | POST | `/workspace/{workspace_id}/agent/trigger` | Create trigger |
178
+ | PUT | `/workspace/{workspace_id}/agent/trigger/{trigger_id}` | Update trigger |
179
+ | DELETE | `/workspace/{workspace_id}/agent/trigger/{trigger_id}` | Delete trigger |
180
+
181
+ ## XanoScript Syntax
182
+
183
+ ```xanoscript
184
+ agent_trigger foo {
185
+ agent = "my_agent"
186
+ input {
187
+ object toolset {
188
+ schema {
189
+ int id
190
+ text name
191
+ text instructions
192
+ }
193
+ }
194
+ object[] tools {
195
+ schema {
196
+ int id
197
+ text name
198
+ text instructions
199
+ }
200
+ }
201
+ }
202
+
203
+ stack {
204
+ var $x1 { value = 123 }
205
+ }
206
+
207
+ actions = {connection: true}
208
+ }
209
+ ```
210
+
211
+ ---
212
+
213
+ # MCP Server Triggers
214
+
215
+ Extend MCP server functionality.
216
+
217
+ ## Endpoints
218
+
219
+ | Method | Endpoint | Description |
220
+ |--------|----------|-------------|
221
+ | GET | `/workspace/{workspace_id}/mcp_server/trigger` | List triggers |
222
+ | GET | `/workspace/{workspace_id}/mcp_server/trigger/{trigger_id}` | Get trigger |
223
+ | POST | `/workspace/{workspace_id}/mcp_server/trigger` | Create trigger |
224
+ | PUT | `/workspace/{workspace_id}/mcp_server/trigger/{trigger_id}` | Update trigger |
225
+ | DELETE | `/workspace/{workspace_id}/mcp_server/trigger/{trigger_id}` | Delete trigger |
226
+
227
+ ## XanoScript Syntax
228
+
229
+ ```xanoscript
230
+ mcp_server_trigger foo {
231
+ mcp_server = "my_server"
232
+ input {
233
+ object toolset {
234
+ schema {
235
+ int id
236
+ text name
237
+ text instructions
238
+ }
239
+ }
240
+ object[] tools {
241
+ schema {
242
+ int id
243
+ text name
244
+ text instructions
245
+ }
246
+ }
247
+ }
248
+
249
+ stack {
250
+ var $x1 { value = 123 }
251
+ }
252
+
253
+ actions = {connection: true}
254
+ }
255
+ ```
256
+
257
+ ---
258
+
259
+ # Realtime Triggers
260
+
261
+ Execute code when realtime channel events occur.
262
+
263
+ ## Endpoints
264
+
265
+ | Method | Endpoint | Description |
266
+ |--------|----------|-------------|
267
+ | GET | `/workspace/{workspace_id}/realtime/channel/trigger` | List triggers |
268
+ | GET | `/workspace/{workspace_id}/realtime/channel/trigger/{trigger_id}` | Get trigger |
269
+ | POST | `/workspace/{workspace_id}/realtime/channel/trigger` | Create trigger |
270
+ | PUT | `/workspace/{workspace_id}/realtime/channel/trigger/{trigger_id}` | Update trigger |
271
+ | DELETE | `/workspace/{workspace_id}/realtime/channel/trigger/{trigger_id}` | Delete trigger |
272
+
273
+ ## XanoScript Syntax
274
+
275
+ ```xanoscript
276
+ realtime_trigger foo {
277
+ channel = "my_channel"
278
+ input {
279
+ enum action { values = ["message", "join"] }
280
+ text channel
281
+ object client {
282
+ schema {
283
+ json extras
284
+ object permissions {
285
+ schema {
286
+ int dbo_id
287
+ text row_id
288
+ }
289
+ }
290
+ }
291
+ }
292
+ object options {
293
+ schema {
294
+ bool authenticated
295
+ text channel
296
+ }
297
+ }
298
+ json payload
299
+ }
300
+
301
+ stack {
302
+ var $x1 { value = 123 }
303
+ }
304
+
305
+ actions = {connection: true}
306
+ }
307
+ ```
308
+
309
+ ### Available Actions
310
+
311
+ | Action | Description |
312
+ |--------|-------------|
313
+ | `connection` | Client connects |
314
+ | `message` | Message received |
315
+ | `join` | Client joins channel |
316
+
317
+ ---
318
+
319
+ # Workflow Tests
320
+
321
+ Automated tests for your workflows.
322
+
323
+ ## Endpoints
324
+
325
+ | Method | Endpoint | Description |
326
+ |--------|----------|-------------|
327
+ | GET | `/workspace/{workspace_id}/workflow_test` | List tests |
328
+ | GET | `/workspace/{workspace_id}/workflow_test/{workflow_test_id}` | Get test |
329
+ | POST | `/workspace/{workspace_id}/workflow_test` | Create test |
330
+ | PUT | `/workspace/{workspace_id}/workflow_test/{workflow_test_id}` | Update test |
331
+ | DELETE | `/workspace/{workspace_id}/workflow_test/{workflow_test_id}` | Delete test |
332
+ | PUT | `/workspace/{workspace_id}/workflow_test/{workflow_test_id}/security` | Update security |
333
+
334
+ ## XanoScript Syntax
335
+
336
+ ```xanoscript
337
+ workflow_test foo {
338
+ stack {
339
+ var $x1 {
340
+ value = 1 + 2 + 3
341
+ }
342
+ }
343
+ }
344
+ ```
@@ -0,0 +1,246 @@
1
+ # Workspace API
2
+
3
+ Workspaces are the primary container for all Xano resources including tables, APIs, functions, and more.
4
+
5
+ ## Endpoints Overview
6
+
7
+ | Method | Endpoint | Description |
8
+ |--------|----------|-------------|
9
+ | GET | `/workspace` | List all workspaces |
10
+ | GET | `/workspace/{workspace_id}` | Get workspace details |
11
+ | POST | `/workspace/{workspace_id}/export` | Export workspace archive |
12
+ | POST | `/workspace/{workspace_id}/export-schema` | Export schema only |
13
+ | POST | `/workspace/{workspace_id}/import` | Import workspace archive |
14
+ | POST | `/workspace/{workspace_id}/import-schema` | Import schema to new branch |
15
+ | GET | `/workspace/{workspace_id}/openapi` | Get OpenAPI specification |
16
+ | GET | `/workspace/{workspace_id}/context` | Get AI-consumable context |
17
+ | GET | `/workspace/{workspace_id}/multidoc` | Export as XanoScript multidoc |
18
+ | POST | `/workspace/{workspace_id}/convert/fromXS` | Convert XanoScript to JSON |
19
+ | POST | `/workspace/{workspace_id}/convert/toXS` | Convert JSON to XanoScript |
20
+
21
+ ---
22
+
23
+ ## List Workspaces
24
+
25
+ ```
26
+ GET /workspace
27
+ ```
28
+
29
+ Returns array of workspace objects the authenticated user can access.
30
+
31
+ ---
32
+
33
+ ## Get Workspace
34
+
35
+ ```
36
+ GET /workspace/{workspace_id}
37
+ ```
38
+
39
+ **Path Parameters:**
40
+ - `workspace_id` (int, required): Workspace ID
41
+
42
+ **Response Fields:**
43
+ | Field | Type | Description |
44
+ |-------|------|-------------|
45
+ | `id` | int | Workspace unique identifier |
46
+ | `name` | text | Workspace name |
47
+ | `branch` | text | Current live branch label |
48
+ | `swagger` | bool | OpenAPI documentation enabled |
49
+ | `documentation.link` | text | Link to OpenAPI spec |
50
+
51
+ ---
52
+
53
+ ## Export Workspace
54
+
55
+ ```
56
+ POST /workspace/{workspace_id}/export
57
+ ```
58
+
59
+ **Parameters:**
60
+ | Parameter | Type | Default | Description |
61
+ |-----------|------|---------|-------------|
62
+ | `branch` | text | "" | Branch label (empty = live) |
63
+ | `password` | text | "" | Optional encryption password |
64
+
65
+ Returns downloadable archive file.
66
+
67
+ ---
68
+
69
+ ## Export Schema Only
70
+
71
+ ```
72
+ POST /workspace/{workspace_id}/export-schema
73
+ ```
74
+
75
+ Same parameters as export. Returns schema and branch configuration only.
76
+
77
+ ---
78
+
79
+ ## Import Workspace
80
+
81
+ ```
82
+ POST /workspace/{workspace_id}/import
83
+ ```
84
+
85
+ **Parameters:**
86
+ | Parameter | Type | Required | Description |
87
+ |-----------|------|----------|-------------|
88
+ | `file` | file | Yes | Export archive file |
89
+ | `password` | text | No | Decryption password |
90
+
91
+ Replaces all content in target workspace.
92
+
93
+ ---
94
+
95
+ ## Import Schema
96
+
97
+ ```
98
+ POST /workspace/{workspace_id}/import-schema
99
+ ```
100
+
101
+ **Parameters:**
102
+ | Parameter | Type | Required | Description |
103
+ |-----------|------|----------|-------------|
104
+ | `file` | file | Yes | Schema export file |
105
+ | `newbranch` | text | Yes | Name for new branch |
106
+ | `setlive` | bool | No | Set new branch as live |
107
+ | `password` | text | No | Decryption password |
108
+
109
+ ---
110
+
111
+ ## Get OpenAPI Spec
112
+
113
+ ```
114
+ GET /workspace/{workspace_id}/openapi
115
+ ```
116
+
117
+ **Parameters:**
118
+ - `branch` (text): Branch label (empty = live)
119
+
120
+ Returns OpenAPI specification as JSON.
121
+
122
+ ---
123
+
124
+ ## Get Workspace Context
125
+
126
+ ```
127
+ GET /workspace/{workspace_id}/context
128
+ ```
129
+
130
+ Generates AI/LLM-consumable workspace context.
131
+
132
+ **Parameters:**
133
+ | Parameter | Type | Default | Description |
134
+ |-----------|------|---------|-------------|
135
+ | `branch` | text | "" | Branch label |
136
+ | `format` | enum | "yaml" | Output: "json" or "yaml" |
137
+ | `include` | text | "" | Comma-separated resource list |
138
+
139
+ ---
140
+
141
+ ## Export as XanoScript Multidoc
142
+
143
+ ```
144
+ GET /workspace/{workspace_id}/multidoc
145
+ ```
146
+
147
+ **Parameters:**
148
+ | Parameter | Type | Default | Description |
149
+ |-----------|------|---------|-------------|
150
+ | `branch` | text | "" | Branch label |
151
+ | `env` | bool | false | Include environment variables |
152
+ | `records` | bool | false | Include database records |
153
+
154
+ Returns XanoScript multidoc (`text/x-xanoscript`).
155
+
156
+ ---
157
+
158
+ ## Convert XanoScript to JSON
159
+
160
+ ```
161
+ POST /workspace/{workspace_id}/convert/fromXS
162
+ ```
163
+
164
+ **Content-Type:** `text/x-xanoscript`
165
+
166
+ Body: XanoScript code to convert.
167
+
168
+ ---
169
+
170
+ ## Convert JSON to XanoScript
171
+
172
+ ```
173
+ POST /workspace/{workspace_id}/convert/toXS
174
+ ```
175
+
176
+ **Content-Type:** `application/json`
177
+
178
+ **Body:**
179
+ ```json
180
+ {
181
+ "kind": "object_type",
182
+ "data": "json_data"
183
+ }
184
+ ```
185
+
186
+ ---
187
+
188
+ # Branches
189
+
190
+ ## List Branches
191
+
192
+ ```
193
+ GET /workspace/{workspace_id}/branch
194
+ ```
195
+
196
+ **Response Example:**
197
+ ```json
198
+ [
199
+ {"created_at": "2024-01-01T00:00:00Z", "label": "v1", "backup": false, "live": true},
200
+ {"created_at": "2024-01-15T00:00:00Z", "label": "dev", "backup": false}
201
+ ]
202
+ ```
203
+
204
+ ## Delete Branch
205
+
206
+ ```
207
+ DELETE /workspace/{workspace_id}/branch/{branch_label}
208
+ ```
209
+
210
+ Cannot delete `v1` (root) or currently live branch.
211
+
212
+ ---
213
+
214
+ # Datasources
215
+
216
+ External database connections.
217
+
218
+ ## List Datasources
219
+
220
+ ```
221
+ GET /workspace/{workspace_id}/datasource
222
+ ```
223
+
224
+ ## Create Datasource
225
+
226
+ ```
227
+ POST /workspace/{workspace_id}/datasource
228
+ ```
229
+
230
+ **Parameters:**
231
+ | Parameter | Type | Required | Default | Description |
232
+ |-----------|------|----------|---------|-------------|
233
+ | `label` | text | Yes | - | Unique label |
234
+ | `color` | text | No | "#ebc346" | Display color (hex) |
235
+
236
+ ## Update Datasource
237
+
238
+ ```
239
+ PUT /workspace/{workspace_id}/datasource/{label}
240
+ ```
241
+
242
+ ## Delete Datasource
243
+
244
+ ```
245
+ DELETE /workspace/{workspace_id}/datasource/{label}
246
+ ```
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};