@xano/developer-mcp 1.0.40 → 1.0.42

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 (43) hide show
  1. package/README.md +47 -84
  2. package/dist/cli_docs/index.js +7 -2
  3. package/dist/lib.d.ts +1 -3
  4. package/dist/lib.js +1 -4
  5. package/dist/meta_api_docs/format.d.ts +0 -4
  6. package/dist/meta_api_docs/format.js +0 -15
  7. package/dist/meta_api_docs/format.test.js +7 -9
  8. package/dist/meta_api_docs/index.js +10 -3
  9. package/dist/tools/index.d.ts +3 -5
  10. package/dist/tools/index.js +2 -9
  11. package/dist/tools/validate_xanoscript.js +10 -5
  12. package/dist/tools/xanoscript_docs.js +11 -5
  13. package/dist/xanoscript_docs/docs_index.json +70 -1
  14. package/dist/xanoscript_docs/integrations/cloud-storage.md +59 -3
  15. package/dist/xanoscript_docs/integrations/redis.md +28 -8
  16. package/dist/xanoscript_docs/integrations/search.md +39 -3
  17. package/dist/xanoscript_docs/integrations/utilities.md +25 -0
  18. package/dist/xanoscript_docs/security.md +39 -0
  19. package/dist/xanoscript_docs/syntax.md +411 -4
  20. package/dist/xanoscript_docs/version.json +2 -2
  21. package/package.json +1 -1
  22. package/dist/run_api_docs/format.d.ts +0 -6
  23. package/dist/run_api_docs/format.js +0 -8
  24. package/dist/run_api_docs/format.test.d.ts +0 -1
  25. package/dist/run_api_docs/format.test.js +0 -86
  26. package/dist/run_api_docs/index.d.ts +0 -52
  27. package/dist/run_api_docs/index.js +0 -90
  28. package/dist/run_api_docs/index.test.d.ts +0 -1
  29. package/dist/run_api_docs/index.test.js +0 -127
  30. package/dist/run_api_docs/topics/data.d.ts +0 -2
  31. package/dist/run_api_docs/topics/data.js +0 -104
  32. package/dist/run_api_docs/topics/history.d.ts +0 -2
  33. package/dist/run_api_docs/topics/history.js +0 -93
  34. package/dist/run_api_docs/topics/run.d.ts +0 -2
  35. package/dist/run_api_docs/topics/run.js +0 -110
  36. package/dist/run_api_docs/topics/session.d.ts +0 -2
  37. package/dist/run_api_docs/topics/session.js +0 -166
  38. package/dist/run_api_docs/topics/start.d.ts +0 -2
  39. package/dist/run_api_docs/topics/start.js +0 -97
  40. package/dist/run_api_docs/topics/workflows.d.ts +0 -2
  41. package/dist/run_api_docs/topics/workflows.js +0 -140
  42. package/dist/tools/run_api_docs.d.ts +0 -46
  43. package/dist/tools/run_api_docs.js +0 -69
