@xano/developer-mcp 1.0.1 → 1.0.2

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 (42) hide show
  1. package/README.md +96 -31
  2. package/dist/index.js +248 -180
  3. package/package.json +4 -2
  4. package/xanoscript_docs/README.md +107 -1
  5. package/xanoscript_docs/agents.md +329 -0
  6. package/xanoscript_docs/apis.md +343 -0
  7. package/xanoscript_docs/database.md +417 -0
  8. package/xanoscript_docs/ephemeral.md +333 -0
  9. package/xanoscript_docs/frontend.md +291 -0
  10. package/xanoscript_docs/functions.md +232 -2035
  11. package/xanoscript_docs/integrations.md +439 -0
  12. package/xanoscript_docs/mcp-servers.md +190 -0
  13. package/xanoscript_docs/plan.md +192 -0
  14. package/xanoscript_docs/syntax.md +314 -0
  15. package/xanoscript_docs/tables.md +270 -0
  16. package/xanoscript_docs/tasks.md +254 -0
  17. package/xanoscript_docs/testing.md +335 -0
  18. package/xanoscript_docs/tools.md +305 -0
  19. package/xanoscript_docs/types.md +297 -0
  20. package/xanoscript_docs/version.json +2 -1
  21. package/xanoscript_docs/api_query_examples.md +0 -1255
  22. package/xanoscript_docs/api_query_guideline.md +0 -129
  23. package/xanoscript_docs/build_from_lovable.md +0 -715
  24. package/xanoscript_docs/db_query_guideline.md +0 -427
  25. package/xanoscript_docs/ephemeral_environment_guideline.md +0 -529
  26. package/xanoscript_docs/expression_guideline.md +0 -1086
  27. package/xanoscript_docs/frontend_guideline.md +0 -67
  28. package/xanoscript_docs/function_examples.md +0 -1406
  29. package/xanoscript_docs/function_guideline.md +0 -130
  30. package/xanoscript_docs/input_guideline.md +0 -227
  31. package/xanoscript_docs/mcp_server_examples.md +0 -36
  32. package/xanoscript_docs/mcp_server_guideline.md +0 -69
  33. package/xanoscript_docs/query_filter.md +0 -489
  34. package/xanoscript_docs/table_examples.md +0 -586
  35. package/xanoscript_docs/table_guideline.md +0 -137
  36. package/xanoscript_docs/task_examples.md +0 -511
  37. package/xanoscript_docs/task_guideline.md +0 -103
  38. package/xanoscript_docs/tips_and_tricks.md +0 -144
  39. package/xanoscript_docs/tool_examples.md +0 -69
  40. package/xanoscript_docs/tool_guideline.md +0 -139
  41. package/xanoscript_docs/unit_testing_guideline.md +0 -328
  42. package/xanoscript_docs/workspace.md +0 -17
