@xano/developer-mcp 1.0.41 → 1.0.43

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 (38) 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/README.md +1 -1
  14. package/dist/xanoscript_docs/quickstart.md +1 -1
  15. package/dist/xanoscript_docs/streaming.md +1 -1
  16. package/package.json +1 -1
  17. package/dist/run_api_docs/format.d.ts +0 -6
  18. package/dist/run_api_docs/format.js +0 -8
  19. package/dist/run_api_docs/format.test.d.ts +0 -1
  20. package/dist/run_api_docs/format.test.js +0 -86
  21. package/dist/run_api_docs/index.d.ts +0 -52
  22. package/dist/run_api_docs/index.js +0 -90
  23. package/dist/run_api_docs/index.test.d.ts +0 -1
  24. package/dist/run_api_docs/index.test.js +0 -127
  25. package/dist/run_api_docs/topics/data.d.ts +0 -2
  26. package/dist/run_api_docs/topics/data.js +0 -104
  27. package/dist/run_api_docs/topics/history.d.ts +0 -2
  28. package/dist/run_api_docs/topics/history.js +0 -93
  29. package/dist/run_api_docs/topics/run.d.ts +0 -2
  30. package/dist/run_api_docs/topics/run.js +0 -110
  31. package/dist/run_api_docs/topics/session.d.ts +0 -2
  32. package/dist/run_api_docs/topics/session.js +0 -166
  33. package/dist/run_api_docs/topics/start.d.ts +0 -2
  34. package/dist/run_api_docs/topics/start.js +0 -97
  35. package/dist/run_api_docs/topics/workflows.d.ts +0 -2
  36. package/dist/run_api_docs/topics/workflows.js +0 -140
  37. package/dist/tools/run_api_docs.d.ts +0 -46
  38. package/dist/tools/run_api_docs.js +0 -69