@@ -1,97 +0,0 @@
1
- export const startDoc = {
2
- topic: "start",
3
- title: "Xano Run API - Getting Started",
4
- description: `The Xano Run API provides programmatic access to execute XanoScript, manage runtime sessions, and work with execution environments. Use it to run scripts, manage long-running services, and retrieve execution history.
5
-
6
- ## Base URL
7
- \`\`\`
8
- https://app.dev.xano.com/api:run/<endpoint>
9
- \`\`\`
10
-
11
- **Important:** This is a fixed URL - NOT your Xano instance URL. All Run API requests go to this central endpoint.
12
-
13
- ## Authentication
14
- Include your Access Token in the Authorization header:
15
- \`\`\`
16
- Authorization: Bearer <your-access-token>
17
- \`\`\`
18
-
19
- Access tokens are created in the Xano dashboard under Settings > Access Tokens.
20
-
21
- ## Key Concepts
22
-
23
- ### Run Types
24
- - **Job**: One-time execution that runs to completion and terminates
25
- - **Service**: Long-running process that persists in a tenant until stopped
26
-
27
- ### Sessions
28
- Sessions are active runtime execution contexts with isolated state. Each execution creates a session that tracks:
29
- - Execution state (pending, processing, running, error, complete)
30
- - Timing metrics (boot_time, main_time, total_time, etc.)
31
- - Response data and logs
32
- - Access level (public/private)
33
-
34
- ### Resource Hierarchy
35
- \`\`\`
36
- project/
37
- └── run/ # Stored run configurations
38
- └── session/ # Active execution contexts
39
- └── backup/sink # Data snapshots
40
- \`\`\`
41
-
42
- ## Quick Start
43
- 1. **Execute a script:** \`POST /project/{project_id}/run/exec\` with your XanoScript
44
- 2. **Check session status:** \`GET /session/{session_id}\`
45
- 3. **View run history:** \`GET /project/{project_id}/run\`
46
-
47
- ## Common Parameters
48
- - \`project_id\`: UUID of your project (required for most endpoints)
49
- - \`run_id\`: UUID of a stored run configuration
50
- - \`session_id\`: UUID of an active session
51
- - \`doc\`: XanoScript document content
52
- - \`args\`: JSON arguments passed to the execution
53
- - \`env\`: Environment variable overrides`,
54
- ai_hints: `- Use \`POST /project/{id}/run/exec\` to execute new XanoScript
55
- - Sessions are created automatically from executions
56
- - Use "job" type for one-time tasks, "service" for long-running processes
57
- - Check session state before operations (running, error, complete)
58
- - Only "service" type sessions can be re-executed with new documents
59
- - Use \`GET /session/{id}/sink\` to export all data after hibernation`,
60
- related_topics: ["run", "session", "workflows"],
61
- examples: [
62
- {
63
- title: "Execute a simple XanoScript",
64
- description: "Run a XanoScript job and get the result",
65
- request: {
66
- method: "POST",
67
- path: "/project/abc123-uuid/run/exec",
68
- headers: { "Authorization": "Bearer <token>" },
69
- body: {
70
- doc: "job hello {\n response = \"Hello, World!\"\n}",
71
- args: {},
72
- template: "small"
73
- }
74
- },
75
- response: {
76
- session_id: "session-uuid-here",
77
- state: "complete",
78
- response: "Hello, World!"
79
- }
80
- },
81
- {
82
- title: "Check session status",
83
- description: "Get details about a running or completed session",
84
- request: {
85
- method: "GET",
86
- path: "/session/session-uuid-here",
87
- headers: { "Authorization": "Bearer <token>" }
88
- },
89
- response: {
90
- id: "session-uuid-here",
91
- state: "running",
92
- access: "private",
93
- created_at: "2024-01-15T10:30:00Z"
94
- }
95
- }
96
- ]
97
- };
@@ -1,2 +0,0 @@
1
- import type { TopicDoc } from "../../meta_api_docs/types.js";
2
- export declare const workflowsDoc: TopicDoc;
@@ -1,140 +0,0 @@
1
- export const workflowsDoc = {
2
- topic: "workflows",
3
- title: "Common Workflows",
4
- description: `Step-by-step guides for common multi-step tasks using the Xano Run API.
5
-
6
- ## Quick Reference
7
- - **Execute Script**: validate doc → execute → check session
8
- - **Monitor Session**: list sessions → get details → check state
9
- - **Export Data**: execute service → wait for hibernate → get sink
10
- - **Re-execute**: get history → re-execute with overrides`,
11
- ai_hints: `- Always validate scripts with doc/info before execution
12
- - Monitor session state changes for long-running services
13
- - Clean up unused sessions to conserve resources
14
- - Use the fixed base URL: https://app.dev.xano.com/api:run/<endpoint>
15
- - Sessions auto-hibernate after project timeout
16
- - Export data via /sink only after hibernation`,
17
- patterns: [
18
- {
19
- name: "Execute New XanoScript",
20
- description: "Validate, execute, and monitor a XanoScript job",
21
- steps: [
22
- "1. `POST /project/{project_id}/doc/info` - Validate script structure",
23
- "2. `POST /project/{project_id}/run/exec` - Execute the script",
24
- "3. `GET /session/{session_id}` - Check execution status",
25
- "4. (if running) Poll session until state is 'complete' or 'error'"
26
- ],
27
- example: `// 1. Validate document
28
- POST https://app.dev.xano.com/api:run/project/abc123/doc/info
29
- {
30
- "doc": "job process_data {\\n response = db.items.query().all()\\n}"
31
- }
32
-
33
- // 2. Execute
34
- POST https://app.dev.xano.com/api:run/project/abc123/run/exec
35
- {
36
- "doc": "job process_data {\\n response = db.items.query().all()\\n}",
37
- "args": {},
38
- "template": "small"
39
- }
40
-
41
- // 3. Check status
42
- GET https://app.dev.xano.com/api:run/session/{returned_session_id}`
43
- },
44
- {
45
- name: "Run a Persistent Service",
46
- description: "Start a long-running service and manage its lifecycle",
47
- steps: [
48
- "1. `POST /project/{project_id}/run/exec` - Start service (type: service)",
49
- "2. `GET /session/{session_id}` - Verify service is running",
50
- "3. `POST /session/{session_id}/access` - Optionally make public",
51
- "4. `POST /session/{session_id}/exec` - Re-execute with new code if needed",
52
- "5. `POST /project/{project_id}/run/{run_id}/session/{session_id}/stop` - Stop when done"
53
- ],
54
- example: `// 1. Start service
55
- POST https://app.dev.xano.com/api:run/project/abc123/run/exec
56
- {
57
- "doc": "service my_api {\\n endpoint GET /hello {\\n response = 'Hello!'\\n }\\n}",
58
- "args": {}
59
- }
60
-
61
- // 2. Stop service when done
62
- POST https://app.dev.xano.com/api:run/project/abc123/run/{run_id}/session/{session_id}/stop`
63
- },
64
- {
65
- name: "Export Session Data",
66
- description: "Export all data from a session after hibernation",
67
- steps: [
68
- "1. Execute a run (job or service)",
69
- "2. Wait for session to hibernate (auto or via stop)",
70
- "3. `GET /session/{session_id}/sink` - Export all data"
71
- ],
72
- example: `// 1. After session has run and hibernated
73
- GET https://app.dev.xano.com/api:run/session/{session_id}/sink
74
-
75
- // Response includes all tables and records as JSON`
76
- },
77
- {
78
- name: "Re-execute with Modified Arguments",
79
- description: "Run an existing script again with different inputs",
80
- steps: [
81
- "1. `GET /project/{project_id}/run` - Get run history",
82
- "2. Find the run_id you want to re-execute",
83
- "3. `POST /project/{project_id}/run/{run_id}/exec` - Re-execute with new args"
84
- ],
85
- example: `// 1. Get history
86
- GET https://app.dev.xano.com/api:run/project/abc123/run
87
-
88
- // 2. Re-execute with different args
89
- POST https://app.dev.xano.com/api:run/project/abc123/run/{run_id}/exec
90
- {
91
- "args": {
92
- "batch_size": 100,
93
- "mode": "production"
94
- }
95
- }`
96
- },
97
- {
98
- name: "Monitor Active Sessions",
99
- description: "List and monitor running sessions for a project",
100
- steps: [
101
- "1. `GET /project/{project_id}/run/session` - List all sessions",
102
- "2. Filter by state (running, pending, etc.)",
103
- "3. `GET /session/{session_id}` - Get details for specific session",
104
- "4. Take action based on state (stop, re-execute, export)"
105
- ],
106
- example: `// 1. List sessions
107
- GET https://app.dev.xano.com/api:run/project/abc123/run/session?page=1
108
-
109
- // 2. Check specific session
110
- GET https://app.dev.xano.com/api:run/session/{session_id}
111
-
112
- // 3. Stop if needed
113
- POST https://app.dev.xano.com/api:run/project/abc123/run/{run_id}/session/{session_id}/stop`
114
- },
115
- {
116
- name: "Debug Failed Execution",
117
- description: "Investigate why a run failed",
118
- steps: [
119
- "1. `GET /session/{session_id}` - Check session state and error_msg",
120
- "2. Review the 'logs' field for execution details",
121
- "3. `POST /project/{project_id}/doc/info` - Validate the script syntax",
122
- "4. Fix issues and re-execute"
123
- ],
124
- example: `// 1. Get session details
125
- GET https://app.dev.xano.com/api:run/session/{session_id}
126
-
127
- // Response includes:
128
- // - state: "error"
129
- // - error_msg: "Detailed error message"
130
- // - logs: [...execution logs...]
131
-
132
- // 2. Validate fixed script
133
- POST https://app.dev.xano.com/api:run/project/abc123/doc/info
134
- {
135
- "doc": "job fixed_script {\\n // corrected code\\n}"
136
- }`
137
- }
138
- ],
139
- related_topics: ["start", "run", "session", "data"]
140
- };
@@ -1,46 +0,0 @@
1
- /**
2
- * Run API Documentation Tool
3
- *
4
- * Retrieves documentation for Xano's Run API.
5
- * Re-exports from the run_api_docs module with ToolResult support.
6
- */
7
- import { runApiDocsToolDefinition, topics, getTopicNames, getTopicDescriptions } from "../run_api_docs/index.js";
8
- import type { TopicDoc, DetailLevel } from "../meta_api_docs/types.js";
9
- import type { ToolResult } from "./types.js";
10
- export { runApiDocsToolDefinition, topics as runApiTopics, getTopicNames as getRunApiTopicNames, getTopicDescriptions as getRunApiTopicDescriptions, };
11
- export type { TopicDoc, DetailLevel };
12
- export interface RunApiDocsArgs {
13
- topic: string;
14
- detail_level?: DetailLevel;
15
- include_schemas?: boolean;
16
- }
17
- export interface RunApiDocsResult {
18
- documentation: string;
19
- }
20
- /**
21
- * Get Xano Run API documentation.
22
- *
23
- * @param args - Documentation arguments
24
- * @returns Documentation content
25
- *
26
- * @example
27
- * ```ts
28
- * import { runApiDocs } from '@xano/developer-mcp';
29
- *
30
- * // Get overview
31
- * const overview = runApiDocs({ topic: 'start' });
32
- *
33
- * // Get session documentation with examples
34
- * const sessionDocs = runApiDocs({
35
- * topic: 'session',
36
- * detail_level: 'examples',
37
- * include_schemas: true
38
- * });
39
- * ```
40
- */
41
- export declare function runApiDocs(args: RunApiDocsArgs): RunApiDocsResult;
42
- /**
43
- * Get Run API documentation and return a ToolResult.
44
- */
45
- export declare function runApiDocsTool(args: RunApiDocsArgs): ToolResult;
46
- export { runApiDocsToolDefinition as toolDefinition };
@@ -1,69 +0,0 @@
1
- /**
2
- * Run API Documentation Tool
3
- *
4
- * Retrieves documentation for Xano's Run API.
5
- * Re-exports from the run_api_docs module with ToolResult support.
6
- */
7
- import { handleRunApiDocs as _handleRunApiDocs, runApiDocsToolDefinition, topics, getTopicNames, getTopicDescriptions, } from "../run_api_docs/index.js";
8
- // =============================================================================
9
- // Re-exports
10
- // =============================================================================
11
- export { runApiDocsToolDefinition, topics as runApiTopics, getTopicNames as getRunApiTopicNames, getTopicDescriptions as getRunApiTopicDescriptions, };
12
- // =============================================================================
13
- // Standalone Tool Function
14
- // =============================================================================
15
- /**
16
- * Get Xano Run API documentation.
17
- *
18
- * @param args - Documentation arguments
19
- * @returns Documentation content
20
- *
21
- * @example
22
- * ```ts
23
- * import { runApiDocs } from '@xano/developer-mcp';
24
- *
25
- * // Get overview
26
- * const overview = runApiDocs({ topic: 'start' });
27
- *
28
- * // Get session documentation with examples
29
- * const sessionDocs = runApiDocs({
30
- * topic: 'session',
31
- * detail_level: 'examples',
32
- * include_schemas: true
33
- * });
34
- * ```
35
- */
36
- export function runApiDocs(args) {
37
- if (!args?.topic) {
38
- throw new Error("'topic' parameter is required. Use topic='start' for overview.");
39
- }
40
- const documentation = _handleRunApiDocs(args.topic, args.detail_level, args.include_schemas);
41
- return { documentation };
42
- }
43
- /**
44
- * Get Run API documentation and return a ToolResult.
45
- */
46
- export function runApiDocsTool(args) {
47
- if (!args?.topic) {
48
- return {
49
- success: false,
50
- error: "Error: 'topic' parameter is required. Use run_api_docs with topic='start' for overview.",
51
- };
52
- }
53
- try {
54
- const result = runApiDocs(args);
55
- return {
56
- success: true,
57
- data: result.documentation,
58
- };
59
- }
60
- catch (error) {
61
- const errorMessage = error instanceof Error ? error.message : String(error);
62
- return {
63
- success: false,
64
- error: `Error retrieving Run API documentation: ${errorMessage}`,
65
- };
66
- }
67
- }
68
- // Re-export tool definition for MCP
69
- export { runApiDocsToolDefinition as toolDefinition };