@xano/developer-mcp 1.0.25 → 1.0.27

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 (91) hide show
  1. package/README.md +50 -0
  2. package/dist/cli_docs/format.d.ts +12 -0
  3. package/dist/cli_docs/format.js +98 -0
  4. package/dist/{api_docs → cli_docs}/index.d.ts +6 -11
  5. package/dist/cli_docs/index.js +86 -0
  6. package/dist/cli_docs/topics/function.js +114 -0
  7. package/dist/cli_docs/topics/integration.d.ts +2 -0
  8. package/dist/cli_docs/topics/integration.js +157 -0
  9. package/dist/{api_docs/topics/agent.d.ts → cli_docs/topics/profile.d.ts} +1 -1
  10. package/dist/cli_docs/topics/profile.js +153 -0
  11. package/dist/{api_docs/topics/api.d.ts → cli_docs/topics/run.d.ts} +1 -1
  12. package/dist/cli_docs/topics/run.js +248 -0
  13. package/dist/cli_docs/topics/start.js +111 -0
  14. package/dist/cli_docs/topics/static_host.d.ts +2 -0
  15. package/dist/cli_docs/topics/static_host.js +77 -0
  16. package/dist/cli_docs/topics/workspace.js +119 -0
  17. package/dist/cli_docs/types.d.ts +44 -0
  18. package/dist/cli_docs/types.js +4 -0
  19. package/dist/index.js +42 -0
  20. package/dist/xanoscript_docs/README.md +78 -64
  21. package/dist/xanoscript_docs/apis.md +81 -27
  22. package/dist/xanoscript_docs/branch.md +13 -13
  23. package/dist/xanoscript_docs/database.md +57 -17
  24. package/dist/xanoscript_docs/functions.md +43 -71
  25. package/dist/xanoscript_docs/performance.md +14 -23
  26. package/dist/xanoscript_docs/tables.md +47 -1
  27. package/dist/xanoscript_docs/tools.md +9 -7
  28. package/dist/xanoscript_docs/types.md +12 -10
  29. package/package.json +1 -1
  30. package/dist/api_docs/format.d.ts +0 -5
  31. package/dist/api_docs/format.js +0 -171
  32. package/dist/api_docs/index.js +0 -111
  33. package/dist/api_docs/topics/agent.js +0 -142
  34. package/dist/api_docs/topics/api.js +0 -176
  35. package/dist/api_docs/topics/apigroup.d.ts +0 -2
  36. package/dist/api_docs/topics/apigroup.js +0 -124
  37. package/dist/api_docs/topics/authentication.d.ts +0 -2
  38. package/dist/api_docs/topics/authentication.js +0 -61
  39. package/dist/api_docs/topics/branch.d.ts +0 -2
  40. package/dist/api_docs/topics/branch.js +0 -73
  41. package/dist/api_docs/topics/file.d.ts +0 -2
  42. package/dist/api_docs/topics/file.js +0 -70
  43. package/dist/api_docs/topics/function.js +0 -164
  44. package/dist/api_docs/topics/history.d.ts +0 -2
  45. package/dist/api_docs/topics/history.js +0 -149
  46. package/dist/api_docs/topics/mcp_server.d.ts +0 -2
  47. package/dist/api_docs/topics/mcp_server.js +0 -139
  48. package/dist/api_docs/topics/middleware.d.ts +0 -2
  49. package/dist/api_docs/topics/middleware.js +0 -156
  50. package/dist/api_docs/topics/realtime.d.ts +0 -2
  51. package/dist/api_docs/topics/realtime.js +0 -112
  52. package/dist/api_docs/topics/start.js +0 -107
  53. package/dist/api_docs/topics/table.d.ts +0 -2
  54. package/dist/api_docs/topics/table.js +0 -195
  55. package/dist/api_docs/topics/task.d.ts +0 -2
  56. package/dist/api_docs/topics/task.js +0 -165
  57. package/dist/api_docs/topics/tool.d.ts +0 -2
  58. package/dist/api_docs/topics/tool.js +0 -150
  59. package/dist/api_docs/topics/workflows.d.ts +0 -2
  60. package/dist/api_docs/topics/workflows.js +0 -131
  61. package/dist/api_docs/topics/workspace.js +0 -153
  62. package/dist/api_docs/types.d.ts +0 -79
  63. package/dist/api_docs/types.js +0 -4
  64. package/dist/templates/init-workspace.d.ts +0 -10
  65. package/dist/templates/init-workspace.js +0 -278
  66. package/dist/templates/xanoscript-index.d.ts +0 -11
  67. package/dist/templates/xanoscript-index.js +0 -72
  68. package/dist/xanoscript_docs/ephemeral.md +0 -330
  69. package/dist/xanoscript_docs_auto/README.md +0 -119
  70. package/dist/xanoscript_docs_auto/agents.md +0 -446
  71. package/dist/xanoscript_docs_auto/apis.md +0 -517
  72. package/dist/xanoscript_docs_auto/control-flow.md +0 -543
  73. package/dist/xanoscript_docs_auto/database.md +0 -551
  74. package/dist/xanoscript_docs_auto/debugging.md +0 -527
  75. package/dist/xanoscript_docs_auto/filters.md +0 -464
  76. package/dist/xanoscript_docs_auto/functions.md +0 -431
  77. package/dist/xanoscript_docs_auto/integrations.md +0 -657
  78. package/dist/xanoscript_docs_auto/mcp-servers.md +0 -408
  79. package/dist/xanoscript_docs_auto/operators.md +0 -368
  80. package/dist/xanoscript_docs_auto/syntax.md +0 -287
  81. package/dist/xanoscript_docs_auto/tables.md +0 -447
  82. package/dist/xanoscript_docs_auto/tasks.md +0 -479
  83. package/dist/xanoscript_docs_auto/testing.md +0 -574
  84. package/dist/xanoscript_docs_auto/tools.md +0 -485
  85. package/dist/xanoscript_docs_auto/triggers.md +0 -595
  86. package/dist/xanoscript_docs_auto/types.md +0 -323
  87. package/dist/xanoscript_docs_auto/variables.md +0 -462
  88. package/dist/xanoscript_docs_auto/version.json +0 -5
  89. /package/dist/{api_docs → cli_docs}/topics/function.d.ts +0 -0
  90. /package/dist/{api_docs → cli_docs}/topics/start.d.ts +0 -0
  91. /package/dist/{api_docs → cli_docs}/topics/workspace.d.ts +0 -0
