@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.
Files changed (57) hide show
  1. package/README.md +100 -19
  2. package/dist/index.js +4 -227
  3. package/dist/meta_api_docs/format.d.ts +16 -1
  4. package/dist/meta_api_docs/format.js +24 -6
  5. package/dist/meta_api_docs/format.test.d.ts +1 -0
  6. package/dist/meta_api_docs/format.test.js +274 -0
  7. package/dist/meta_api_docs/index.test.d.ts +1 -0
  8. package/dist/meta_api_docs/index.test.js +128 -0
  9. package/dist/meta_api_docs/types.test.d.ts +1 -0
  10. package/dist/meta_api_docs/types.test.js +132 -0
  11. package/dist/run_api_docs/format.d.ts +1 -0
  12. package/dist/run_api_docs/format.js +3 -170
  13. package/dist/run_api_docs/format.test.d.ts +1 -0
  14. package/dist/run_api_docs/format.test.js +86 -0
  15. package/dist/run_api_docs/index.test.d.ts +1 -0
  16. package/dist/run_api_docs/index.test.js +127 -0
  17. package/dist/templates/init-workspace.js +4 -4
  18. package/dist/templates/xanoscript-index.d.ts +3 -1
  19. package/dist/templates/xanoscript-index.js +54 -51
  20. package/dist/xanoscript.d.ts +41 -0
  21. package/dist/xanoscript.js +261 -0
  22. package/dist/xanoscript.test.d.ts +1 -0
  23. package/dist/xanoscript.test.js +303 -0
  24. package/dist/xanoscript_docs/README.md +53 -37
  25. package/dist/xanoscript_docs/agents.md +1 -1
  26. package/dist/xanoscript_docs/apis.md +6 -3
  27. package/dist/xanoscript_docs/branch.md +239 -0
  28. package/dist/xanoscript_docs/functions.md +6 -6
  29. package/dist/xanoscript_docs/integrations.md +43 -1
  30. package/dist/xanoscript_docs/middleware.md +321 -0
  31. package/dist/xanoscript_docs/performance.md +1 -1
  32. package/dist/xanoscript_docs/realtime.md +113 -1
  33. package/dist/xanoscript_docs/tasks.md +2 -2
  34. package/dist/xanoscript_docs/tools.md +3 -3
  35. package/dist/xanoscript_docs/types.md +25 -8
  36. package/dist/xanoscript_docs/workspace.md +209 -0
  37. package/dist/xanoscript_docs_auto/README.md +119 -0
  38. package/dist/xanoscript_docs_auto/agents.md +446 -0
  39. package/dist/xanoscript_docs_auto/apis.md +517 -0
  40. package/dist/xanoscript_docs_auto/control-flow.md +543 -0
  41. package/dist/xanoscript_docs_auto/database.md +551 -0
  42. package/dist/xanoscript_docs_auto/debugging.md +527 -0
  43. package/dist/xanoscript_docs_auto/filters.md +464 -0
  44. package/dist/xanoscript_docs_auto/functions.md +431 -0
  45. package/dist/xanoscript_docs_auto/integrations.md +657 -0
  46. package/dist/xanoscript_docs_auto/mcp-servers.md +408 -0
  47. package/dist/xanoscript_docs_auto/operators.md +368 -0
  48. package/dist/xanoscript_docs_auto/syntax.md +287 -0
  49. package/dist/xanoscript_docs_auto/tables.md +447 -0
  50. package/dist/xanoscript_docs_auto/tasks.md +479 -0
  51. package/dist/xanoscript_docs_auto/testing.md +574 -0
  52. package/dist/xanoscript_docs_auto/tools.md +485 -0
  53. package/dist/xanoscript_docs_auto/triggers.md +595 -0
  54. package/dist/xanoscript_docs_auto/types.md +323 -0
  55. package/dist/xanoscript_docs_auto/variables.md +462 -0
  56. package/dist/xanoscript_docs_auto/version.json +5 -0
  57. package/package.json +6 -2
