@xano/developer-mcp 1.0.19 → 1.0.21
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 +38 -2
- package/dist/index.js +15 -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_docs/README.md +51 -37
- package/dist/xanoscript_docs/apis.md +6 -3
- package/dist/xanoscript_docs/branch.md +239 -0
- package/dist/xanoscript_docs/functions.md +2 -2
- package/dist/xanoscript_docs/middleware.md +321 -0
- package/dist/xanoscript_docs/realtime.md +113 -1
- package/dist/xanoscript_docs/tools.md +1 -1
- package/dist/xanoscript_docs/types.md +25 -8
- package/dist/xanoscript_docs/workspace.md +209 -0
- package/package.json +1 -1
|
@@ -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
|