@xano/developer-mcp 1.0.24 → 1.0.26
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 +50 -0
- package/dist/cli_docs/format.d.ts +12 -0
- package/dist/cli_docs/format.js +98 -0
- package/dist/cli_docs/index.d.ts +47 -0
- package/dist/cli_docs/index.js +86 -0
- package/dist/cli_docs/topics/function.d.ts +2 -0
- package/dist/cli_docs/topics/function.js +114 -0
- package/dist/cli_docs/topics/integration.d.ts +2 -0
- package/dist/cli_docs/topics/integration.js +157 -0
- package/dist/cli_docs/topics/profile.d.ts +2 -0
- package/dist/cli_docs/topics/profile.js +153 -0
- package/dist/cli_docs/topics/run.d.ts +2 -0
- package/dist/cli_docs/topics/run.js +248 -0
- package/dist/cli_docs/topics/start.d.ts +2 -0
- package/dist/cli_docs/topics/start.js +111 -0
- package/dist/cli_docs/topics/static_host.d.ts +2 -0
- package/dist/cli_docs/topics/static_host.js +77 -0
- package/dist/cli_docs/topics/workspace.d.ts +2 -0
- package/dist/cli_docs/topics/workspace.js +119 -0
- package/dist/cli_docs/types.d.ts +44 -0
- package/dist/cli_docs/types.js +4 -0
- package/dist/index.js +42 -0
- package/dist/xanoscript_docs/integrations.md +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export const workspaceDoc = {
|
|
2
|
+
topic: "workspace",
|
|
3
|
+
title: "Xano CLI - Workspace Operations",
|
|
4
|
+
description: `Workspace commands let you sync XanoScript code between your local filesystem and Xano. This enables version control, local editing, and CI/CD workflows.
|
|
5
|
+
|
|
6
|
+
## Multidoc Format
|
|
7
|
+
|
|
8
|
+
Xano uses a "multidoc" format where multiple XanoScript documents are separated by \`---\`:
|
|
9
|
+
|
|
10
|
+
\`\`\`xanoscript
|
|
11
|
+
# functions/auth.xs
|
|
12
|
+
---
|
|
13
|
+
function: validate_token
|
|
14
|
+
...
|
|
15
|
+
---
|
|
16
|
+
function: refresh_token
|
|
17
|
+
...
|
|
18
|
+
\`\`\`
|
|
19
|
+
|
|
20
|
+
When you pull, the CLI splits these into individual \`.xs\` files organized by type.`,
|
|
21
|
+
ai_hints: `**Key concepts:**
|
|
22
|
+
- \`pull\` downloads workspace code and splits into organized .xs files
|
|
23
|
+
- \`push\` combines .xs files and uploads to Xano
|
|
24
|
+
- Files are organized by type: functions/, apis/, tasks/, etc.
|
|
25
|
+
|
|
26
|
+
**Typical workflow:**
|
|
27
|
+
1. \`xano workspace:pull ./xano-code\` - download
|
|
28
|
+
2. Edit .xs files with your editor/IDE
|
|
29
|
+
3. \`xano workspace:push ./xano-code\` - deploy
|
|
30
|
+
|
|
31
|
+
**Version control:**
|
|
32
|
+
- The pulled directory structure is git-friendly
|
|
33
|
+
- Commit changes to track history
|
|
34
|
+
- Use branches for different environments
|
|
35
|
+
|
|
36
|
+
**Branch handling:**
|
|
37
|
+
- Use \`-b\` flag or set branch in profile
|
|
38
|
+
- Pull from one branch, push to another is supported`,
|
|
39
|
+
related_topics: ["start", "function", "integration"],
|
|
40
|
+
commands: [
|
|
41
|
+
{
|
|
42
|
+
name: "workspace:list",
|
|
43
|
+
description: "List all workspaces accessible to your account",
|
|
44
|
+
usage: "xano workspace:list [-p <profile>]",
|
|
45
|
+
examples: ["xano workspace:list", "xano workspace:list -p production"]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "workspace:pull",
|
|
49
|
+
description: "Download workspace code to local directory",
|
|
50
|
+
usage: "xano workspace:pull <directory> [options]",
|
|
51
|
+
args: [
|
|
52
|
+
{ name: "directory", required: true, description: "Local directory to save files" }
|
|
53
|
+
],
|
|
54
|
+
flags: [
|
|
55
|
+
{ name: "workspace", short: "w", type: "string", required: false, description: "Workspace ID (uses profile default if not set)" },
|
|
56
|
+
{ name: "branch", short: "b", type: "string", required: false, description: "Branch ID to pull from" },
|
|
57
|
+
{ name: "env", type: "boolean", required: false, description: "Include environment variables" },
|
|
58
|
+
{ name: "records", type: "boolean", required: false, description: "Include table records" }
|
|
59
|
+
],
|
|
60
|
+
examples: [
|
|
61
|
+
"xano workspace:pull ./my-app",
|
|
62
|
+
"xano workspace:pull ./staging-code -b 2",
|
|
63
|
+
"xano workspace:pull ./backup --env --records"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "workspace:push",
|
|
68
|
+
description: "Upload local XanoScript files to workspace",
|
|
69
|
+
usage: "xano workspace:push <directory> [options]",
|
|
70
|
+
args: [
|
|
71
|
+
{ name: "directory", required: true, description: "Local directory containing .xs files" }
|
|
72
|
+
],
|
|
73
|
+
flags: [
|
|
74
|
+
{ name: "workspace", short: "w", type: "string", required: false, description: "Workspace ID (uses profile default if not set)" },
|
|
75
|
+
{ name: "branch", short: "b", type: "string", required: false, description: "Branch ID to push to" }
|
|
76
|
+
],
|
|
77
|
+
examples: [
|
|
78
|
+
"xano workspace:push ./my-app",
|
|
79
|
+
"xano workspace:push ./my-app -b 2"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
workflows: [
|
|
84
|
+
{
|
|
85
|
+
name: "Local Development Cycle",
|
|
86
|
+
description: "Edit Xano code locally with your preferred tools",
|
|
87
|
+
steps: [
|
|
88
|
+
"Pull workspace: `xano workspace:pull ./code`",
|
|
89
|
+
"Edit .xs files in your IDE",
|
|
90
|
+
"Validate changes: Use xanoscript_docs MCP tool",
|
|
91
|
+
"Push changes: `xano workspace:push ./code`",
|
|
92
|
+
"Test in Xano dashboard or via API"
|
|
93
|
+
],
|
|
94
|
+
example: `xano workspace:pull ./my-app
|
|
95
|
+
# Edit files...
|
|
96
|
+
xano workspace:push ./my-app`
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "Version Control Setup",
|
|
100
|
+
description: "Track Xano code changes in git",
|
|
101
|
+
steps: [
|
|
102
|
+
"Pull workspace: `xano workspace:pull ./xano`",
|
|
103
|
+
"Initialize git: `cd xano && git init`",
|
|
104
|
+
"Add files: `git add . && git commit -m 'Initial import'`",
|
|
105
|
+
"Make changes and commit regularly",
|
|
106
|
+
"Push to Xano when ready: `xano workspace:push ./xano`"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "Cross-Branch Deployment",
|
|
111
|
+
description: "Promote code from staging to production",
|
|
112
|
+
steps: [
|
|
113
|
+
"Pull from staging: `xano workspace:pull ./deploy -b staging`",
|
|
114
|
+
"Review changes",
|
|
115
|
+
"Push to production: `xano workspace:push ./deploy -b production`"
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for Xano CLI documentation
|
|
3
|
+
*/
|
|
4
|
+
export interface CommandDoc {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
usage: string;
|
|
8
|
+
flags?: FlagDoc[];
|
|
9
|
+
args?: ArgDoc[];
|
|
10
|
+
examples?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface FlagDoc {
|
|
13
|
+
name: string;
|
|
14
|
+
short?: string;
|
|
15
|
+
type: string;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
default?: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ArgDoc {
|
|
21
|
+
name: string;
|
|
22
|
+
required?: boolean;
|
|
23
|
+
description: string;
|
|
24
|
+
}
|
|
25
|
+
export interface WorkflowDoc {
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
steps: string[];
|
|
29
|
+
example?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface TopicDoc {
|
|
32
|
+
topic: string;
|
|
33
|
+
title: string;
|
|
34
|
+
description: string;
|
|
35
|
+
commands?: CommandDoc[];
|
|
36
|
+
workflows?: WorkflowDoc[];
|
|
37
|
+
related_topics?: string[];
|
|
38
|
+
ai_hints?: string;
|
|
39
|
+
}
|
|
40
|
+
export type DetailLevel = "overview" | "detailed" | "examples";
|
|
41
|
+
export interface CliDocsArgs {
|
|
42
|
+
topic: string;
|
|
43
|
+
detail_level?: DetailLevel;
|
|
44
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { xanoscriptParser } from "@xano/xanoscript-language-server/parser/parser
|
|
|
9
9
|
import { getSchemeFromContent } from "@xano/xanoscript-language-server/utils.js";
|
|
10
10
|
import { metaApiDocsToolDefinition, handleMetaApiDocs } from "./meta_api_docs/index.js";
|
|
11
11
|
import { runApiDocsToolDefinition, handleRunApiDocs } from "./run_api_docs/index.js";
|
|
12
|
+
import { cliDocsToolDefinition, handleCliDocs } from "./cli_docs/index.js";
|
|
12
13
|
import { XANOSCRIPT_DOCS_V2, readXanoscriptDocsV2, getXanoscriptDocsVersion, getTopicDescriptions, } from "./xanoscript.js";
|
|
13
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
14
15
|
const __dirname = dirname(__filename);
|
|
@@ -146,6 +147,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
146
147
|
},
|
|
147
148
|
metaApiDocsToolDefinition,
|
|
148
149
|
runApiDocsToolDefinition,
|
|
150
|
+
cliDocsToolDefinition,
|
|
149
151
|
],
|
|
150
152
|
};
|
|
151
153
|
});
|
|
@@ -322,6 +324,46 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
322
324
|
};
|
|
323
325
|
}
|
|
324
326
|
}
|
|
327
|
+
if (request.params.name === "cli_docs") {
|
|
328
|
+
const args = request.params.arguments;
|
|
329
|
+
if (!args?.topic) {
|
|
330
|
+
return {
|
|
331
|
+
content: [
|
|
332
|
+
{
|
|
333
|
+
type: "text",
|
|
334
|
+
text: "Error: 'topic' parameter is required. Use cli_docs with topic='start' for overview.",
|
|
335
|
+
},
|
|
336
|
+
],
|
|
337
|
+
isError: true,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
try {
|
|
341
|
+
const documentation = handleCliDocs({
|
|
342
|
+
topic: args.topic,
|
|
343
|
+
detail_level: args.detail_level,
|
|
344
|
+
});
|
|
345
|
+
return {
|
|
346
|
+
content: [
|
|
347
|
+
{
|
|
348
|
+
type: "text",
|
|
349
|
+
text: documentation,
|
|
350
|
+
},
|
|
351
|
+
],
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
catch (error) {
|
|
355
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
356
|
+
return {
|
|
357
|
+
content: [
|
|
358
|
+
{
|
|
359
|
+
type: "text",
|
|
360
|
+
text: `Error retrieving CLI documentation: ${errorMessage}`,
|
|
361
|
+
},
|
|
362
|
+
],
|
|
363
|
+
isError: true,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
}
|
|
325
367
|
return {
|
|
326
368
|
content: [
|
|
327
369
|
{
|
|
@@ -633,8 +633,9 @@ api.request {
|
|
|
633
633
|
var $data { value = $api_result.response.result }
|
|
634
634
|
|
|
635
635
|
// Check status code
|
|
636
|
-
|
|
637
|
-
|
|
636
|
+
precondition ($api_result.response.status == 200) {
|
|
637
|
+
error_type = "standard"
|
|
638
|
+
error = "API request failed"
|
|
638
639
|
}
|
|
639
640
|
|
|
640
641
|
// Access a specific header
|