@@ -1,6 +0,0 @@
1
- /**
2
- * Formatting utilities for Run API documentation output
3
- * Re-exports the shared formatter with Run API configuration
4
- */
5
- import type { TopicDoc, DetailLevel } from "../meta_api_docs/types.js";
6
- export declare function formatDocumentation(doc: TopicDoc, detailLevel?: DetailLevel, includeSchemas?: boolean): string;
@@ -1,8 +0,0 @@
1
- /**
2
- * Formatting utilities for Run API documentation output
3
- * Re-exports the shared formatter with Run API configuration
4
- */
5
- import { formatDocumentation as formatDoc, RUN_API_CONFIG, } from "../meta_api_docs/format.js";
6
- export function formatDocumentation(doc, detailLevel = "detailed", includeSchemas = true) {
7
- return formatDoc(doc, detailLevel, includeSchemas, RUN_API_CONFIG);
8
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,86 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { formatDocumentation } from "./format.js";
3
- describe("run_api_docs/format", () => {
4
- describe("formatDocumentation", () => {
5
- const minimalDoc = {
6
- topic: "test",
7
- title: "Test Topic",
8
- description: "A test topic description",
9
- };
10
- it("should use Run API config by default", () => {
11
- const docWithEndpoints = {
12
- ...minimalDoc,
13
- endpoints: [
14
- {
15
- method: "GET",
16
- path: "/test",
17
- description: "Test endpoint",
18
- },
19
- ],
20
- };
21
- const result = formatDocumentation(docWithEndpoints);
22
- expect(result).toContain("https://app.dev.xano.com/api:run/");
23
- expect(result).toContain("NOT your Xano instance URL");
24
- });
25
- it("should format documentation with title", () => {
26
- const result = formatDocumentation(minimalDoc);
27
- expect(result).toContain("# Test Topic");
28
- });
29
- it("should format documentation with description", () => {
30
- const result = formatDocumentation(minimalDoc);
31
- expect(result).toContain("A test topic description");
32
- });
33
- it("should respect detail level", () => {
34
- const docWithExamples = {
35
- ...minimalDoc,
36
- examples: [
37
- {
38
- title: "Example",
39
- description: "Test",
40
- request: { method: "GET", path: "/test" },
41
- },
42
- ],
43
- };
44
- const overviewResult = formatDocumentation(docWithExamples, "overview");
45
- expect(overviewResult).not.toContain("## Examples");
46
- const detailedResult = formatDocumentation(docWithExamples, "detailed");
47
- expect(detailedResult).toContain("## Examples");
48
- });
49
- it("should use run_api_docs in related topics", () => {
50
- const docWithRelated = {
51
- ...minimalDoc,
52
- related_topics: ["session", "history"],
53
- };
54
- const result = formatDocumentation(docWithRelated);
55
- expect(result).toContain("run_api_docs");
56
- expect(result).toContain("session, history");
57
- });
58
- it("should default to detailed level", () => {
59
- const docWithEndpoints = {
60
- ...minimalDoc,
61
- endpoints: [
62
- {
63
- method: "GET",
64
- path: "/test",
65
- description: "Test",
66
- parameters: [
67
- { name: "id", type: "string", description: "ID" },
68
- ],
69
- },
70
- ],
71
- };
72
- const result = formatDocumentation(docWithEndpoints);
73
- expect(result).toContain("**Parameters:**");
74
- });
75
- it("should default to including schemas", () => {
76
- const docWithSchemas = {
77
- ...minimalDoc,
78
- schemas: {
79
- TestSchema: { type: "object" },
80
- },
81
- };
82
- const result = formatDocumentation(docWithSchemas);
83
- expect(result).toContain("## Schemas");
84
- });
85
- });
86
- });
@@ -1,52 +0,0 @@
1
- /**
2
- * Xano Run API Documentation Index
3
- *
4
- * This module exports all documentation topics and provides
5
- * the run_api_docs tool handler for the MCP server.
6
- */
7
- import type { TopicDoc } from "../meta_api_docs/types.js";
8
- /**
9
- * All available documentation topics
10
- */
11
- export declare const topics: Record<string, TopicDoc>;
12
- /**
13
- * Get list of all available topic names
14
- */
15
- export declare function getTopicNames(): string[];
16
- /**
17
- * Get topic descriptions for tool documentation
18
- */
19
- export declare function getTopicDescriptions(): string;
20
- /**
21
- * Handler for the run_api_docs tool
22
- */
23
- export declare function handleRunApiDocs(topic?: string, detailLevel?: string, includeSchemas?: boolean): string;
24
- /**
25
- * Tool definition for MCP server
26
- */
27
- export declare const runApiDocsToolDefinition: {
28
- name: string;
29
- description: string;
30
- inputSchema: {
31
- type: string;
32
- properties: {
33
- topic: {
34
- type: string;
35
- enum: string[];
36
- description: string;
37
- };
38
- detail_level: {
39
- type: string;
40
- enum: string[];
41
- default: string;
42
- description: string;
43
- };
44
- include_schemas: {
45
- type: string;
46
- default: boolean;
47
- description: string;
48
- };
49
- };
50
- required: string[];
51
- };
52
- };
@@ -1,90 +0,0 @@
1
- /**
2
- * Xano Run API Documentation Index
3
- *
4
- * This module exports all documentation topics and provides
5
- * the run_api_docs tool handler for the MCP server.
6
- */
7
- import { formatDocumentation } from "./format.js";
8
- // Import all topic documentation
9
- import { startDoc } from "./topics/start.js";
10
- import { runDoc } from "./topics/run.js";
11
- import { sessionDoc } from "./topics/session.js";
12
- import { historyDoc } from "./topics/history.js";
13
- import { dataDoc } from "./topics/data.js";
14
- import { workflowsDoc } from "./topics/workflows.js";
15
- /**
16
- * All available documentation topics
17
- */
18
- export const topics = {
19
- start: startDoc,
20
- run: runDoc,
21
- session: sessionDoc,
22
- history: historyDoc,
23
- data: dataDoc,
24
- workflows: workflowsDoc,
25
- };
26
- /**
27
- * Get list of all available topic names
28
- */
29
- export function getTopicNames() {
30
- return Object.keys(topics);
31
- }
32
- /**
33
- * Get topic descriptions for tool documentation
34
- */
35
- export function getTopicDescriptions() {
36
- return Object.entries(topics)
37
- .map(([key, doc]) => `- ${key}: ${doc.title}`)
38
- .join("\n");
39
- }
40
- /**
41
- * Handler for the run_api_docs tool
42
- */
43
- export function handleRunApiDocs(topic, detailLevel, includeSchemas) {
44
- // Validate topic
45
- if (!topic || !topics[topic]) {
46
- const available = getTopicNames().join(", ");
47
- return `Error: Unknown topic "${topic}".\n\nAvailable topics: ${available}`;
48
- }
49
- const doc = topics[topic];
50
- return formatDocumentation(doc, detailLevel || "detailed", includeSchemas !== false);
51
- }
52
- /**
53
- * Tool definition for MCP server
54
- */
55
- export const runApiDocsToolDefinition = {
56
- name: "run_api_docs",
57
- description: `Get documentation for Xano's Run API. Use this to understand runtime execution, session management, and XanoScript execution.
58
-
59
- **Important:** The Run API uses a fixed base URL: https://app.dev.xano.com/api:run/<endpoint> (NOT your Xano instance URL)
60
-
61
- ## Topics
62
- ${getTopicDescriptions()}
63
-
64
- ## Usage
65
- - Start with "start" topic for overview and getting started
66
- - Use "workflows" for step-by-step guides
67
- - Use specific topics (run, session, etc.) for detailed endpoint docs`,
68
- inputSchema: {
69
- type: "object",
70
- properties: {
71
- topic: {
72
- type: "string",
73
- enum: getTopicNames(),
74
- description: "Documentation topic to retrieve",
75
- },
76
- detail_level: {
77
- type: "string",
78
- enum: ["overview", "detailed", "examples"],
79
- default: "detailed",
80
- description: "Level of detail: overview (brief), detailed (full docs), examples (with code examples)",
81
- },
82
- include_schemas: {
83
- type: "boolean",
84
- default: true,
85
- description: "Include JSON schemas for requests/responses",
86
- },
87
- },
88
- required: ["topic"],
89
- },
90
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,127 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { topics, getTopicNames, getTopicDescriptions, handleRunApiDocs, runApiDocsToolDefinition, } from "./index.js";
3
- describe("run_api_docs/index", () => {
4
- describe("topics", () => {
5
- it("should have all expected topics", () => {
6
- const expectedTopics = [
7
- "start",
8
- "run",
9
- "session",
10
- "history",
11
- "data",
12
- "workflows",
13
- ];
14
- expect(Object.keys(topics)).toEqual(expectedTopics);
15
- });
16
- it("should have valid TopicDoc structure for each topic", () => {
17
- for (const [key, doc] of Object.entries(topics)) {
18
- expect(doc).toHaveProperty("topic");
19
- expect(doc).toHaveProperty("title");
20
- expect(doc).toHaveProperty("description");
21
- expect(typeof doc.topic).toBe("string");
22
- expect(typeof doc.title).toBe("string");
23
- expect(typeof doc.description).toBe("string");
24
- expect(doc.topic).toBe(key);
25
- }
26
- });
27
- });
28
- describe("getTopicNames", () => {
29
- it("should return all topic names", () => {
30
- const names = getTopicNames();
31
- expect(names).toEqual(Object.keys(topics));
32
- });
33
- it("should return an array of strings", () => {
34
- const names = getTopicNames();
35
- expect(Array.isArray(names)).toBe(true);
36
- names.forEach((name) => {
37
- expect(typeof name).toBe("string");
38
- });
39
- });
40
- });
41
- describe("getTopicDescriptions", () => {
42
- it("should return formatted topic descriptions", () => {
43
- const descriptions = getTopicDescriptions();
44
- expect(typeof descriptions).toBe("string");
45
- expect(descriptions).toContain("- start:");
46
- expect(descriptions).toContain("- run:");
47
- expect(descriptions).toContain("- session:");
48
- });
49
- it("should include all topics", () => {
50
- const descriptions = getTopicDescriptions();
51
- for (const key of Object.keys(topics)) {
52
- expect(descriptions).toContain(`- ${key}:`);
53
- }
54
- });
55
- });
56
- describe("handleRunApiDocs", () => {
57
- it("should return error for undefined topic", () => {
58
- const result = handleRunApiDocs(undefined);
59
- expect(result).toContain('Error: Unknown topic "undefined"');
60
- expect(result).toContain("Available topics:");
61
- });
62
- it("should return error for unknown topic", () => {
63
- const result = handleRunApiDocs("nonexistent");
64
- expect(result).toContain('Error: Unknown topic "nonexistent"');
65
- expect(result).toContain("Available topics:");
66
- });
67
- it("should return documentation for valid topic", () => {
68
- const result = handleRunApiDocs("start");
69
- expect(result).not.toContain("Error:");
70
- });
71
- it("should return run documentation", () => {
72
- const result = handleRunApiDocs("run");
73
- expect(result).toContain("Run Execution");
74
- expect(result).toContain("/run/exec");
75
- });
76
- it("should return session documentation", () => {
77
- const result = handleRunApiDocs("session");
78
- expect(result).toContain("Session");
79
- });
80
- it("should use default detail_level of detailed", () => {
81
- const result = handleRunApiDocs("run");
82
- expect(result).toContain("**Parameters:**");
83
- });
84
- it("should respect overview detail_level", () => {
85
- const result = handleRunApiDocs("run", "overview");
86
- expect(result).toContain("Run Execution");
87
- });
88
- it("should respect examples detail_level", () => {
89
- const result = handleRunApiDocs("run", "examples");
90
- expect(result).toContain("**Example:**");
91
- });
92
- it("should include schemas by default", () => {
93
- const result = handleRunApiDocs("run");
94
- expect(result).toContain("## Schemas");
95
- });
96
- it("should exclude schemas when includeSchemas is false", () => {
97
- const result = handleRunApiDocs("run", "detailed", false);
98
- expect(result).not.toContain("## Schemas");
99
- });
100
- it("should use Run API base URL", () => {
101
- const result = handleRunApiDocs("run");
102
- expect(result).toContain("https://app.dev.xano.com/api:run/");
103
- });
104
- });
105
- describe("runApiDocsToolDefinition", () => {
106
- it("should have required tool properties", () => {
107
- expect(runApiDocsToolDefinition).toHaveProperty("name", "run_api_docs");
108
- expect(runApiDocsToolDefinition).toHaveProperty("description");
109
- expect(runApiDocsToolDefinition).toHaveProperty("inputSchema");
110
- });
111
- it("should mention fixed base URL in description", () => {
112
- expect(runApiDocsToolDefinition.description).toContain("https://app.dev.xano.com/api:run/");
113
- });
114
- it("should have valid inputSchema", () => {
115
- const schema = runApiDocsToolDefinition.inputSchema;
116
- expect(schema.type).toBe("object");
117
- expect(schema.properties).toHaveProperty("topic");
118
- expect(schema.properties).toHaveProperty("detail_level");
119
- expect(schema.properties).toHaveProperty("include_schemas");
120
- expect(schema.required).toEqual(["topic"]);
121
- });
122
- it("should include all topic names in enum", () => {
123
- const topicEnum = runApiDocsToolDefinition.inputSchema.properties.topic.enum;
124
- expect(topicEnum).toEqual(getTopicNames());
125
- });
126
- });
127
- });
@@ -1,2 +0,0 @@
1
- import type { TopicDoc } from "../../meta_api_docs/types.js";
2
- export declare const dataDoc: TopicDoc;
@@ -1,104 +0,0 @@
1
- export const dataDoc = {
2
- topic: "data",
3
- title: "Session Data Export",
4
- description: `The sink endpoint provides complete data export from session backups. This is the "kitchen sink" - everything from a session's database state in a single JSON response.
5
-
6
- ## Prerequisites
7
- - Session must have been hibernated at least once (backup must exist)
8
- - Hibernation creates a complete snapshot of all tables and data
9
-
10
- ## Use Cases
11
- - Export complete session state for analysis
12
- - Backup data before session termination
13
- - Transfer data between sessions
14
- - Debugging and auditing
15
-
16
- ## Data Included
17
- - All table schemas
18
- - All table data/records
19
- - Complete as single JSON object`,
20
- ai_hints: `- Session must be hibernated before sink is available
21
- - Hibernation happens automatically after project timeout or manually
22
- - Large datasets may take time to export - be patient
23
- - Use for complete data snapshots, not real-time queries
24
- - Data is read-only - cannot modify via sink endpoint
25
- - Public sessions can export without authentication`,
26
- endpoints: [
27
- {
28
- method: "GET",
29
- path: "/session/{session_id}/sink",
30
- tool_name: "getSessionSink",
31
- description: "Get full backup data from a session as JSON. Returns the complete 'kitchen sink' - all table schemas and data in one response. Session must have been hibernated at least once.",
32
- parameters: [
33
- { name: "session_id", type: "uuid", required: true, in: "path", description: "Session UUID" }
34
- ],
35
- example: {
36
- method: "GET",
37
- path: "/session/session-uuid-here/sink"
38
- }
39
- }
40
- ],
41
- schemas: {
42
- SinkResponse: {
43
- type: "object",
44
- properties: {
45
- tables: {
46
- type: "object",
47
- description: "Map of table names to their data",
48
- additionalProperties: {
49
- type: "object",
50
- properties: {
51
- schema: { type: "array", description: "Field definitions" },
52
- records: { type: "array", description: "All records in the table" }
53
- }
54
- }
55
- },
56
- metadata: {
57
- type: "object",
58
- properties: {
59
- session_id: { type: "uuid", description: "Source session" },
60
- exported_at: { type: "timestamp", description: "Export timestamp" },
61
- size: { type: "integer", description: "Backup size in bytes" }
62
- }
63
- }
64
- }
65
- }
66
- },
67
- examples: [
68
- {
69
- title: "Export session data",
70
- description: "Get all data from a hibernated session",
71
- request: {
72
- method: "GET",
73
- path: "/session/abc123-session-uuid/sink",
74
- headers: { "Authorization": "Bearer <token>" }
75
- },
76
- response: {
77
- tables: {
78
- users: {
79
- schema: [
80
- { name: "id", type: "int" },
81
- { name: "email", type: "text" },
82
- { name: "name", type: "text" }
83
- ],
84
- records: [
85
- { id: 1, email: "alice@example.com", name: "Alice" },
86
- { id: 2, email: "bob@example.com", name: "Bob" }
87
- ]
88
- },
89
- orders: {
90
- schema: [
91
- { name: "id", type: "int" },
92
- { name: "user_id", type: "int" },
93
- { name: "total", type: "decimal" }
94
- ],
95
- records: [
96
- { id: 1, user_id: 1, total: 99.99 }
97
- ]
98
- }
99
- }
100
- }
101
- }
102
- ],
103
- related_topics: ["session", "workflows"]
104
- };
@@ -1,2 +0,0 @@
1
- import type { TopicDoc } from "../../meta_api_docs/types.js";
2
- export declare const historyDoc: TopicDoc;
@@ -1,93 +0,0 @@
1
- export const historyDoc = {
2
- topic: "history",
3
- title: "Run History & Document Analysis",
4
- description: `Endpoints for viewing run execution history and analyzing XanoScript documents before execution.
5
-
6
- ## Use Cases
7
- - **Run History**: Review past executions, track patterns, audit usage
8
- - **Document Analysis**: Validate scripts, understand structure before execution
9
-
10
- ## History Features
11
- - Paginated access to run history
12
- - Sorted by creation time (newest first)
13
- - Includes run metadata and configuration`,
14
- ai_hints: `- Use doc/info to validate scripts before execution
15
- - History is sorted by created_at descending (newest first)
16
- - Check existing runs before creating duplicates with same script
17
- - Use pagination for large history sets (default 20 per page, max 100)
18
- - Document info reveals functions, services, and jobs defined in a script`,
19
- endpoints: [
20
- {
21
- method: "GET",
22
- path: "/project/{project_id}/run",
23
- tool_name: "getRunHistory",
24
- description: "List run execution history for a project with pagination. Returns runs sorted by creation time (newest first).",
25
- parameters: [
26
- { name: "project_id", type: "uuid", required: true, in: "path", description: "Project UUID" },
27
- { name: "page", type: "integer", default: 1, description: "Page number (min: 1)" },
28
- { name: "per_page", type: "integer", default: 20, description: "Items per page (1-100)" }
29
- ],
30
- example: {
31
- method: "GET",
32
- path: "/project/abc123-uuid/run?page=1&per_page=20"
33
- }
34
- },
35
- {
36
- method: "POST",
37
- path: "/project/{project_id}/doc/info",
38
- tool_name: "getDocInfo",
39
- description: "Parse and analyze a XanoScript document. Returns metadata about the document including defined functions, services, and jobs. Use this to validate scripts before execution.",
40
- parameters: [
41
- { name: "project_id", type: "uuid", required: true, in: "path", description: "Project context" }
42
- ],
43
- request_body: {
44
- type: "application/json",
45
- properties: {
46
- doc: { type: "text", required: true, description: "XanoScript document content to analyze" }
47
- }
48
- },
49
- example: {
50
- method: "POST",
51
- path: "/project/abc123-uuid/doc/info",
52
- body: {
53
- doc: "job my_job {\n input { text name }\n response = \"Hello, \" + $input.name\n}\n\nservice my_service {\n // service code\n}"
54
- }
55
- }
56
- }
57
- ],
58
- schemas: {
59
- RunHistoryItem: {
60
- type: "object",
61
- properties: {
62
- id: { type: "uuid", description: "Run identifier" },
63
- name: { type: "text", description: "Run name" },
64
- type: { type: "enum", enum: ["job", "service"], description: "Run type" },
65
- sig: { type: "text", description: "Document signature" },
66
- project_id: { type: "uuid", description: "Project reference" },
67
- user_id: { type: "integer", description: "Owner user ID" },
68
- created_at: { type: "timestamp", description: "Creation time" },
69
- updated_at: { type: "timestamp", description: "Last update time" }
70
- }
71
- },
72
- DocInfo: {
73
- type: "object",
74
- properties: {
75
- functions: { type: "array", description: "Defined functions" },
76
- services: { type: "array", description: "Defined services" },
77
- jobs: { type: "array", description: "Defined jobs" },
78
- valid: { type: "boolean", description: "Whether document is valid" },
79
- errors: { type: "array", description: "Parsing errors if any" }
80
- }
81
- },
82
- PaginatedResponse: {
83
- type: "object",
84
- properties: {
85
- items: { type: "array", description: "List of runs" },
86
- curPage: { type: "integer", description: "Current page number" },
87
- nextPage: { type: "integer", description: "Next page number or null" },
88
- prevPage: { type: "integer", description: "Previous page number or null" }
89
- }
90
- }
91
- },
92
- related_topics: ["run", "session", "workflows"]
93
- };
@@ -1,2 +0,0 @@
1
- import type { TopicDoc } from "../../meta_api_docs/types.js";
2
- export declare const runDoc: TopicDoc;