@xano/developer-mcp 1.0.35 → 1.0.36
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/README.md +17 -2
- package/dist/xanoscript.js +31 -1
- package/dist/xanoscript.test.js +6 -0
- package/dist/xanoscript_docs/README.md +42 -42
- package/dist/xanoscript_docs/addons.md +10 -0
- package/dist/xanoscript_docs/agents.md +15 -0
- package/dist/xanoscript_docs/apis.md +45 -24
- package/dist/xanoscript_docs/cheatsheet.md +252 -0
- package/dist/xanoscript_docs/database.md +23 -0
- package/dist/xanoscript_docs/docs_index.json +236 -0
- package/dist/xanoscript_docs/frontend.md +10 -0
- package/dist/xanoscript_docs/functions.md +4 -0
- package/dist/xanoscript_docs/integrations/cloud-storage.md +142 -0
- package/dist/xanoscript_docs/integrations/external-apis.md +201 -0
- package/dist/xanoscript_docs/integrations/redis.md +194 -0
- package/dist/xanoscript_docs/integrations/search.md +242 -0
- package/dist/xanoscript_docs/integrations/utilities.md +331 -0
- package/dist/xanoscript_docs/integrations.md +55 -901
- package/dist/xanoscript_docs/mcp-servers.md +10 -0
- package/dist/xanoscript_docs/performance.md +15 -0
- package/dist/xanoscript_docs/quickstart.md +22 -88
- package/dist/xanoscript_docs/run.md +10 -0
- package/dist/xanoscript_docs/security.md +26 -0
- package/dist/xanoscript_docs/streaming.md +10 -0
- package/dist/xanoscript_docs/syntax.md +56 -0
- package/dist/xanoscript_docs/tables.md +15 -0
- package/dist/xanoscript_docs/tasks.md +11 -0
- package/dist/xanoscript_docs/tools.md +15 -0
- package/dist/xanoscript_docs/triggers.md +57 -192
- package/dist/xanoscript_docs/types.md +4 -0
- package/package.json +1 -1
|
@@ -185,3 +185,13 @@ The MCP protocol handles:
|
|
|
185
185
|
2. **Comprehensive instructions** - Guide AI on server's overall purpose
|
|
186
186
|
3. **Logical tool grouping** - Group related tools in one server
|
|
187
187
|
4. **Keep focused** - One domain per server (support, analytics, etc.)
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Related Topics
|
|
192
|
+
|
|
193
|
+
| Topic | Description |
|
|
194
|
+
|-------|-------------|
|
|
195
|
+
| `tools` | AI tool definitions used by MCP servers |
|
|
196
|
+
| `agents` | AI agent configuration |
|
|
197
|
+
| `triggers` | MCP server triggers for connection events |
|
|
@@ -6,6 +6,10 @@ applyTo: "function/**/*.xs, api/**/*.xs"
|
|
|
6
6
|
|
|
7
7
|
Best practices for building fast, efficient XanoScript applications.
|
|
8
8
|
|
|
9
|
+
> **TL;DR:** Index frequently queried fields. Use `select` to fetch only needed columns. Use `db.add_bulk`/`db.edit_bulk` for batch operations. Cache with Redis. Paginate large result sets.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
9
13
|
## Quick Reference
|
|
10
14
|
|
|
11
15
|
| Area | Key Techniques |
|
|
@@ -387,3 +391,14 @@ conditional {
|
|
|
387
391
|
8. **Filter early** - In database, not application code
|
|
388
392
|
9. **Stream large responses** - Don't load into memory
|
|
389
393
|
10. **Monitor performance** - Log slow operations
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## Related Topics
|
|
398
|
+
|
|
399
|
+
| Topic | Description |
|
|
400
|
+
|-------|-------------|
|
|
401
|
+
| `database` | Query optimization |
|
|
402
|
+
| `integrations/redis` | Caching patterns |
|
|
403
|
+
| `streaming` | Large data handling |
|
|
404
|
+
| `debugging` | Performance monitoring |
|
|
@@ -6,6 +6,8 @@ applyTo: "**/*.xs"
|
|
|
6
6
|
|
|
7
7
|
Essential patterns for XanoScript development. Use this as a quick reference for frequently-used code patterns.
|
|
8
8
|
|
|
9
|
+
> **TL;DR:** Quick reference for common patterns. Key rules: use `text` not `string`, `elseif` not `else if`, `params` not `body` for api.request, parentheses around filters in expressions.
|
|
10
|
+
|
|
9
11
|
## Quick Reference
|
|
10
12
|
|
|
11
13
|
### Reserved Variable Names
|
|
@@ -180,67 +182,21 @@ input {
|
|
|
180
182
|
|
|
181
183
|
### Quick Filter Reference
|
|
182
184
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
**String Filters:**
|
|
186
|
-
```xs
|
|
187
|
-
$s|trim // Remove whitespace
|
|
188
|
-
$s|to_lower // Lowercase
|
|
189
|
-
$s|to_upper // Uppercase
|
|
190
|
-
$s|substr:1:3 // Substring from index 1, length 3
|
|
191
|
-
$s|split:"," // Split by delimiter → array
|
|
192
|
-
$s|replace:"old":"new" // Replace text
|
|
193
|
-
$s|contains:"text" // Check if contains → bool
|
|
194
|
-
$s|strlen // String length
|
|
195
|
-
```
|
|
185
|
+
The most common filters at a glance:
|
|
196
186
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
$arr|filter:$$.active // Filter elements
|
|
207
|
-
$arr|find:$$.id == 5 // Find first match
|
|
208
|
-
```
|
|
187
|
+
| Filter | Example | Result |
|
|
188
|
+
|--------|---------|--------|
|
|
189
|
+
| `trim` | `" hello "|trim` | `"hello"` |
|
|
190
|
+
| `lower` | `"HELLO"|lower` | `"hello"` |
|
|
191
|
+
| `first` | `[1,2,3]|first` | `1` |
|
|
192
|
+
| `count` | `[1,2,3]|count` | `3` |
|
|
193
|
+
| `to_int` | `"42"|to_int` | `42` |
|
|
194
|
+
| `json_encode` | `{a:1}|json_encode` | `"{\"a\":1}"` |
|
|
195
|
+
| `get` | `$obj|get:"key":"default"` | value or default |
|
|
209
196
|
|
|
210
|
-
**
|
|
211
|
-
```xs
|
|
212
|
-
$obj|get:"key" // Get property value
|
|
213
|
-
$obj|get:"key":"default" // With default if missing
|
|
214
|
-
$obj|set:"key":"value" // Set property
|
|
215
|
-
$obj|has:"key" // Check if key exists → bool
|
|
216
|
-
$obj|keys // Get all keys → array
|
|
217
|
-
$obj|values // Get all values → array
|
|
218
|
-
```
|
|
197
|
+
**Null handling:** `$val ?? "default"` or `$val|first_notnull:"default"`
|
|
219
198
|
|
|
220
|
-
**
|
|
221
|
-
```xs
|
|
222
|
-
$val|to_text // Convert to string
|
|
223
|
-
$val|to_int // Convert to integer
|
|
224
|
-
$val|to_decimal // Convert to decimal
|
|
225
|
-
$val|to_bool // Convert to boolean
|
|
226
|
-
$val|json_encode // Object → JSON string
|
|
227
|
-
$str|json_decode // JSON string → object
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
**Null Handling:**
|
|
231
|
-
```xs
|
|
232
|
-
$val|first_notnull:"default" // Default if null
|
|
233
|
-
$val|first_notempty:"default" // Default if empty
|
|
234
|
-
$val ?? "default" // Nullish coalescing (same as first_notnull)
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
**Encoding:**
|
|
238
|
-
```xs
|
|
239
|
-
$s|url_encode // URL encode
|
|
240
|
-
$s|url_decode // URL decode
|
|
241
|
-
$s|base64_encode // Base64 encode
|
|
242
|
-
$s|base64_decode // Base64 decode
|
|
243
|
-
```
|
|
199
|
+
> **Full reference:** See `xanoscript_docs({ topic: "syntax" })` for all 100+ filters organized by category (string, array, object, type, date, encoding).
|
|
244
200
|
|
|
245
201
|
---
|
|
246
202
|
|
|
@@ -264,37 +220,15 @@ precondition ($input.email|contains:"@") {
|
|
|
264
220
|
|
|
265
221
|
### 2. Database CRUD
|
|
266
222
|
|
|
267
|
-
|
|
223
|
+
| Operation | Use Case | Example |
|
|
224
|
+
|-----------|----------|---------|
|
|
225
|
+
| `db.get` | Single record by ID | `db.get "users" { field_name = "id" field_value = 1 } as $user` |
|
|
226
|
+
| `db.query` | Filtered list | `db.query "users" { where = $db.users.active == true } as $users` |
|
|
227
|
+
| `db.add` | Insert | `db.add "users" { data = { name: "John" } } as $new` |
|
|
228
|
+
| `db.edit` | Update | `db.edit "users" { field_name = "id" field_value = 1 data = { name: "Jane" } }` |
|
|
229
|
+
| `db.delete` | Delete | `db.delete "users" { field_name = "id" field_value = 1 }` |
|
|
268
230
|
|
|
269
|
-
|
|
270
|
-
// Create
|
|
271
|
-
db.add "user" {
|
|
272
|
-
data = { name: $input.name, email: $input.email }
|
|
273
|
-
} as $new_user
|
|
274
|
-
|
|
275
|
-
// Read one
|
|
276
|
-
db.get "user" {
|
|
277
|
-
where = $db.user.id == $input.id
|
|
278
|
-
} as $user
|
|
279
|
-
|
|
280
|
-
// Read many
|
|
281
|
-
db.query "user" {
|
|
282
|
-
where = $db.user.is_active == true
|
|
283
|
-
order = [{ field: created_at, direction: desc }]
|
|
284
|
-
paging = { limit: 10, offset: 0 }
|
|
285
|
-
} as $users
|
|
286
|
-
|
|
287
|
-
// Update
|
|
288
|
-
db.edit "user" {
|
|
289
|
-
where = $db.user.id == $input.id
|
|
290
|
-
data = { name: $input.name }
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
// Delete
|
|
294
|
-
db.delete "user" {
|
|
295
|
-
where = $db.user.id == $input.id
|
|
296
|
-
}
|
|
297
|
-
```
|
|
231
|
+
> **Full reference:** See `xanoscript_docs({ topic: "database" })` for joins, bulk operations, transactions, and more.
|
|
298
232
|
|
|
299
233
|
### 3. Optional Field Handling
|
|
300
234
|
|
|
@@ -366,3 +366,13 @@ query list verb=GET {
|
|
|
366
366
|
3. **Keep self-contained** - Include all required tables and functions
|
|
367
367
|
4. **Seed test data** - Use `items` in table definitions for testing
|
|
368
368
|
5. **Validate inputs** - Use preconditions in functions for input validation
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Related Topics
|
|
373
|
+
|
|
374
|
+
| Topic | Description |
|
|
375
|
+
|-------|-------------|
|
|
376
|
+
| `functions` | Function stacks run by jobs |
|
|
377
|
+
| `tasks` | Scheduled task definitions |
|
|
378
|
+
| `tables` | Database tables accessed by jobs |
|
|
@@ -6,6 +6,21 @@ applyTo: "function/**/*.xs, api/**/*.xs"
|
|
|
6
6
|
|
|
7
7
|
Best practices for building secure XanoScript applications.
|
|
8
8
|
|
|
9
|
+
> **TL;DR:** Always check `$auth.id` for protected endpoints. Use `security.create_auth_token` for JWT. Validate all inputs with `filters=`. Hash passwords with `password` type. Use `$env.SECRET_NAME` for secrets.
|
|
10
|
+
|
|
11
|
+
## Section Index
|
|
12
|
+
|
|
13
|
+
- [Authentication](#authentication) (L24) - Tokens, sessions, MFA
|
|
14
|
+
- [Authorization](#authorization) (L186) - Role checks, ownership
|
|
15
|
+
- [Input Validation](#input-validation) (L277) - Type enforcement, sanitization
|
|
16
|
+
- [Data Protection](#data-protection) (L339) - Encryption, hashing, secrets
|
|
17
|
+
- [Rate Limiting](#rate-limiting--abuse-prevention) (L427) - API limits, abuse prevention
|
|
18
|
+
- [Security Headers](#security-headers) (L486) - CORS configuration
|
|
19
|
+
- [Audit Logging](#audit-logging) (L504) - Security event tracking
|
|
20
|
+
- [Best Practices Summary](#best-practices-summary) (L545) - Quick checklist
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
9
24
|
## Quick Reference
|
|
10
25
|
|
|
11
26
|
| Area | Key Practices |
|
|
@@ -550,3 +565,14 @@ function.run "audit_log" {
|
|
|
550
565
|
8. **Log security events** - Audit trail for compliance
|
|
551
566
|
9. **Use HTTPS** - Always (handled by platform)
|
|
552
567
|
10. **Rotate tokens** - Implement refresh token flow
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
571
|
+
## Related Topics
|
|
572
|
+
|
|
573
|
+
| Topic | Description |
|
|
574
|
+
|-------|-------------|
|
|
575
|
+
| `apis` | Endpoint authentication |
|
|
576
|
+
| `types` | Input validation |
|
|
577
|
+
| `middleware` | Request interceptors |
|
|
578
|
+
| `integrations/redis` | Rate limiting |
|
|
@@ -338,3 +338,13 @@ query "stream_large_dataset" {
|
|
|
338
338
|
3. **Handle errors gracefully** - Log failures without stopping stream
|
|
339
339
|
4. **Set appropriate chunk sizes** - Balance memory and performance
|
|
340
340
|
5. **Use JSONL for structured data** - Easier to parse than multi-line JSON
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## Related Topics
|
|
345
|
+
|
|
346
|
+
| Topic | Description |
|
|
347
|
+
|-------|-------------|
|
|
348
|
+
| `integrations` | Cloud storage for file sources |
|
|
349
|
+
| `apis` | Streaming API responses |
|
|
350
|
+
| `database` | Processing streamed data into tables |
|
|
@@ -6,6 +6,62 @@ applyTo: "**/*.xs"
|
|
|
6
6
|
|
|
7
7
|
Complete reference for XanoScript expressions, operators, and filters.
|
|
8
8
|
|
|
9
|
+
> **TL;DR:** XanoScript uses `|` for filters (`$text|trim`), `~` for string concat, and standard operators (`==`, `!=`, `&&`, `||`). Filters are chainable. Error handling uses `precondition`, `try_catch`, and `throw`.
|
|
10
|
+
|
|
11
|
+
## Section Index
|
|
12
|
+
|
|
13
|
+
| Section | Contents |
|
|
14
|
+
|---------|----------|
|
|
15
|
+
| [Operators](#quick-reference) | Comparison, logical, math, null-safe |
|
|
16
|
+
| [Conditional Blocks](#conditional-blocks) | `conditional`, `if`/`elseif`/`else` |
|
|
17
|
+
| [Expressions](#expressions) | Backtick syntax, comparisons |
|
|
18
|
+
| [Math Filters](#math-filters) | `add`, `subtract`, `round`, `abs`, `ceil`, `floor` |
|
|
19
|
+
| [String Filters](#string-filters) | `trim`, `to_lower`, `to_upper`, `substr`, `split`, `replace` |
|
|
20
|
+
| [Array Filters](#array-filters) | `first`, `last`, `count`, `map`, `filter`, `reduce` |
|
|
21
|
+
| [Object Filters](#object-filters) | `get`, `set`, `has`, `keys`, `values` |
|
|
22
|
+
| [Type Filters](#type-filters) | `to_int`, `to_text`, `to_bool`, `json_encode` |
|
|
23
|
+
| [Date/Time Filters](#datetime-filters) | `to_timestamp`, `format_timestamp` |
|
|
24
|
+
| [Encoding Filters](#encoding-filters) | `url_encode`, `base64_encode`, `json_encode` |
|
|
25
|
+
| [Security Filters](#security-filters) | `md5`, `sha256`, `encrypt`, `jws_encode` |
|
|
26
|
+
| [DB Query Filters](#db-query-filters) | `contains`, `includes`, `between`, `within` |
|
|
27
|
+
| [Error Handling](#error-handling) | `precondition`, `try_catch`, `throw` |
|
|
28
|
+
| [System Variables](#system-variables) | `$env.*`, `$auth.*`, request context |
|
|
29
|
+
|
|
30
|
+
## Choosing a Filter
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
Working with...
|
|
34
|
+
├── Strings?
|
|
35
|
+
│ ├── Clean whitespace? → trim, ltrim, rtrim
|
|
36
|
+
│ ├── Change case? → to_lower, to_upper, capitalize
|
|
37
|
+
│ ├── Extract part? → substr
|
|
38
|
+
│ ├── Split to array? → split
|
|
39
|
+
│ ├── Find/replace? → replace, contains
|
|
40
|
+
│ └── Get length? → strlen
|
|
41
|
+
├── Arrays?
|
|
42
|
+
│ ├── Get element? → first, last, get
|
|
43
|
+
│ ├── Count items? → count
|
|
44
|
+
│ ├── Transform all? → map
|
|
45
|
+
│ ├── Keep some? → filter
|
|
46
|
+
│ ├── Find one? → find
|
|
47
|
+
│ ├── Combine? → reduce
|
|
48
|
+
│ └── Sort? → sort
|
|
49
|
+
├── Objects?
|
|
50
|
+
│ ├── Get value? → get
|
|
51
|
+
│ ├── Set value? → set
|
|
52
|
+
│ ├── Check key? → has
|
|
53
|
+
│ └── Extract? → keys, values
|
|
54
|
+
├── Convert type?
|
|
55
|
+
│ ├── To number? → to_int, to_decimal
|
|
56
|
+
│ ├── To string? → to_text
|
|
57
|
+
│ ├── To boolean? → to_bool
|
|
58
|
+
│ └── To/from JSON? → json_encode, json_decode
|
|
59
|
+
└── Check value?
|
|
60
|
+
├── Is null? → is_null
|
|
61
|
+
├── Is empty? → is_empty
|
|
62
|
+
└── Get type? → is_array, is_object, is_int, is_text
|
|
63
|
+
```
|
|
64
|
+
|
|
9
65
|
## Quick Reference
|
|
10
66
|
|
|
11
67
|
### Operators
|
|
@@ -6,6 +6,10 @@ applyTo: "table/**/*.xs"
|
|
|
6
6
|
|
|
7
7
|
Database table definitions in XanoScript.
|
|
8
8
|
|
|
9
|
+
> **TL;DR:** Every table needs `int id` as primary key. Use `auth = true` for user tables. Add indexes for frequently queried fields. Use `filters=` for validation on fields.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
9
13
|
## Quick Reference
|
|
10
14
|
|
|
11
15
|
```xs
|
|
@@ -311,3 +315,14 @@ table "order" {
|
|
|
311
315
|
3. **Add indexes** for fields used in WHERE clauses and JOINs
|
|
312
316
|
4. **Use appropriate types** - `email` for emails, `password` for credentials
|
|
313
317
|
5. **Default timestamps** - Use `?=now` for created_at fields
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Related Topics
|
|
322
|
+
|
|
323
|
+
| Topic | Description |
|
|
324
|
+
|-------|-------------|
|
|
325
|
+
| `database` | CRUD operations on tables |
|
|
326
|
+
| `types` | Data types and validation |
|
|
327
|
+
| `triggers` | Table triggers for CRUD events |
|
|
328
|
+
| `addons` | Reusable subqueries |
|
|
@@ -257,3 +257,14 @@ task "risky_sync" {
|
|
|
257
257
|
3. **Consider timezone** - Schedule uses UTC (+0000)
|
|
258
258
|
4. **Batch operations** - Process in chunks for large datasets
|
|
259
259
|
5. **Set end dates** - Use ends_on for temporary schedules
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## Related Topics
|
|
264
|
+
|
|
265
|
+
| Topic | Description |
|
|
266
|
+
|-------|-------------|
|
|
267
|
+
| `functions` | Reusable function stacks |
|
|
268
|
+
| `database` | Database operations in tasks |
|
|
269
|
+
| `debugging` | Logging and debugging task execution |
|
|
270
|
+
| `triggers` | Event-driven alternatives to scheduled tasks |
|
|
@@ -6,6 +6,10 @@ applyTo: "tool/**/*.xs"
|
|
|
6
6
|
|
|
7
7
|
Functions that AI agents and MCP servers can execute.
|
|
8
8
|
|
|
9
|
+
> **TL;DR:** Tools are functions for AI. Use `description` for internal docs, `instructions` for AI guidance. Define `input { }` and `stack { }` like regular functions. Attach to agents via `tools = [{ name: "tool_name" }]`.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
9
13
|
## Quick Reference
|
|
10
14
|
|
|
11
15
|
```xs
|
|
@@ -297,3 +301,14 @@ tool "cancel_order" {
|
|
|
297
301
|
3. **Use enums for fixed options** - Reduces AI errors
|
|
298
302
|
4. **Keep tools focused** - One task per tool
|
|
299
303
|
5. **Limit response size** - Don't return huge datasets
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Related Topics
|
|
308
|
+
|
|
309
|
+
| Topic | Description |
|
|
310
|
+
|-------|-------------|
|
|
311
|
+
| `agents` | AI agents that use tools |
|
|
312
|
+
| `mcp-servers` | MCP servers that expose tools |
|
|
313
|
+
| `functions` | Similar structure to tools |
|
|
314
|
+
| `types` | Input type definitions |
|