@@ -0,0 +1,274 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { formatDocumentation, META_API_CONFIG, RUN_API_CONFIG, } from "./format.js";
3
+ describe("meta_api_docs/format", () => {
4
+ describe("META_API_CONFIG", () => {
5
+ it("should have correct base URL info", () => {
6
+ expect(META_API_CONFIG.baseUrlInfo).toContain("https://<your-instance-subdomain>.xano.io/api:meta/");
7
+ expect(META_API_CONFIG.toolName).toBe("meta_api_docs");
8
+ });
9
+ });
10
+ describe("RUN_API_CONFIG", () => {
11
+ it("should have correct base URL info", () => {
12
+ expect(RUN_API_CONFIG.baseUrlInfo).toContain("https://app.dev.xano.com/api:run/");
13
+ expect(RUN_API_CONFIG.toolName).toBe("run_api_docs");
14
+ });
15
+ });
16
+ describe("formatDocumentation", () => {
17
+ const minimalDoc = {
18
+ topic: "test",
19
+ title: "Test Topic",
20
+ description: "A test topic description",
21
+ };
22
+ it("should format minimal documentation", () => {
23
+ const result = formatDocumentation(minimalDoc);
24
+ expect(result).toContain("# Test Topic");
25
+ expect(result).toContain("A test topic description");
26
+ });
27
+ it("should include AI hints when present", () => {
28
+ const docWithHints = {
29
+ ...minimalDoc,
30
+ ai_hints: "Use this for testing purposes",
31
+ };
32
+ const result = formatDocumentation(docWithHints);
33
+ expect(result).toContain("## AI Usage Hints");
34
+ expect(result).toContain("Use this for testing purposes");
35
+ });
36
+ it("should format endpoints correctly", () => {
37
+ const docWithEndpoints = {
38
+ ...minimalDoc,
39
+ endpoints: [
40
+ {
41
+ method: "GET",
42
+ path: "/test",
43
+ description: "Get test data",
44
+ },
45
+ {
46
+ method: "POST",
47
+ path: "/test",
48
+ description: "Create test data",
49
+ tool_name: "create_test",
50
+ },
51
+ ],
52
+ };
53
+ const result = formatDocumentation(docWithEndpoints);
54
+ expect(result).toContain("## Endpoints");
55
+ expect(result).toContain("### GET /test");
56
+ expect(result).toContain("### POST /test");
57
+ expect(result).toContain("**Tool:** `create_test`");
58
+ });
59
+ it("should format endpoint parameters", () => {
60
+ const docWithParams = {
61
+ ...minimalDoc,
62
+ endpoints: [
63
+ {
64
+ method: "GET",
65
+ path: "/test/{id}",
66
+ description: "Get test by ID",
67
+ parameters: [
68
+ {
69
+ name: "id",
70
+ type: "integer",
71
+ required: true,
72
+ description: "The test ID",
73
+ },
74
+ {
75
+ name: "include_details",
76
+ type: "boolean",
77
+ required: false,
78
+ default: false,
79
+ description: "Include extra details",
80
+ },
81
+ {
82
+ name: "format",
83
+ type: "string",
84
+ description: "Output format",
85
+ enum: ["json", "xml", "csv"],
86
+ },
87
+ ],
88
+ },
89
+ ],
90
+ };
91
+ const result = formatDocumentation(docWithParams);
92
+ expect(result).toContain("**Parameters:**");
93
+ expect(result).toContain("`id`: integer (required)");
94
+ expect(result).toContain("`include_details`: boolean [default: false]");
95
+ expect(result).toContain("[options: json, xml, csv]");
96
+ });
97
+ it("should format request body", () => {
98
+ const docWithBody = {
99
+ ...minimalDoc,
100
+ endpoints: [
101
+ {
102
+ method: "POST",
103
+ path: "/test",
104
+ description: "Create test",
105
+ request_body: {
106
+ type: "object",
107
+ properties: {
108
+ name: {
109
+ type: "string",
110
+ required: true,
111
+ description: "The name",
112
+ },
113
+ value: {
114
+ type: "number",
115
+ description: "The value",
116
+ },
117
+ },
118
+ },
119
+ },
120
+ ],
121
+ };
122
+ const result = formatDocumentation(docWithBody);
123
+ expect(result).toContain("**Request Body:** `object`");
124
+ expect(result).toContain("`name`: string (required)");
125
+ expect(result).toContain("`value`: number");
126
+ });
127
+ it("should format examples in detailed mode", () => {
128
+ const docWithExamples = {
129
+ ...minimalDoc,
130
+ examples: [
131
+ {
132
+ title: "Basic Example",
133
+ description: "A simple example",
134
+ request: {
135
+ method: "GET",
136
+ path: "/test",
137
+ headers: { Authorization: "Bearer token" },
138
+ },
139
+ response: { data: "test" },
140
+ },
141
+ ],
142
+ };
143
+ const result = formatDocumentation(docWithExamples, "detailed");
144
+ expect(result).toContain("## Examples");
145
+ expect(result).toContain("### Basic Example");
146
+ expect(result).toContain("**Request:**");
147
+ expect(result).toContain("GET /test");
148
+ expect(result).toContain("Authorization: Bearer token");
149
+ expect(result).toContain("**Response:**");
150
+ });
151
+ it("should format examples with request body", () => {
152
+ const docWithBodyExample = {
153
+ ...minimalDoc,
154
+ examples: [
155
+ {
156
+ title: "Create Example",
157
+ description: "Creating data",
158
+ request: {
159
+ method: "POST",
160
+ path: "/test",
161
+ body: { name: "test", value: 42 },
162
+ },
163
+ },
164
+ ],
165
+ };
166
+ const result = formatDocumentation(docWithBodyExample, "detailed");
167
+ expect(result).toContain('"name": "test"');
168
+ expect(result).toContain('"value": 42');
169
+ });
170
+ it("should format patterns/workflows", () => {
171
+ const docWithPatterns = {
172
+ ...minimalDoc,
173
+ patterns: [
174
+ {
175
+ name: "Basic Workflow",
176
+ description: "A simple workflow",
177
+ steps: ["1. Do step 1", "2. Do step 2", "3. Do step 3"],
178
+ example: "example code here",
179
+ },
180
+ ],
181
+ };
182
+ const result = formatDocumentation(docWithPatterns);
183
+ expect(result).toContain("## Workflows");
184
+ expect(result).toContain("### Basic Workflow");
185
+ expect(result).toContain("A simple workflow");
186
+ expect(result).toContain("**Steps:**");
187
+ expect(result).toContain("1. Do step 1");
188
+ expect(result).toContain("**Example:**");
189
+ expect(result).toContain("example code here");
190
+ });
191
+ it("should include schemas when includeSchemas is true", () => {
192
+ const docWithSchemas = {
193
+ ...minimalDoc,
194
+ schemas: {
195
+ TestSchema: {
196
+ type: "object",
197
+ properties: {
198
+ id: { type: "integer" },
199
+ },
200
+ },
201
+ },
202
+ };
203
+ const result = formatDocumentation(docWithSchemas, "detailed", true);
204
+ expect(result).toContain("## Schemas");
205
+ expect(result).toContain('"TestSchema"');
206
+ });
207
+ it("should exclude schemas when includeSchemas is false", () => {
208
+ const docWithSchemas = {
209
+ ...minimalDoc,
210
+ schemas: {
211
+ TestSchema: { type: "object" },
212
+ },
213
+ };
214
+ const result = formatDocumentation(docWithSchemas, "detailed", false);
215
+ expect(result).not.toContain("## Schemas");
216
+ });
217
+ it("should include related topics", () => {
218
+ const docWithRelated = {
219
+ ...minimalDoc,
220
+ related_topics: ["topic1", "topic2", "topic3"],
221
+ };
222
+ const result = formatDocumentation(docWithRelated);
223
+ expect(result).toContain("## Related Topics");
224
+ expect(result).toContain("topic1, topic2, topic3");
225
+ expect(result).toContain("meta_api_docs");
226
+ });
227
+ it("should use custom config", () => {
228
+ const result = formatDocumentation({ ...minimalDoc, patterns: [{ name: "Test", steps: ["step"] }] }, "detailed", true, RUN_API_CONFIG);
229
+ expect(result).toContain("https://app.dev.xano.com/api:run/");
230
+ });
231
+ describe("detail levels", () => {
232
+ const docWithAll = {
233
+ ...minimalDoc,
234
+ endpoints: [
235
+ {
236
+ method: "GET",
237
+ path: "/test",
238
+ description: "Test endpoint",
239
+ parameters: [
240
+ { name: "id", type: "integer", required: true, description: "ID" },
241
+ ],
242
+ example: {
243
+ method: "GET",
244
+ path: "/test/1",
245
+ },
246
+ },
247
+ ],
248
+ examples: [
249
+ {
250
+ title: "Example",
251
+ description: "Test",
252
+ request: { method: "GET", path: "/test" },
253
+ },
254
+ ],
255
+ };
256
+ it("overview should show minimal endpoint info", () => {
257
+ const result = formatDocumentation(docWithAll, "overview");
258
+ expect(result).toContain("### GET /test");
259
+ expect(result).toContain("Test endpoint");
260
+ expect(result).not.toContain("**Parameters:**");
261
+ });
262
+ it("detailed should show parameters but not inline examples", () => {
263
+ const result = formatDocumentation(docWithAll, "detailed");
264
+ expect(result).toContain("**Parameters:**");
265
+ expect(result).toContain("## Examples");
266
+ });
267
+ it("examples should show inline examples in endpoints", () => {
268
+ const result = formatDocumentation(docWithAll, "examples");
269
+ expect(result).toContain("**Example:**");
270
+ expect(result).toContain("GET /test/1");
271
+ });
272
+ });
273
+ });
274
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,128 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { topics, getTopicNames, getTopicDescriptions, handleMetaApiDocs, metaApiDocsToolDefinition, } from "./index.js";
3
+ describe("meta_api_docs/index", () => {
4
+ describe("topics", () => {
5
+ it("should have all expected topics", () => {
6
+ const expectedTopics = [
7
+ "start",
8
+ "authentication",
9
+ "workspace",
10
+ "apigroup",
11
+ "api",
12
+ "table",
13
+ "function",
14
+ "task",
15
+ "agent",
16
+ "tool",
17
+ "mcp_server",
18
+ "middleware",
19
+ "branch",
20
+ "realtime",
21
+ "file",
22
+ "history",
23
+ "workflows",
24
+ ];
25
+ expect(Object.keys(topics)).toEqual(expectedTopics);
26
+ });
27
+ it("should have valid TopicDoc structure for each topic", () => {
28
+ for (const [key, doc] of Object.entries(topics)) {
29
+ expect(doc).toHaveProperty("topic");
30
+ expect(doc).toHaveProperty("title");
31
+ expect(doc).toHaveProperty("description");
32
+ expect(typeof doc.topic).toBe("string");
33
+ expect(typeof doc.title).toBe("string");
34
+ expect(typeof doc.description).toBe("string");
35
+ expect(doc.topic).toBe(key);
36
+ }
37
+ });
38
+ });
39
+ describe("getTopicNames", () => {
40
+ it("should return all topic names", () => {
41
+ const names = getTopicNames();
42
+ expect(names).toEqual(Object.keys(topics));
43
+ });
44
+ it("should return an array of strings", () => {
45
+ const names = getTopicNames();
46
+ expect(Array.isArray(names)).toBe(true);
47
+ names.forEach((name) => {
48
+ expect(typeof name).toBe("string");
49
+ });
50
+ });
51
+ });
52
+ describe("getTopicDescriptions", () => {
53
+ it("should return formatted topic descriptions", () => {
54
+ const descriptions = getTopicDescriptions();
55
+ expect(typeof descriptions).toBe("string");
56
+ expect(descriptions).toContain("- start:");
57
+ expect(descriptions).toContain("- workspace:");
58
+ expect(descriptions).toContain("- api:");
59
+ });
60
+ it("should include all topics", () => {
61
+ const descriptions = getTopicDescriptions();
62
+ for (const key of Object.keys(topics)) {
63
+ expect(descriptions).toContain(`- ${key}:`);
64
+ }
65
+ });
66
+ });
67
+ describe("handleMetaApiDocs", () => {
68
+ it("should return error for unknown topic", () => {
69
+ const result = handleMetaApiDocs({ topic: "nonexistent" });
70
+ expect(result).toContain('Error: Unknown topic "nonexistent"');
71
+ expect(result).toContain("Available topics:");
72
+ });
73
+ it("should return documentation for valid topic", () => {
74
+ const result = handleMetaApiDocs({ topic: "start" });
75
+ expect(result).toContain("Xano Meta API - Getting Started");
76
+ expect(result).not.toContain("Error:");
77
+ });
78
+ it("should use default detail_level of detailed", () => {
79
+ const result = handleMetaApiDocs({ topic: "start" });
80
+ expect(result).toContain("Examples");
81
+ });
82
+ it("should respect overview detail_level", () => {
83
+ const result = handleMetaApiDocs({
84
+ topic: "start",
85
+ detail_level: "overview",
86
+ });
87
+ expect(result).toContain("Xano Meta API");
88
+ });
89
+ it("should respect examples detail_level", () => {
90
+ const result = handleMetaApiDocs({
91
+ topic: "start",
92
+ detail_level: "examples",
93
+ });
94
+ expect(result).toContain("Examples");
95
+ });
96
+ it("should include schemas by default", () => {
97
+ const result = handleMetaApiDocs({ topic: "workspace" });
98
+ // Schemas may or may not be present depending on the topic
99
+ expect(typeof result).toBe("string");
100
+ });
101
+ it("should respect include_schemas=false", () => {
102
+ const result = handleMetaApiDocs({
103
+ topic: "workspace",
104
+ include_schemas: false,
105
+ });
106
+ expect(typeof result).toBe("string");
107
+ });
108
+ });
109
+ describe("metaApiDocsToolDefinition", () => {
110
+ it("should have required tool properties", () => {
111
+ expect(metaApiDocsToolDefinition).toHaveProperty("name", "meta_api_docs");
112
+ expect(metaApiDocsToolDefinition).toHaveProperty("description");
113
+ expect(metaApiDocsToolDefinition).toHaveProperty("inputSchema");
114
+ });
115
+ it("should have valid inputSchema", () => {
116
+ const schema = metaApiDocsToolDefinition.inputSchema;
117
+ expect(schema.type).toBe("object");
118
+ expect(schema.properties).toHaveProperty("topic");
119
+ expect(schema.properties).toHaveProperty("detail_level");
120
+ expect(schema.properties).toHaveProperty("include_schemas");
121
+ expect(schema.required).toEqual(["topic"]);
122
+ });
123
+ it("should include all topic names in enum", () => {
124
+ const topicEnum = metaApiDocsToolDefinition.inputSchema.properties.topic.enum;
125
+ expect(topicEnum).toEqual(getTopicNames());
126
+ });
127
+ });
128
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,132 @@
1
+ import { describe, it, expect } from "vitest";
2
+ describe("meta_api_docs/types", () => {
3
+ describe("type structures", () => {
4
+ it("should allow valid HttpMethod values", () => {
5
+ const methods = ["GET", "POST", "PUT", "PATCH", "DELETE"];
6
+ expect(methods).toHaveLength(5);
7
+ });
8
+ it("should allow valid ParameterDoc structure", () => {
9
+ const param = {
10
+ name: "id",
11
+ type: "integer",
12
+ required: true,
13
+ default: 1,
14
+ description: "The ID",
15
+ enum: ["a", "b"],
16
+ in: "path",
17
+ };
18
+ expect(param.name).toBe("id");
19
+ expect(param.in).toBe("path");
20
+ });
21
+ it("should allow minimal ParameterDoc", () => {
22
+ const param = {
23
+ name: "test",
24
+ type: "string",
25
+ description: "A test parameter",
26
+ };
27
+ expect(param.required).toBeUndefined();
28
+ });
29
+ it("should allow valid RequestBodyDoc structure", () => {
30
+ const body = {
31
+ type: "object",
32
+ description: "Request body",
33
+ properties: {
34
+ name: { type: "string", required: true, description: "Name" },
35
+ },
36
+ example: { name: "test" },
37
+ };
38
+ expect(body.type).toBe("object");
39
+ });
40
+ it("should allow valid ResponseDoc structure", () => {
41
+ const response = {
42
+ type: "object",
43
+ description: "Response",
44
+ properties: { id: { type: "integer" } },
45
+ };
46
+ expect(response.type).toBe("object");
47
+ });
48
+ it("should allow valid RequestExampleDoc structure", () => {
49
+ const example = {
50
+ method: "POST",
51
+ path: "/test",
52
+ headers: { "Content-Type": "application/json" },
53
+ body: { data: "test" },
54
+ };
55
+ expect(example.method).toBe("POST");
56
+ });
57
+ it("should allow valid EndpointDoc structure", () => {
58
+ const endpoint = {
59
+ method: "GET",
60
+ path: "/test/{id}",
61
+ tool_name: "get_test",
62
+ description: "Get a test",
63
+ tags: ["test", "example"],
64
+ parameters: [
65
+ { name: "id", type: "integer", description: "ID" },
66
+ ],
67
+ request_body: { type: "object" },
68
+ response: { type: "object" },
69
+ example: { method: "GET", path: "/test/1" },
70
+ };
71
+ expect(endpoint.method).toBe("GET");
72
+ expect(endpoint.tags).toContain("test");
73
+ });
74
+ it("should allow valid ExampleDoc structure", () => {
75
+ const example = {
76
+ title: "Example Title",
77
+ description: "Example description",
78
+ request: {
79
+ method: "GET",
80
+ path: "/test",
81
+ headers: { Authorization: "Bearer token" },
82
+ body: undefined,
83
+ },
84
+ response: { success: true },
85
+ };
86
+ expect(example.title).toBe("Example Title");
87
+ });
88
+ it("should allow valid PatternDoc structure", () => {
89
+ const pattern = {
90
+ name: "Workflow Name",
91
+ description: "Workflow description",
92
+ steps: ["Step 1", "Step 2"],
93
+ example: "example code",
94
+ };
95
+ expect(pattern.steps).toHaveLength(2);
96
+ });
97
+ it("should allow valid TopicDoc structure", () => {
98
+ const topic = {
99
+ topic: "test",
100
+ title: "Test Topic",
101
+ description: "Test description",
102
+ endpoints: [],
103
+ examples: [],
104
+ related_topics: ["other"],
105
+ schemas: { TestSchema: {} },
106
+ patterns: [],
107
+ ai_hints: "AI hints here",
108
+ };
109
+ expect(topic.topic).toBe("test");
110
+ expect(topic.ai_hints).toBeDefined();
111
+ });
112
+ it("should allow valid DetailLevel values", () => {
113
+ const levels = ["overview", "detailed", "examples"];
114
+ expect(levels).toHaveLength(3);
115
+ });
116
+ it("should allow valid MetaApiDocsArgs structure", () => {
117
+ const args = {
118
+ topic: "start",
119
+ detail_level: "detailed",
120
+ include_schemas: true,
121
+ };
122
+ expect(args.topic).toBe("start");
123
+ });
124
+ it("should allow minimal MetaApiDocsArgs", () => {
125
+ const args = {
126
+ topic: "start",
127
+ };
128
+ expect(args.detail_level).toBeUndefined();
129
+ expect(args.include_schemas).toBeUndefined();
130
+ });
131
+ });
132
+ });
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Formatting utilities for Run API documentation output
3
+ * Re-exports the shared formatter with Run API configuration
3
4
  */
4
5
  import type { TopicDoc, DetailLevel } from "../meta_api_docs/types.js";
5
6
  export declare function formatDocumentation(doc: TopicDoc, detailLevel?: DetailLevel, includeSchemas?: boolean): string;