@@ -0,0 +1,439 @@
1
+ ---
2
+ applyTo: "functions/**/*.xs, apis/**/*.xs, tasks/*.xs"
3
+ ---
4
+
5
+ # Integrations
6
+
7
+ Cloud services, Redis, storage, and security operations.
8
+
9
+ ## Quick Reference
10
+
11
+ ### Cloud Storage
12
+ | Provider | Prefix |
13
+ |----------|--------|
14
+ | AWS S3 | `cloud.aws.s3.*` |
15
+ | Azure Blob | `cloud.azure.storage.*` |
16
+ | Google Cloud | `cloud.google.storage.*` |
17
+
18
+ ### Search
19
+ | Provider | Prefix |
20
+ |----------|--------|
21
+ | Elasticsearch | `cloud.elasticsearch.*` |
22
+ | AWS OpenSearch | `cloud.aws.opensearch.*` |
23
+ | Algolia | `cloud.algolia.*` |
24
+
25
+ ### Other
26
+ | Service | Prefix |
27
+ |---------|--------|
28
+ | Redis | `redis.*` |
29
+ | Storage | `storage.*` |
30
+ | Security | `security.*` |
31
+
32
+ ---
33
+
34
+ ## AWS S3
35
+
36
+ ### Upload File
37
+ ```xs
38
+ cloud.aws.s3.upload_file {
39
+ bucket = "my-bucket"
40
+ region = "us-east-1"
41
+ key = $env.AWS_ACCESS_KEY
42
+ secret = $env.AWS_SECRET_KEY
43
+ file_key = "uploads/" ~ $input.filename
44
+ file = $input.file
45
+ } as $result
46
+ ```
47
+
48
+ ### Read File
49
+ ```xs
50
+ cloud.aws.s3.read_file {
51
+ bucket = "my-bucket"
52
+ region = "us-east-1"
53
+ key = $env.AWS_ACCESS_KEY
54
+ secret = $env.AWS_SECRET_KEY
55
+ file_key = "data/config.json"
56
+ } as $file
57
+ ```
58
+
59
+ ### Sign URL
60
+ ```xs
61
+ cloud.aws.s3.sign_url {
62
+ bucket = "my-bucket"
63
+ region = "us-east-1"
64
+ key = $env.AWS_ACCESS_KEY
65
+ secret = $env.AWS_SECRET_KEY
66
+ file_key = "private/document.pdf"
67
+ ttl = 300
68
+ } as $signed_url
69
+ ```
70
+
71
+ ### List Directory
72
+ ```xs
73
+ cloud.aws.s3.list_directory {
74
+ bucket = "my-bucket"
75
+ region = "us-east-1"
76
+ key = $env.AWS_ACCESS_KEY
77
+ secret = $env.AWS_SECRET_KEY
78
+ prefix = "uploads/"
79
+ } as $files
80
+ ```
81
+
82
+ ### Delete File
83
+ ```xs
84
+ cloud.aws.s3.delete_file {
85
+ bucket = "my-bucket"
86
+ region = "us-east-1"
87
+ key = $env.AWS_ACCESS_KEY
88
+ secret = $env.AWS_SECRET_KEY
89
+ file_key = "temp/old-file.txt"
90
+ }
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Azure Blob Storage
96
+
97
+ ```xs
98
+ cloud.azure.storage.upload_file {
99
+ account_name = $env.AZURE_ACCOUNT
100
+ account_key = $env.AZURE_KEY
101
+ container_name = "files"
102
+ filePath = "uploads/doc.pdf"
103
+ file = $input.file
104
+ }
105
+
106
+ cloud.azure.storage.read_file {
107
+ account_name = $env.AZURE_ACCOUNT
108
+ account_key = $env.AZURE_KEY
109
+ container_name = "files"
110
+ filePath = "data/config.json"
111
+ } as $file
112
+
113
+ cloud.azure.storage.sign_url {
114
+ account_name = $env.AZURE_ACCOUNT
115
+ account_key = $env.AZURE_KEY
116
+ container_name = "private"
117
+ path = "document.pdf"
118
+ ttl = 300
119
+ } as $url
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Google Cloud Storage
125
+
126
+ ```xs
127
+ cloud.google.storage.upload_file {
128
+ service_account = $env.GCP_SERVICE_ACCOUNT
129
+ bucket = "my-bucket"
130
+ filePath = "uploads/file.pdf"
131
+ file = $input.file
132
+ }
133
+
134
+ cloud.google.storage.read_file {
135
+ service_account = $env.GCP_SERVICE_ACCOUNT
136
+ bucket = "my-bucket"
137
+ filePath = "data/config.json"
138
+ } as $file
139
+
140
+ cloud.google.storage.sign_url {
141
+ service_account = $env.GCP_SERVICE_ACCOUNT
142
+ bucket = "my-bucket"
143
+ filePath = "private/doc.pdf"
144
+ method = "GET"
145
+ ttl = 300
146
+ } as $url
147
+ ```
148
+
149
+ ---
150
+
151
+ ## Elasticsearch
152
+
153
+ ```xs
154
+ # Search
155
+ cloud.elasticsearch.query {
156
+ auth_type = "API Key"
157
+ key_id = $env.ES_KEY_ID
158
+ access_key = $env.ES_ACCESS_KEY
159
+ base_url = "https://my-cluster.es.io"
160
+ index = "products"
161
+ return_type = "search"
162
+ expression = [{ field: "category", value: "electronics", op: "eq" }]
163
+ size = 10
164
+ sort = [{ field: "price", order: "asc" }]
165
+ } as $results
166
+
167
+ # Document operations
168
+ cloud.elasticsearch.document {
169
+ auth_type = "API Key"
170
+ key_id = $env.ES_KEY_ID
171
+ access_key = $env.ES_ACCESS_KEY
172
+ base_url = "https://my-cluster.es.io"
173
+ index = "products"
174
+ method = "GET"
175
+ doc_id = "product-123"
176
+ } as $doc
177
+ ```
178
+
179
+ ---
180
+
181
+ ## Redis
182
+
183
+ ### Key-Value Operations
184
+ ```xs
185
+ # Set value
186
+ redis.set {
187
+ key = "user:123:session"
188
+ data = $session_data
189
+ ttl = 3600 # Expires in 1 hour
190
+ }
191
+
192
+ # Get value
193
+ redis.get { key = "user:123:session" } as $session
194
+
195
+ # Check exists
196
+ redis.has { key = "user:123:session" } as $exists
197
+
198
+ # Delete
199
+ redis.del { key = "user:123:session" }
200
+ ```
201
+
202
+ ### Counters
203
+ ```xs
204
+ # Increment
205
+ redis.incr {
206
+ key = "page_views"
207
+ by = 1
208
+ } as $new_count
209
+
210
+ # Decrement
211
+ redis.decr {
212
+ key = "inventory:item-123"
213
+ by = 1
214
+ } as $new_count
215
+ ```
216
+
217
+ ### Lists
218
+ ```xs
219
+ # Push to end
220
+ redis.push {
221
+ key = "queue:tasks"
222
+ value = $task
223
+ } as $length
224
+
225
+ # Push to front
226
+ redis.unshift {
227
+ key = "queue:priority"
228
+ value = $urgent_task
229
+ }
230
+
231
+ # Pop from end
232
+ redis.pop { key = "queue:tasks" } as $task
233
+
234
+ # Pop from front
235
+ redis.shift { key = "queue:tasks" } as $task
236
+
237
+ # Get range
238
+ redis.range {
239
+ key = "recent:logs"
240
+ start = 0
241
+ stop = 9
242
+ } as $logs
243
+
244
+ # Count
245
+ redis.count { key = "queue:tasks" } as $count
246
+ ```
247
+
248
+ ### Rate Limiting
249
+ ```xs
250
+ redis.ratelimit {
251
+ key = "api:" ~ $env.$remote_ip
252
+ max = 100
253
+ ttl = 60
254
+ error = "Rate limit exceeded"
255
+ } as $status
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Local Storage
261
+
262
+ ### File Operations
263
+ ```xs
264
+ # Create file resource
265
+ storage.create_file_resource {
266
+ filename = "report.csv"
267
+ filedata = $csv_content
268
+ } as $file
269
+
270
+ # Read file resource
271
+ storage.read_file_resource {
272
+ value = $input.file
273
+ } as $content
274
+
275
+ # Delete file
276
+ storage.delete_file { pathname = "temp/old-file.txt" }
277
+ ```
278
+
279
+ ### Image/Attachment Handling
280
+ ```xs
281
+ # Create image metadata
282
+ storage.create_image {
283
+ value = $input.image
284
+ access = "public"
285
+ filename = "profile.jpg"
286
+ } as $image_meta
287
+
288
+ # Create attachment metadata
289
+ storage.create_attachment {
290
+ value = $input.file
291
+ access = "private"
292
+ filename = "document.pdf"
293
+ } as $attachment_meta
294
+
295
+ # Sign private URL
296
+ storage.sign_private_url {
297
+ pathname = "private/document.pdf"
298
+ ttl = 300
299
+ } as $signed_url
300
+ ```
301
+
302
+ ---
303
+
304
+ ## Security
305
+
306
+ ### Password Hashing
307
+ ```xs
308
+ # Password is auto-hashed on insert
309
+ db.add "user" {
310
+ data = { email: $input.email, password: $input.password }
311
+ }
312
+
313
+ # Verify password
314
+ security.check_password {
315
+ text_password = $input.password
316
+ hash_password = $user.password
317
+ } as $is_valid
318
+ ```
319
+
320
+ ### Auth Tokens
321
+ ```xs
322
+ security.create_auth_token {
323
+ table = "user"
324
+ id = $user.id
325
+ extras = { role: $user.role }
326
+ expiration = 86400
327
+ } as $token
328
+ ```
329
+
330
+ ### Encryption
331
+ ```xs
332
+ # Encrypt
333
+ security.encrypt {
334
+ data = $sensitive_data
335
+ algorithm = "aes-256-cbc"
336
+ key = $env.ENCRYPTION_KEY
337
+ iv = $env.ENCRYPTION_IV
338
+ } as $encrypted
339
+
340
+ # Decrypt
341
+ security.decrypt {
342
+ data = $encrypted
343
+ algorithm = "aes-256-cbc"
344
+ key = $env.ENCRYPTION_KEY
345
+ iv = $env.ENCRYPTION_IV
346
+ } as $decrypted
347
+ ```
348
+
349
+ ### JWT (JWS/JWE)
350
+ ```xs
351
+ # Sign JWT
352
+ security.jws_encode {
353
+ claims = { user_id: $user.id, role: $user.role }
354
+ key = $env.JWT_SECRET
355
+ signature_algorithm = "HS256"
356
+ ttl = 3600
357
+ } as $token
358
+
359
+ # Verify JWT
360
+ security.jws_decode {
361
+ token = $input.token
362
+ key = $env.JWT_SECRET
363
+ signature_algorithm = "HS256"
364
+ } as $claims
365
+ ```
366
+
367
+ ### Random Generation
368
+ ```xs
369
+ security.create_uuid as $uuid
370
+ security.random_number { min = 1, max = 100 } as $random
371
+ security.random_bytes { length = 32 } as $bytes
372
+ security.create_password {
373
+ character_count = 16
374
+ require_lowercase = true
375
+ require_uppercase = true
376
+ require_digit = true
377
+ require_symbol = true
378
+ } as $password
379
+ ```
380
+
381
+ ---
382
+
383
+ ## Email
384
+
385
+ ```xs
386
+ util.send_email {
387
+ service_provider = "resend"
388
+ api_key = $env.RESEND_API_KEY
389
+ to = $user.email
390
+ from = "noreply@example.com"
391
+ subject = "Welcome!"
392
+ message = "Thanks for signing up."
393
+ reply_to = "support@example.com"
394
+ } as $result
395
+ ```
396
+
397
+ ---
398
+
399
+ ## External APIs
400
+
401
+ ```xs
402
+ api.request {
403
+ url = "https://api.example.com/data"
404
+ method = "POST"
405
+ params = { key: "value" }
406
+ headers = []|push:("Authorization: Bearer " ~ $env.API_KEY)
407
+ timeout = 30
408
+ } as $response
409
+ ```
410
+
411
+ ---
412
+
413
+ ## Utilities
414
+
415
+ ```xs
416
+ # Template engine (Twig)
417
+ util.template_engine {
418
+ value = """
419
+ Hello {{ $var.name }}!
420
+ {% for item in $var.items %}
421
+ - {{ item.name }}
422
+ {% endfor %}
423
+ """
424
+ } as $rendered
425
+
426
+ # IP lookup
427
+ util.ip_lookup { value = $env.$remote_ip } as $location
428
+
429
+ # Geo distance
430
+ util.geo_distance {
431
+ latitude_1 = 40.71
432
+ longitude_1 = -74.00
433
+ latitude_2 = 34.05
434
+ longitude_2 = -118.24
435
+ } as $distance_km
436
+
437
+ # Sleep
438
+ util.sleep { value = 5 }
439
+ ```
@@ -0,0 +1,190 @@
1
+ ---
2
+ applyTo: "mcp_servers/**/*.xs"
3
+ ---
4
+
5
+ # MCP Servers
6
+
7
+ Model Context Protocol servers that expose tools to external AI clients.
8
+
9
+ ## Quick Reference
10
+
11
+ ```xs
12
+ mcp_server "<name>" {
13
+ canonical = "<unique-id>"
14
+ description = "Internal documentation"
15
+ instructions = "How to use this server's tools"
16
+ tags = ["category"]
17
+ tools = [{ name: "<tool-name>" }]
18
+ }
19
+ ```
20
+
21
+ ---
22
+
23
+ ## Basic Structure
24
+
25
+ ```xs
26
+ mcp_server "Customer Support" {
27
+ canonical = "support-mcp-v1"
28
+ description = "Tools for customer support agents"
29
+ instructions = "Use these tools to help customers with orders and accounts."
30
+ tags = ["support", "customer"]
31
+ tools = [
32
+ { name: "get_order_status" },
33
+ { name: "update_order" },
34
+ { name: "create_ticket" }
35
+ ]
36
+ }
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Key Fields
42
+
43
+ | Field | Purpose | Required |
44
+ |-------|---------|----------|
45
+ | `canonical` | Unique identifier | Yes |
46
+ | `description` | Internal documentation | No |
47
+ | `instructions` | Server-level AI guidance | No |
48
+ | `tags` | Organization/categorization | No |
49
+ | `tools` | List of exposed tools | Yes |
50
+
51
+ ---
52
+
53
+ ## Tools Block
54
+
55
+ Reference tools from `tools/` directory by name:
56
+
57
+ ```xs
58
+ tools = [
59
+ { name: "get_user_details" },
60
+ { name: "search_products" },
61
+ { name: "create_order" }
62
+ ]
63
+ ```
64
+
65
+ Tool names must exactly match `.xs` file names in `tools/`.
66
+
67
+ ---
68
+
69
+ ## Examples
70
+
71
+ ### Task Management Server
72
+ ```xs
73
+ mcp_server "Task Manager" {
74
+ canonical = "task-mgr-mcp"
75
+ description = "Task management tools for productivity agents"
76
+ instructions = "Manages user tasks. All tools relate to the authenticated user's records."
77
+ tags = ["productivity", "internal"]
78
+ tools = [
79
+ { name: "add_task" },
80
+ { name: "list_tasks" },
81
+ { name: "complete_task" },
82
+ { name: "delete_task" }
83
+ ]
84
+ }
85
+ ```
86
+
87
+ ### E-commerce Server
88
+ ```xs
89
+ mcp_server "Store Operations" {
90
+ canonical = "store-ops-v1"
91
+ instructions = "Tools for managing an e-commerce store. Handle products, orders, and inventory."
92
+ tags = ["ecommerce", "admin"]
93
+ tools = [
94
+ { name: "search_products" },
95
+ { name: "get_product" },
96
+ { name: "update_inventory" },
97
+ { name: "get_order" },
98
+ { name: "update_order_status" },
99
+ { name: "process_refund" }
100
+ ]
101
+ }
102
+ ```
103
+
104
+ ### Analytics Server
105
+ ```xs
106
+ mcp_server "Analytics" {
107
+ canonical = "analytics-mcp"
108
+ description = "Data analysis and reporting tools"
109
+ instructions = "Query and analyze business data. Use for generating reports and insights."
110
+ tags = ["analytics", "reporting"]
111
+ tools = [
112
+ { name: "get_sales_summary" },
113
+ { name: "get_user_metrics" },
114
+ { name: "generate_report" },
115
+ { name: "export_data" }
116
+ ]
117
+ }
118
+ ```
119
+
120
+ ### CRM Server
121
+ ```xs
122
+ mcp_server "CRM" {
123
+ canonical = "crm-mcp-v2"
124
+ instructions = """
125
+ Customer Relationship Management tools.
126
+ - Use contact tools for customer info
127
+ - Use deal tools for sales pipeline
128
+ - Use activity tools for interaction logging
129
+ """
130
+ tags = ["crm", "sales"]
131
+ tools = [
132
+ { name: "search_contacts" },
133
+ { name: "get_contact" },
134
+ { name: "create_contact" },
135
+ { name: "update_contact" },
136
+ { name: "list_deals" },
137
+ { name: "create_deal" },
138
+ { name: "log_activity" }
139
+ ]
140
+ }
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Server Organization
146
+
147
+ ### By Domain
148
+ ```
149
+ mcp_servers/
150
+ ├── support.xs # Customer support tools
151
+ ├── ecommerce.xs # Store management
152
+ ├── analytics.xs # Reporting and metrics
153
+ └── admin.xs # Administrative functions
154
+ ```
155
+
156
+ ### By Access Level
157
+ ```
158
+ mcp_servers/
159
+ ├── public.xs # Public-facing tools
160
+ ├── authenticated.xs # Requires auth
161
+ └── admin.xs # Admin-only tools
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Connecting to MCP Servers
167
+
168
+ MCP servers expose a standardized endpoint that AI clients can connect to:
169
+
170
+ 1. Client connects to MCP endpoint
171
+ 2. Server returns available tools with schemas
172
+ 3. Client can call tools and receive responses
173
+
174
+ The MCP protocol handles:
175
+ - Tool discovery
176
+ - Input validation
177
+ - Response formatting
178
+ - Error handling
179
+
180
+ ---
181
+
182
+ ## Best Practices
183
+
184
+ 1. **Clear naming** - Server name should indicate its purpose
185
+ 2. **Memorable canonical IDs** - Use descriptive, stable identifiers
186
+ 3. **Comprehensive instructions** - Guide AI on server's overall purpose
187
+ 4. **Logical tool grouping** - Group related tools in one server
188
+ 5. **Use tags** - Organize servers by category
189
+ 6. **Keep focused** - One domain per server (support, analytics, etc.)
190
+ 7. **Document internally** - Use description for team documentation