@xano/developer-mcp 1.0.20 → 1.0.22
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 +100 -19
- package/dist/index.js +4 -227
- package/dist/meta_api_docs/format.d.ts +16 -1
- package/dist/meta_api_docs/format.js +24 -6
- package/dist/meta_api_docs/format.test.d.ts +1 -0
- package/dist/meta_api_docs/format.test.js +274 -0
- package/dist/meta_api_docs/index.test.d.ts +1 -0
- package/dist/meta_api_docs/index.test.js +128 -0
- package/dist/meta_api_docs/types.test.d.ts +1 -0
- package/dist/meta_api_docs/types.test.js +132 -0
- package/dist/run_api_docs/format.d.ts +1 -0
- package/dist/run_api_docs/format.js +3 -170
- package/dist/run_api_docs/format.test.d.ts +1 -0
- package/dist/run_api_docs/format.test.js +86 -0
- package/dist/run_api_docs/index.test.d.ts +1 -0
- package/dist/run_api_docs/index.test.js +127 -0
- package/dist/templates/init-workspace.js +4 -4
- package/dist/templates/xanoscript-index.d.ts +3 -1
- package/dist/templates/xanoscript-index.js +54 -51
- package/dist/xanoscript.d.ts +41 -0
- package/dist/xanoscript.js +261 -0
- package/dist/xanoscript.test.d.ts +1 -0
- package/dist/xanoscript.test.js +303 -0
- package/dist/xanoscript_docs/README.md +53 -37
- package/dist/xanoscript_docs/agents.md +1 -1
- package/dist/xanoscript_docs/apis.md +6 -3
- package/dist/xanoscript_docs/branch.md +239 -0
- package/dist/xanoscript_docs/functions.md +6 -6
- package/dist/xanoscript_docs/integrations.md +43 -1
- package/dist/xanoscript_docs/middleware.md +321 -0
- package/dist/xanoscript_docs/performance.md +1 -1
- package/dist/xanoscript_docs/realtime.md +113 -1
- package/dist/xanoscript_docs/tasks.md +2 -2
- package/dist/xanoscript_docs/tools.md +3 -3
- package/dist/xanoscript_docs/types.md +25 -8
- package/dist/xanoscript_docs/workspace.md +209 -0
- package/dist/xanoscript_docs_auto/README.md +119 -0
- package/dist/xanoscript_docs_auto/agents.md +446 -0
- package/dist/xanoscript_docs_auto/apis.md +517 -0
- package/dist/xanoscript_docs_auto/control-flow.md +543 -0
- package/dist/xanoscript_docs_auto/database.md +551 -0
- package/dist/xanoscript_docs_auto/debugging.md +527 -0
- package/dist/xanoscript_docs_auto/filters.md +464 -0
- package/dist/xanoscript_docs_auto/functions.md +431 -0
- package/dist/xanoscript_docs_auto/integrations.md +657 -0
- package/dist/xanoscript_docs_auto/mcp-servers.md +408 -0
- package/dist/xanoscript_docs_auto/operators.md +368 -0
- package/dist/xanoscript_docs_auto/syntax.md +287 -0
- package/dist/xanoscript_docs_auto/tables.md +447 -0
- package/dist/xanoscript_docs_auto/tasks.md +479 -0
- package/dist/xanoscript_docs_auto/testing.md +574 -0
- package/dist/xanoscript_docs_auto/tools.md +485 -0
- package/dist/xanoscript_docs_auto/triggers.md +595 -0
- package/dist/xanoscript_docs_auto/types.md +323 -0
- package/dist/xanoscript_docs_auto/variables.md +462 -0
- package/dist/xanoscript_docs_auto/version.json +5 -0
- package/package.json +6 -2
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "workspace.xs"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Workspace Configuration
|
|
6
|
+
|
|
7
|
+
Configure workspace-level settings including environment variables, preferences, and realtime configuration.
|
|
8
|
+
|
|
9
|
+
## Quick Reference
|
|
10
|
+
|
|
11
|
+
```xs
|
|
12
|
+
workspace "<name>" {
|
|
13
|
+
description = "Workspace description"
|
|
14
|
+
env = { ... }
|
|
15
|
+
acceptance = { ... }
|
|
16
|
+
preferences = { ... }
|
|
17
|
+
realtime = { ... }
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Attributes
|
|
22
|
+
| Attribute | Type | Required | Description |
|
|
23
|
+
|-----------|------|----------|-------------|
|
|
24
|
+
| `description` | text | No | Human-readable workspace description |
|
|
25
|
+
| `env` | object | No | Environment variable definitions |
|
|
26
|
+
| `acceptance` | object | No | Terms and acceptance settings |
|
|
27
|
+
| `preferences` | object | No | Workspace behavior preferences |
|
|
28
|
+
| `realtime` | object | No | Realtime channel configuration |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Basic Structure
|
|
33
|
+
|
|
34
|
+
```xs
|
|
35
|
+
workspace "my_project" {
|
|
36
|
+
description = "My XanoScript project workspace"
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Environment Variables
|
|
43
|
+
|
|
44
|
+
Define environment variables accessible via `$env.<name>` in your code.
|
|
45
|
+
|
|
46
|
+
```xs
|
|
47
|
+
workspace "my_project" {
|
|
48
|
+
env = {
|
|
49
|
+
API_KEY: "your-api-key",
|
|
50
|
+
DATABASE_URL: "postgresql://...",
|
|
51
|
+
REDIS_URL: "redis://...",
|
|
52
|
+
ENVIRONMENT: "production"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Accessing Environment Variables
|
|
58
|
+
|
|
59
|
+
```xs
|
|
60
|
+
// In any function, query, or task
|
|
61
|
+
stack {
|
|
62
|
+
var $key { value = $env.API_KEY }
|
|
63
|
+
|
|
64
|
+
api.call "external_api" {
|
|
65
|
+
url = $env.DATABASE_URL ~ "/endpoint"
|
|
66
|
+
headers = {
|
|
67
|
+
"Authorization": "Bearer " ~ $env.API_KEY
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Acceptance Settings
|
|
76
|
+
|
|
77
|
+
Configure terms and acceptance requirements.
|
|
78
|
+
|
|
79
|
+
```xs
|
|
80
|
+
workspace "my_project" {
|
|
81
|
+
acceptance = {
|
|
82
|
+
ai_terms: true
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Acceptance Options
|
|
88
|
+
|
|
89
|
+
| Option | Type | Description |
|
|
90
|
+
|--------|------|-------------|
|
|
91
|
+
| `ai_terms` | boolean | Accept AI feature terms of service |
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Preferences
|
|
96
|
+
|
|
97
|
+
Configure workspace behavior and features.
|
|
98
|
+
|
|
99
|
+
```xs
|
|
100
|
+
workspace "my_project" {
|
|
101
|
+
preferences = {
|
|
102
|
+
internal_docs: true,
|
|
103
|
+
sql_columns: true,
|
|
104
|
+
sql_names: true,
|
|
105
|
+
track_performance: true
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Preference Options
|
|
111
|
+
|
|
112
|
+
| Option | Type | Default | Description |
|
|
113
|
+
|--------|------|---------|-------------|
|
|
114
|
+
| `internal_docs` | boolean | false | Enable internal documentation generation |
|
|
115
|
+
| `sql_columns` | boolean | false | Include SQL column names in output |
|
|
116
|
+
| `sql_names` | boolean | false | Include SQL table names in output |
|
|
117
|
+
| `track_performance` | boolean | false | Enable performance tracking and metrics |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Realtime Configuration
|
|
122
|
+
|
|
123
|
+
Configure realtime channel settings.
|
|
124
|
+
|
|
125
|
+
```xs
|
|
126
|
+
workspace "my_project" {
|
|
127
|
+
realtime = {
|
|
128
|
+
canonical: "my-project"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Realtime Options
|
|
134
|
+
|
|
135
|
+
| Option | Type | Description |
|
|
136
|
+
|--------|------|-------------|
|
|
137
|
+
| `canonical` | text | Base URL path for realtime channels |
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Complete Example
|
|
142
|
+
|
|
143
|
+
```xs
|
|
144
|
+
workspace "ecommerce_platform" {
|
|
145
|
+
description = "E-commerce backend workspace"
|
|
146
|
+
|
|
147
|
+
env = {
|
|
148
|
+
STRIPE_KEY: "sk_live_...",
|
|
149
|
+
SENDGRID_KEY: "SG...",
|
|
150
|
+
AWS_REGION: "us-east-1",
|
|
151
|
+
S3_BUCKET: "ecommerce-assets",
|
|
152
|
+
REDIS_URL: "redis://cache.example.com:6379"
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
acceptance = {
|
|
156
|
+
ai_terms: true
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
preferences = {
|
|
160
|
+
internal_docs: true,
|
|
161
|
+
track_performance: true
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
realtime = {
|
|
165
|
+
canonical: "ecommerce"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## File Location
|
|
173
|
+
|
|
174
|
+
Workspace configuration is stored in `workspace.xs` at the root of your project.
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
project/
|
|
178
|
+
├── workspace.xs // Workspace configuration
|
|
179
|
+
├── branch.xs // Branch configuration
|
|
180
|
+
├── tables/
|
|
181
|
+
├── functions/
|
|
182
|
+
└── apis/
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Built-in Environment Variables
|
|
188
|
+
|
|
189
|
+
These variables are automatically available without configuration:
|
|
190
|
+
|
|
191
|
+
| Variable | Description |
|
|
192
|
+
|----------|-------------|
|
|
193
|
+
| `$env.$remote_ip` | Client IP address |
|
|
194
|
+
| `$env.$http_headers` | Request headers array |
|
|
195
|
+
| `$env.$request_uri` | Request URI |
|
|
196
|
+
| `$env.$request_method` | HTTP method (GET, POST, etc.) |
|
|
197
|
+
| `$env.$request_querystring` | Query string |
|
|
198
|
+
| `$env.$datasource` | Current datasource |
|
|
199
|
+
| `$env.$branch` | Current branch name |
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Best Practices
|
|
204
|
+
|
|
205
|
+
1. **Never commit secrets** - Use environment variables for API keys and credentials
|
|
206
|
+
2. **Use descriptive names** - Environment variable names should be self-documenting
|
|
207
|
+
3. **Enable performance tracking** - Helps identify bottlenecks in production
|
|
208
|
+
4. **Set meaningful canonical paths** - Makes realtime channel URLs predictable
|
|
209
|
+
5. **Document your workspace** - Use the description field for team reference
|
|
@@ -0,0 +1,119 @@
|
|
|
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 |
|