@@ -1,330 +0,0 @@
1
- ---
2
- applyTo: "ephemeral/**/*.xs"
3
- ---
4
-
5
- # Ephemeral Environments
6
-
7
- Temporary Xano workspaces for testing and one-off operations.
8
-
9
- ## Quick Reference
10
-
11
- | Type | Purpose | Lifecycle |
12
- |------|---------|-----------|
13
- | **Service** | Temporary workspace with DB/APIs | Runs until shut down |
14
- | **Job** | One-time operation | Executes once, then shuts down |
15
-
16
- ### Directory Structure
17
- ```
18
- ephemeral/
19
- ├── my-service/
20
- │ ├── workspace.xs
21
- │ ├── tables/
22
- │ ├── functions/
23
- │ └── apis/
24
- └── my-job/
25
- ├── workspace.xs
26
- ├── tables/
27
- └── functions/
28
- ```
29
-
30
- ---
31
-
32
- ## Ephemeral Service
33
-
34
- A temporary workspace with database, functions, and API endpoints.
35
-
36
- ### workspace.xs
37
- ```xs
38
- workspace my_service {
39
- env = {
40
- api_key: "test-key"
41
- debug: "true"
42
- }
43
- }
44
- ```
45
-
46
- ### Table with Seed Data
47
- ```xs
48
- table event {
49
- auth = false
50
- schema {
51
- int id
52
- timestamp created_at?=now
53
- text name filters=trim
54
- }
55
- index = [
56
- {type: "primary", field: [{name: "id"}]}
57
- ]
58
- items = [
59
- {"id": 1, "name": "Event 1"}
60
- {"id": 2, "name": "Event 2"}
61
- ]
62
- }
63
- ```
64
-
65
- ### API Group
66
- ```xs
67
- api_group events {
68
- canonical = "events-api"
69
- }
70
- ```
71
-
72
- ### Endpoints
73
- ```xs
74
- query list verb=GET {
75
- api_group = "events"
76
- stack {
77
- db.query event {
78
- return = { type: "list" }
79
- } as $events
80
- }
81
- response = $events
82
- }
83
-
84
- query add verb=POST {
85
- api_group = "events"
86
- input { text name filters=trim }
87
- stack {
88
- db.add event {
89
- data = { name: $input.name }
90
- } as $event
91
- }
92
- response = $event
93
- }
94
- ```
95
-
96
- ---
97
-
98
- ## Ephemeral Job
99
-
100
- One-time operation with setup and cleanup hooks.
101
-
102
- ### Reserved Functions
103
- | Function | Purpose | Required |
104
- |----------|---------|----------|
105
- | `$main` | Primary logic | Yes |
106
- | `$pre` | Setup/validation | No |
107
- | `$post` | Cleanup/notification | No |
108
-
109
- ### Execution Order
110
- 1. `$pre` (if defined)
111
- 2. `$main`
112
- 3. `$post` (if defined)
113
- 4. Environment shuts down
114
-
115
- ### $main Function
116
- ```xs
117
- function "$main" {
118
- input {
119
- json args // Runtime arguments
120
- json pre // Result from $pre
121
- }
122
- stack {
123
- db.query authors {
124
- return = { type: "count" }
125
- } as $count
126
-
127
- precondition ($count > 0) {
128
- error = "No authors found"
129
- }
130
-
131
- db.add authors {
132
- data = { name: "New Author" }
133
- }
134
- }
135
- response = { processed: true }
136
- }
137
- ```
138
-
139
- ### $pre Function (optional)
140
- ```xs
141
- function "$pre" {
142
- input { json args }
143
- stack {
144
- // Validation or setup
145
- precondition ($input.args.required_field != null) {
146
- error = "Missing required field"
147
- }
148
- }
149
- response = { validated: true }
150
- }
151
- ```
152
-
153
- ### $post Function (optional)
154
- ```xs
155
- function "$post" {
156
- input {
157
- json args
158
- json pre
159
- json main
160
- }
161
- stack {
162
- // Send notification or cleanup
163
- api.request {
164
- url = $env.WEBHOOK_URL
165
- method = "POST"
166
- params = {
167
- status: "complete",
168
- result: $input.main
169
- }
170
- }
171
- }
172
- response = null
173
- }
174
- ```
175
-
176
- ---
177
-
178
- ## Complete Service Example
179
-
180
- ```
181
- ephemeral/event-tracker/
182
- ├── workspace.xs
183
- ├── tables/
184
- │ └── event.xs
185
- └── apis/
186
- ├── api_group.xs
187
- ├── list.xs
188
- ├── add.xs
189
- └── clear.xs
190
- ```
191
-
192
- ### workspace.xs
193
- ```xs
194
- workspace event_tracker {
195
- env = { api_key: "test" }
196
- }
197
- ```
198
-
199
- ### tables/event.xs
200
- ```xs
201
- table event {
202
- auth = false
203
- schema {
204
- int id
205
- timestamp created_at?=now
206
- text name
207
- }
208
- index = [
209
- {type: "primary", field: [{name: "id"}]}
210
- ]
211
- items = []
212
- }
213
- ```
214
-
215
- ### apis/list.xs
216
- ```xs
217
- query list verb=GET {
218
- api_group = "events"
219
- stack {
220
- db.query event {
221
- sort = { created_at: "desc" }
222
- return = { type: "list" }
223
- } as $events
224
- }
225
- response = $events
226
- }
227
- ```
228
-
229
- ---
230
-
231
- ## Complete Job Example
232
-
233
- ```
234
- ephemeral/data-migration/
235
- ├── workspace.xs
236
- ├── tables/
237
- │ └── users.xs
238
- └── functions/
239
- ├── $main.xs
240
- └── $post.xs
241
- ```
242
-
243
- ### workspace.xs
244
- ```xs
245
- workspace data_migration {
246
- env = { webhook_url: "https://webhook.site/xxx" }
247
- }
248
- ```
249
-
250
- ### tables/users.xs
251
- ```xs
252
- table users {
253
- auth = false
254
- schema {
255
- int id
256
- text name
257
- text email
258
- timestamp migrated_at?
259
- }
260
- index = [
261
- {type: "primary", field: [{name: "id"}]}
262
- ]
263
- items = [
264
- {"id": 1, "name": "Alice", "email": "alice@example.com"}
265
- {"id": 2, "name": "Bob", "email": "bob@example.com"}
266
- ]
267
- }
268
- ```
269
-
270
- ### functions/$main.xs
271
- ```xs
272
- function "$main" {
273
- input { json args, json pre }
274
- stack {
275
- db.query users {
276
- where = $db.users.migrated_at == null
277
- } as $pending
278
-
279
- foreach ($pending) {
280
- each as $user {
281
- db.edit users {
282
- field_name = "id"
283
- field_value = $user.id
284
- data = { migrated_at: now }
285
- }
286
- }
287
- }
288
- }
289
- response = { migrated: $pending|count }
290
- }
291
- ```
292
-
293
- ### functions/$post.xs
294
- ```xs
295
- function "$post" {
296
- input { json args, json pre, json main }
297
- stack {
298
- api.request {
299
- url = $env.webhook_url
300
- method = "POST"
301
- params = { result: $input.main }
302
- }
303
- }
304
- response = null
305
- }
306
- ```
307
-
308
- ---
309
-
310
- ## Deploying
311
-
312
- ### Deploy Service
313
- ```
314
- publish_ephemeral_service name="my-api" directory="ephemeral/my-service" mode="service"
315
- ```
316
-
317
- ### Run Job
318
- ```
319
- publish_ephemeral_service name="migration" directory="ephemeral/my-job" mode="job"
320
- ```
321
-
322
- ---
323
-
324
- ## Best Practices
325
-
326
- 1. **Keep isolated** - Self-contained with own tables/functions
327
- 2. **Seed test data** - Use `items` in table definitions
328
- 3. **Handle cleanup** - Use `$post` for notifications/cleanup
329
- 4. **Validate in $pre** - Check preconditions before main logic
330
- 5. **Name clearly** - Indicate purpose: `auth-test`, `data-migration`
@@ -1,119 +0,0 @@
1
- # XanoScript Complete Reference
2
-
3
- XanoScript is a declarative, statically-typed scripting language for [Xano](https://xano.com). It enables developers to build API endpoints, functions, scheduled tasks, database operations, and AI agents with structured, readable syntax.
4
-
5
- ## Quick Reference
6
-
7
- ### Top-Level Object Types
8
-
9
- | Type | File Location | Purpose |
10
- |------|---------------|---------|
11
- | `query` | `apis/<group>/*.xs` | HTTP API endpoints with verbs, input, processing, response |
12
- | `function` | `functions/**/*.xs` | Reusable logic blocks with optional testing |
13
- | `task` | `tasks/*.xs` | Scheduled operations with cron-like triggers |
14
- | `table` | `tables/*.xs` | Database schema definitions |
15
- | `table_trigger` | `triggers/**/*.xs` | Trigger handlers for database events |
16
- | `agent` | `agents/**/*.xs` | AI agent definitions |
17
- | `tool` | `tools/**/*.xs` | Tool definitions for AI agents |
18
- | `mcp_server` | `mcp_servers/**/*.xs` | Model Context Protocol server definitions |
19
- | `middleware` | `middleware/**/*.xs` | Request/response interceptors |
20
- | `addon` | `addons/*.xs` | Subqueries for related data |
21
- | `branch` | `branch.xs` | Branch-level configuration |
22
- | `workspace` | `workspace.xs` | Workspace-level settings |
23
- | `realtime_channel` | Configuration | Real-time channel definitions |
24
- | `api_group` | `apis/<group>/` | Collections of related API endpoints |
25
-
26
- **Important:** Each `.xs` file must contain exactly one definition.
27
-
28
- ### Block Structure
29
-
30
- ```xs
31
- <construct> "<name>" {
32
- input { ... } // Parameters (optional)
33
- stack { ... } // Logic
34
- response = $var // Output
35
- }
36
- ```
37
-
38
- ### Variable Access
39
-
40
- ```xs
41
- $input.field // Input parameters
42
- $var.name // Stack variables (in some contexts)
43
- $auth.id // Authenticated user ID
44
- $env.MY_VAR // Environment variable
45
- $db.table.field // Database field reference (in queries)
46
- $this // Current item in loops/maps
47
- $error // Error information (in catch blocks)
48
- now // Current timestamp
49
- ```
50
-
51
- ### Language Blocks (Clauses)
52
-
53
- | Block | Purpose |
54
- |-------|---------|
55
- | `stack` | Container for sequential operations |
56
- | `input` | Define parameters with types and validation |
57
- | `schema` | Database table schema |
58
- | `response` | Specify output data |
59
- | `schedule` | Execution times for tasks |
60
- | `security` | Authentication and permissions |
61
- | `auth` | Authentication configuration |
62
- | `cache` | Caching configuration |
63
- | `history` | History tracking |
64
- | `index` | Database index definitions |
65
- | `test` | Test definitions |
66
- | `view` | View definitions |
67
- | `middleware` | Middleware configuration |
68
-
69
- ## Workspace Structure
70
-
71
- ```
72
- project/
73
- ├── workspace.xs // Workspace configuration
74
- ├── branch.xs // Branch configuration
75
- ├── tables/ // Database table schemas
76
- ├── functions/ // Reusable functions (supports subfolders)
77
- ├── apis/
78
- │ └── <api-group>/ // API endpoints grouped by domain
79
- ├── tasks/ // Scheduled jobs
80
- ├── triggers/ // Event-driven handlers
81
- ├── agents/ // AI agents
82
- ├── tools/ // AI tools
83
- ├── mcp_servers/ // MCP server definitions
84
- ├── middleware/ // Request/response interceptors
85
- ├── addons/ // Query addons
86
- ├── static/ // Frontend files
87
- └── run/ // Job and service configurations
88
- ```
89
-
90
- ## Comments
91
-
92
- ```xs
93
- // Single-line comment
94
- /* Multi-line comment */
95
- var $total { value = 0 } // Inline comment
96
- ```
97
-
98
- ## Documentation Topics
99
-
100
- | Topic | Description |
101
- |-------|-------------|
102
- | `syntax` | Expressions, operators, filters |
103
- | `types` | Data types and validation |
104
- | `operators` | Comparison, logical, math operators |
105
- | `filters` | Pipe filters for transformations |
106
- | `control-flow` | Conditionals, loops, error handling |
107
- | `functions` | Function definitions and calls |
108
- | `database` | All db.* operations |
109
- | `apis` | HTTP endpoint definitions |
110
- | `tables` | Database schema definitions |
111
- | `tasks` | Scheduled jobs |
112
- | `triggers` | Event-driven handlers |
113
- | `agents` | AI agent configuration |
114
- | `tools` | AI tools for agents |
115
- | `mcp-servers` | MCP server definitions |
116
- | `integrations` | Cloud storage, Redis, external APIs |
117
- | `security-functions` | Encryption, hashing, auth tokens |
118
- | `testing` | Unit tests and assertions |
119
- | `variables` | System and built-in variables |