@xano/developer-mcp 1.0.11 → 1.0.13

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 (84) hide show
  1. package/README.md +78 -60
  2. package/dist/api_docs/format.d.ts +5 -0
  3. package/dist/api_docs/format.js +168 -0
  4. package/dist/api_docs/index.d.ts +52 -0
  5. package/dist/api_docs/index.js +111 -0
  6. package/dist/api_docs/topics/agent.d.ts +2 -0
  7. package/dist/api_docs/topics/agent.js +142 -0
  8. package/dist/api_docs/topics/api.d.ts +2 -0
  9. package/dist/api_docs/topics/api.js +176 -0
  10. package/dist/api_docs/topics/apigroup.d.ts +2 -0
  11. package/dist/api_docs/topics/apigroup.js +124 -0
  12. package/dist/api_docs/topics/authentication.d.ts +2 -0
  13. package/dist/api_docs/topics/authentication.js +61 -0
  14. package/dist/api_docs/topics/branch.d.ts +2 -0
  15. package/dist/api_docs/topics/branch.js +73 -0
  16. package/dist/api_docs/topics/file.d.ts +2 -0
  17. package/dist/api_docs/topics/file.js +70 -0
  18. package/dist/api_docs/topics/function.d.ts +2 -0
  19. package/dist/api_docs/topics/function.js +164 -0
  20. package/dist/api_docs/topics/history.d.ts +2 -0
  21. package/dist/api_docs/topics/history.js +149 -0
  22. package/dist/api_docs/topics/mcp_server.d.ts +2 -0
  23. package/dist/api_docs/topics/mcp_server.js +139 -0
  24. package/dist/api_docs/topics/middleware.d.ts +2 -0
  25. package/dist/api_docs/topics/middleware.js +156 -0
  26. package/dist/api_docs/topics/realtime.d.ts +2 -0
  27. package/dist/api_docs/topics/realtime.js +112 -0
  28. package/dist/api_docs/topics/start.d.ts +2 -0
  29. package/dist/api_docs/topics/start.js +107 -0
  30. package/dist/api_docs/topics/table.d.ts +2 -0
  31. package/dist/api_docs/topics/table.js +195 -0
  32. package/dist/api_docs/topics/task.d.ts +2 -0
  33. package/dist/api_docs/topics/task.js +165 -0
  34. package/dist/api_docs/topics/tool.d.ts +2 -0
  35. package/dist/api_docs/topics/tool.js +150 -0
  36. package/dist/api_docs/topics/workflows.d.ts +2 -0
  37. package/dist/api_docs/topics/workflows.js +131 -0
  38. package/dist/api_docs/topics/workspace.d.ts +2 -0
  39. package/dist/api_docs/topics/workspace.js +153 -0
  40. package/dist/api_docs/types.d.ts +79 -0
  41. package/dist/api_docs/types.js +4 -0
  42. package/dist/index.js +46 -92
  43. package/dist/templates/init-workspace.js +2 -16
  44. package/package.json +4 -7
  45. package/api_docs/addon.md +0 -193
  46. package/api_docs/agent.md +0 -154
  47. package/api_docs/api_group.md +0 -236
  48. package/api_docs/authentication.md +0 -68
  49. package/api_docs/file.md +0 -190
  50. package/api_docs/function.md +0 -217
  51. package/api_docs/history.md +0 -263
  52. package/api_docs/index.md +0 -104
  53. package/api_docs/mcp_server.md +0 -139
  54. package/api_docs/middleware.md +0 -205
  55. package/api_docs/realtime.md +0 -153
  56. package/api_docs/table.md +0 -151
  57. package/api_docs/task.md +0 -191
  58. package/api_docs/tool.md +0 -216
  59. package/api_docs/triggers.md +0 -344
  60. package/api_docs/workspace.md +0 -246
  61. /package/{xanoscript_docs → dist/xanoscript_docs}/README.md +0 -0
  62. /package/{xanoscript_docs → dist/xanoscript_docs}/addons.md +0 -0
  63. /package/{xanoscript_docs → dist/xanoscript_docs}/agents.md +0 -0
  64. /package/{xanoscript_docs → dist/xanoscript_docs}/apis.md +0 -0
  65. /package/{xanoscript_docs → dist/xanoscript_docs}/database.md +0 -0
  66. /package/{xanoscript_docs → dist/xanoscript_docs}/debugging.md +0 -0
  67. /package/{xanoscript_docs → dist/xanoscript_docs}/ephemeral.md +0 -0
  68. /package/{xanoscript_docs → dist/xanoscript_docs}/frontend.md +0 -0
  69. /package/{xanoscript_docs → dist/xanoscript_docs}/functions.md +0 -0
  70. /package/{xanoscript_docs → dist/xanoscript_docs}/integrations.md +0 -0
  71. /package/{xanoscript_docs → dist/xanoscript_docs}/mcp-servers.md +0 -0
  72. /package/{xanoscript_docs → dist/xanoscript_docs}/performance.md +0 -0
  73. /package/{xanoscript_docs → dist/xanoscript_docs}/realtime.md +0 -0
  74. /package/{xanoscript_docs → dist/xanoscript_docs}/schema.md +0 -0
  75. /package/{xanoscript_docs → dist/xanoscript_docs}/security.md +0 -0
  76. /package/{xanoscript_docs → dist/xanoscript_docs}/streaming.md +0 -0
  77. /package/{xanoscript_docs → dist/xanoscript_docs}/syntax.md +0 -0
  78. /package/{xanoscript_docs → dist/xanoscript_docs}/tables.md +0 -0
  79. /package/{xanoscript_docs → dist/xanoscript_docs}/tasks.md +0 -0
  80. /package/{xanoscript_docs → dist/xanoscript_docs}/testing.md +0 -0
  81. /package/{xanoscript_docs → dist/xanoscript_docs}/tools.md +0 -0
  82. /package/{xanoscript_docs → dist/xanoscript_docs}/triggers.md +0 -0
  83. /package/{xanoscript_docs → dist/xanoscript_docs}/types.md +0 -0
  84. /package/{xanoscript_docs → dist/xanoscript_docs}/version.json +0 -0
package/README.md CHANGED
@@ -6,10 +6,10 @@ A Model Context Protocol (MCP) server that provides AI assistants with comprehen
6
6
 
7
7
  This MCP server acts as a bridge between AI models and Xano's developer ecosystem, offering:
8
8
 
9
- - Complete Xano Headless API documentation
10
- - XanoScript code validation and syntax checking
11
- - XanoScript programming language documentation with examples
12
- - Development workflows and best practices
9
+ - **Meta API Documentation** - Programmatically manage Xano workspaces, databases, APIs, functions, and more
10
+ - **XanoScript Documentation** - Language reference with context-aware docs based on file type
11
+ - **Code Validation** - Syntax checking with the official XanoScript language server
12
+ - **Workflow Guides** - Step-by-step guides for common development tasks
13
13
 
14
14
  ## Quick Start
15
15
 
@@ -109,38 +109,7 @@ claude mcp add xano-developer node /path/to/xano-developer-mcp/dist/index.js
109
109
 
110
110
  ## Available Tools
111
111
 
112
- ### 1. `api_docs`
113
-
114
- Retrieves Xano Headless API documentation for specific resources.
115
-
116
- **Parameters:**
117
- | Parameter | Type | Required | Description |
118
- |-----------|------|----------|-------------|
119
- | `object` | string | No | Specific API resource to document |
120
-
121
- **Available Objects:**
122
- - `workspace` - Workspace management, branches, datasources, OpenAPI specs
123
- - `table` - Database table schema management
124
- - `api_group` - API groups and endpoints management
125
- - `function` - Reusable function library
126
- - `task` - Scheduled tasks (cron jobs)
127
- - `middleware` - Request/response middleware
128
- - `addon` - Response transformation queries
129
- - `agent` - AI agent configuration
130
- - `tool` - AI tool definitions for agents
131
- - `mcp_server` - Model Context Protocol server management
132
- - `realtime` - Realtime WebSocket channels
133
- - `triggers` - Event-driven triggers
134
- - `file` - File uploads and static hosting
135
- - `history` - Request history and audit logs
136
- - `authentication` - User authentication and session info
137
-
138
- **Example:**
139
- ```
140
- api_docs({ object: "workspace" })
141
- ```
142
-
143
- ### 2. `validate_xanoscript`
112
+ ### 1. `validate_xanoscript`
144
113
 
145
114
  Validates XanoScript code for syntax errors. The language server auto-detects the object type from the code syntax.
146
115
 
@@ -158,7 +127,7 @@ validate_xanoscript({
158
127
 
159
128
  **Returns:** List of errors with line/column positions, or confirmation of validity.
160
129
 
161
- ### 3. `xanoscript_docs`
130
+ ### 2. `xanoscript_docs`
162
131
 
163
132
  Retrieves XanoScript programming language documentation with context-aware support.
164
133
 
@@ -225,6 +194,54 @@ Get the current version of the Xano Developer MCP server.
225
194
  mcp_version()
226
195
  ```
227
196
 
197
+ ### 5. `api_docs`
198
+
199
+ Get documentation for Xano's Meta API. Use this to understand how to programmatically manage Xano workspaces, databases, APIs, functions, agents, and more.
200
+
201
+ **Parameters:**
202
+ | Parameter | Type | Required | Description |
203
+ |-----------|------|----------|-------------|
204
+ | `topic` | string | Yes | Documentation topic to retrieve |
205
+ | `detail_level` | string | No | `overview`, `detailed` (default), or `examples` |
206
+ | `include_schemas` | boolean | No | Include JSON schemas for requests/responses (default: true) |
207
+
208
+ **Available Topics:**
209
+
210
+ | Topic | Description |
211
+ |-------|-------------|
212
+ | `start` | Getting started with the Meta API |
213
+ | `authentication` | API authentication and authorization |
214
+ | `workspace` | Workspace management endpoints |
215
+ | `apigroup` | API group operations |
216
+ | `api` | API endpoint management |
217
+ | `table` | Database table operations |
218
+ | `function` | Function management |
219
+ | `task` | Scheduled task operations |
220
+ | `agent` | AI agent configuration |
221
+ | `tool` | AI tool management |
222
+ | `mcp_server` | MCP server endpoints |
223
+ | `middleware` | Middleware configuration |
224
+ | `branch` | Branch management |
225
+ | `realtime` | Real-time channel operations |
226
+ | `file` | File management |
227
+ | `history` | Version history |
228
+ | `workflows` | Step-by-step workflow guides |
229
+
230
+ **Examples:**
231
+ ```
232
+ // Get overview of Meta API
233
+ api_docs({ topic: "start" })
234
+
235
+ // Get detailed table documentation
236
+ api_docs({ topic: "table", detail_level: "detailed" })
237
+
238
+ // Get examples without schemas (smaller context)
239
+ api_docs({ topic: "api", detail_level: "examples", include_schemas: false })
240
+
241
+ // Step-by-step workflow guides
242
+ api_docs({ topic: "workflows" })
243
+ ```
244
+
228
245
  ## MCP Resources
229
246
 
230
247
  The server also exposes XanoScript documentation as MCP resources for direct access:
@@ -262,7 +279,6 @@ The server also exposes XanoScript documentation as MCP resources for direct acc
262
279
  | `build` | `tsc` | Compile TypeScript to JavaScript |
263
280
  | `start` | `node dist/index.js` | Run the MCP server |
264
281
  | `dev` | `tsc && node dist/index.js` | Build and run in development |
265
- | `sync-docs` | `npx ts-node scripts/sync-xanoscript-docs.ts` | Regenerate XanoScript documentation mapping |
266
282
 
267
283
  ## Project Structure
268
284
 
@@ -271,23 +287,19 @@ xano-developer-mcp/
271
287
  ├── src/
272
288
  │ ├── index.ts # Main MCP server implementation
273
289
  │ ├── xanoscript.d.ts # TypeScript declarations
290
+ │ ├── api_docs/ # Meta API documentation
291
+ │ │ ├── index.ts # API docs tool handler
292
+ │ │ ├── types.ts # Type definitions
293
+ │ │ ├── format.ts # Documentation formatter
294
+ │ │ └── topics/ # Individual topic modules
295
+ │ ├── xanoscript_docs/ # XanoScript language documentation
296
+ │ │ ├── version.json
297
+ │ │ ├── README.md
298
+ │ │ ├── syntax.md
299
+ │ │ └── ...
274
300
  │ └── templates/
275
301
  │ └── xanoscript-index.ts
276
302
  ├── dist/ # Compiled JavaScript output
277
- ├── scripts/
278
- │ └── sync-xanoscript-docs.ts # Documentation sync script
279
- ├── api_docs/ # Xano Headless API documentation (16 markdown files)
280
- │ ├── index.md
281
- │ ├── workspace.md
282
- │ ├── table.md
283
- │ └── ...
284
- ├── xanoscript_docs/ # XanoScript language documentation
285
- │ ├── version.json
286
- │ ├── README.md
287
- │ ├── syntax.md
288
- │ ├── functions.md
289
- │ ├── apis.md
290
- │ └── ...
291
303
  ├── package.json
292
304
  └── tsconfig.json
293
305
  ```
@@ -310,16 +322,16 @@ MCP Protocol (JSON-RPC over stdio)
310
322
 
311
323
 
312
324
  Xano Developer MCP Server
313
-
314
- ├─► api_docs → Reads /api_docs/*.md files
315
325
 
316
326
  ├─► validate_xanoscript → Parses code with XanoScript language server
317
327
 
318
328
  ├─► xanoscript_docs → Context-aware docs from /xanoscript_docs/*.md
319
329
 
330
+ ├─► api_docs → Meta API documentation with detail levels
331
+
320
332
  ├─► mcp_version → Returns server version from package.json
321
333
 
322
- └─► MCP Resources → Direct access to documentation files
334
+ └─► MCP Resources → Direct access to XanoScript documentation
323
335
  ```
324
336
 
325
337
  ## Authentication
@@ -338,11 +350,17 @@ Compiles TypeScript to JavaScript in the `dist/` directory.
338
350
 
339
351
  ### Documentation Structure
340
352
 
341
- The XanoScript documentation uses a file-based structure in `xanoscript_docs/`. The documentation mapping is configured in `src/index.ts` via the `XANOSCRIPT_DOCS_V2` constant, which defines:
342
-
343
- - **file**: The markdown file containing the documentation
344
- - **applyTo**: Glob patterns for context-aware matching (e.g., `apis/**/*.xs`)
345
- - **description**: Human-readable description of the topic
353
+ **XanoScript Documentation** (`src/xanoscript_docs/`):
354
+ - Markdown files for XanoScript language reference
355
+ - Configured in `src/index.ts` via `XANOSCRIPT_DOCS_V2` with:
356
+ - **file**: The markdown file containing the documentation
357
+ - **applyTo**: Glob patterns for context-aware matching (e.g., `apis/**/*.xs`)
358
+ - **description**: Human-readable description of the topic
359
+
360
+ **Meta API Documentation** (`src/api_docs/`):
361
+ - TypeScript modules with structured documentation
362
+ - Supports parameterized output (detail levels, schema inclusion)
363
+ - Better for AI consumption due to context efficiency
346
364
 
347
365
  ## License
348
366
 
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Formatting utilities for API documentation output
3
+ */
4
+ import type { TopicDoc, DetailLevel } from "./types.js";
5
+ export declare function formatDocumentation(doc: TopicDoc, detailLevel?: DetailLevel, includeSchemas?: boolean): string;
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Formatting utilities for API documentation output
3
+ */
4
+ /**
5
+ * Base URL information included with any topic that has endpoints
6
+ */
7
+ const BASE_URL_INFO = `## Base URL
8
+ \`\`\`
9
+ https://<your-instance-subdomain>.xano.io/api:meta/<endpoint>
10
+ \`\`\`
11
+ Authorization: \`Bearer <your-access-token>\`
12
+ `;
13
+ function formatParameter(param) {
14
+ const required = param.required ? " (required)" : "";
15
+ const defaultVal = param.default !== undefined ? ` [default: ${param.default}]` : "";
16
+ const enumVals = param.enum ? ` [options: ${param.enum.join(", ")}]` : "";
17
+ return ` - \`${param.name}\`: ${param.type}${required}${defaultVal}${enumVals} - ${param.description}`;
18
+ }
19
+ function formatEndpoint(ep, detailLevel) {
20
+ const lines = [];
21
+ // Method and path
22
+ lines.push(`### ${ep.method} ${ep.path}`);
23
+ if (ep.tool_name) {
24
+ lines.push(`**Tool:** \`${ep.tool_name}\``);
25
+ }
26
+ lines.push("");
27
+ lines.push(ep.description);
28
+ if (detailLevel === "overview") {
29
+ return lines.join("\n");
30
+ }
31
+ // Parameters
32
+ if (ep.parameters?.length) {
33
+ lines.push("");
34
+ lines.push("**Parameters:**");
35
+ for (const param of ep.parameters) {
36
+ lines.push(formatParameter(param));
37
+ }
38
+ }
39
+ // Request body
40
+ if (ep.request_body) {
41
+ lines.push("");
42
+ lines.push(`**Request Body:** \`${ep.request_body.type}\``);
43
+ if (ep.request_body.properties) {
44
+ for (const [key, val] of Object.entries(ep.request_body.properties)) {
45
+ const req = val.required ? " (required)" : "";
46
+ lines.push(` - \`${key}\`: ${val.type}${req} - ${val.description || ""}`);
47
+ }
48
+ }
49
+ }
50
+ // Example (only in detailed/examples mode)
51
+ if (detailLevel === "examples" && ep.example) {
52
+ lines.push("");
53
+ lines.push("**Example:**");
54
+ lines.push("```");
55
+ lines.push(`${ep.example.method} ${ep.example.path}`);
56
+ if (ep.example.body) {
57
+ lines.push(JSON.stringify(ep.example.body, null, 2));
58
+ }
59
+ lines.push("```");
60
+ }
61
+ return lines.join("\n");
62
+ }
63
+ function formatExample(ex) {
64
+ const lines = [];
65
+ lines.push(`### ${ex.title}`);
66
+ lines.push("");
67
+ lines.push(ex.description);
68
+ lines.push("");
69
+ lines.push("**Request:**");
70
+ lines.push("```");
71
+ lines.push(`${ex.request.method} ${ex.request.path}`);
72
+ if (ex.request.headers) {
73
+ for (const [key, val] of Object.entries(ex.request.headers)) {
74
+ lines.push(`${key}: ${val}`);
75
+ }
76
+ }
77
+ if (ex.request.body) {
78
+ lines.push("");
79
+ lines.push(JSON.stringify(ex.request.body, null, 2));
80
+ }
81
+ lines.push("```");
82
+ if (ex.response !== undefined) {
83
+ lines.push("");
84
+ lines.push("**Response:**");
85
+ lines.push("```json");
86
+ lines.push(JSON.stringify(ex.response, null, 2));
87
+ lines.push("```");
88
+ }
89
+ return lines.join("\n");
90
+ }
91
+ function formatPattern(pattern) {
92
+ const lines = [];
93
+ lines.push(`### ${pattern.name}`);
94
+ if (pattern.description) {
95
+ lines.push("");
96
+ lines.push(pattern.description);
97
+ }
98
+ lines.push("");
99
+ lines.push("**Steps:**");
100
+ for (const step of pattern.steps) {
101
+ lines.push(step);
102
+ }
103
+ if (pattern.example) {
104
+ lines.push("");
105
+ lines.push("**Example:**");
106
+ lines.push("```");
107
+ lines.push(pattern.example);
108
+ lines.push("```");
109
+ }
110
+ return lines.join("\n");
111
+ }
112
+ export function formatDocumentation(doc, detailLevel = "detailed", includeSchemas = true) {
113
+ const sections = [];
114
+ // Header
115
+ sections.push(`# ${doc.title}`);
116
+ sections.push("");
117
+ sections.push(doc.description);
118
+ // AI Hints (always include for AI optimization)
119
+ if (doc.ai_hints) {
120
+ sections.push("");
121
+ sections.push("## AI Usage Hints");
122
+ sections.push(doc.ai_hints);
123
+ }
124
+ // Endpoints
125
+ if (doc.endpoints?.length) {
126
+ sections.push("");
127
+ sections.push(BASE_URL_INFO);
128
+ sections.push("## Endpoints");
129
+ for (const ep of doc.endpoints) {
130
+ sections.push("");
131
+ sections.push(formatEndpoint(ep, detailLevel));
132
+ }
133
+ }
134
+ // Patterns/Workflows
135
+ if (doc.patterns?.length) {
136
+ sections.push("");
137
+ sections.push("## Workflows");
138
+ for (const pattern of doc.patterns) {
139
+ sections.push("");
140
+ sections.push(formatPattern(pattern));
141
+ }
142
+ }
143
+ // Examples
144
+ if ((detailLevel === "detailed" || detailLevel === "examples") && doc.examples?.length) {
145
+ sections.push("");
146
+ sections.push("## Examples");
147
+ for (const ex of doc.examples) {
148
+ sections.push("");
149
+ sections.push(formatExample(ex));
150
+ }
151
+ }
152
+ // Schemas
153
+ if (includeSchemas && doc.schemas && Object.keys(doc.schemas).length > 0) {
154
+ sections.push("");
155
+ sections.push("## Schemas");
156
+ sections.push("");
157
+ sections.push("```json");
158
+ sections.push(JSON.stringify(doc.schemas, null, 2));
159
+ sections.push("```");
160
+ }
161
+ // Related topics
162
+ if (doc.related_topics?.length) {
163
+ sections.push("");
164
+ sections.push("## Related Topics");
165
+ sections.push(`Use \`api_docs\` with topic: ${doc.related_topics.join(", ")}`);
166
+ }
167
+ return sections.join("\n");
168
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Xano Meta API Documentation Index
3
+ *
4
+ * This module exports all documentation topics and provides
5
+ * the api_docs tool handler for the MCP server.
6
+ */
7
+ import type { TopicDoc, ApiDocsArgs } from "./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 api_docs tool
22
+ */
23
+ export declare function handleApiDocs(args: ApiDocsArgs): string;
24
+ /**
25
+ * Tool definition for MCP server
26
+ */
27
+ export declare const apiDocsToolDefinition: {
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
+ };
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Xano Meta API Documentation Index
3
+ *
4
+ * This module exports all documentation topics and provides
5
+ * the 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 { authenticationDoc } from "./topics/authentication.js";
11
+ import { workspaceDoc } from "./topics/workspace.js";
12
+ import { apigroupDoc } from "./topics/apigroup.js";
13
+ import { apiDoc } from "./topics/api.js";
14
+ import { tableDoc } from "./topics/table.js";
15
+ import { functionDoc } from "./topics/function.js";
16
+ import { taskDoc } from "./topics/task.js";
17
+ import { agentDoc } from "./topics/agent.js";
18
+ import { toolDoc } from "./topics/tool.js";
19
+ import { mcpServerDoc } from "./topics/mcp_server.js";
20
+ import { middlewareDoc } from "./topics/middleware.js";
21
+ import { branchDoc } from "./topics/branch.js";
22
+ import { realtimeDoc } from "./topics/realtime.js";
23
+ import { fileDoc } from "./topics/file.js";
24
+ import { historyDoc } from "./topics/history.js";
25
+ import { workflowsDoc } from "./topics/workflows.js";
26
+ /**
27
+ * All available documentation topics
28
+ */
29
+ export const topics = {
30
+ start: startDoc,
31
+ authentication: authenticationDoc,
32
+ workspace: workspaceDoc,
33
+ apigroup: apigroupDoc,
34
+ api: apiDoc,
35
+ table: tableDoc,
36
+ function: functionDoc,
37
+ task: taskDoc,
38
+ agent: agentDoc,
39
+ tool: toolDoc,
40
+ mcp_server: mcpServerDoc,
41
+ middleware: middlewareDoc,
42
+ branch: branchDoc,
43
+ realtime: realtimeDoc,
44
+ file: fileDoc,
45
+ history: historyDoc,
46
+ workflows: workflowsDoc,
47
+ };
48
+ /**
49
+ * Get list of all available topic names
50
+ */
51
+ export function getTopicNames() {
52
+ return Object.keys(topics);
53
+ }
54
+ /**
55
+ * Get topic descriptions for tool documentation
56
+ */
57
+ export function getTopicDescriptions() {
58
+ return Object.entries(topics)
59
+ .map(([key, doc]) => `- ${key}: ${doc.title}`)
60
+ .join("\n");
61
+ }
62
+ /**
63
+ * Handler for the api_docs tool
64
+ */
65
+ export function handleApiDocs(args) {
66
+ const { topic, detail_level = "detailed", include_schemas = true } = args;
67
+ // Validate topic
68
+ if (!topics[topic]) {
69
+ const available = getTopicNames().join(", ");
70
+ return `Error: Unknown topic "${topic}".\n\nAvailable topics: ${available}`;
71
+ }
72
+ const doc = topics[topic];
73
+ return formatDocumentation(doc, detail_level, include_schemas);
74
+ }
75
+ /**
76
+ * Tool definition for MCP server
77
+ */
78
+ export const apiDocsToolDefinition = {
79
+ name: "api_docs",
80
+ description: `Get documentation for Xano's Meta API. Use this to understand how to programmatically manage Xano workspaces, databases, APIs, functions, agents, and more.
81
+
82
+ ## Topics
83
+ ${getTopicDescriptions()}
84
+
85
+ ## Usage
86
+ - Start with "start" topic for overview and getting started
87
+ - Use "workflows" for step-by-step guides
88
+ - Use specific topics (workspace, table, api, etc.) for detailed endpoint docs`,
89
+ inputSchema: {
90
+ type: "object",
91
+ properties: {
92
+ topic: {
93
+ type: "string",
94
+ enum: getTopicNames(),
95
+ description: "Documentation topic to retrieve",
96
+ },
97
+ detail_level: {
98
+ type: "string",
99
+ enum: ["overview", "detailed", "examples"],
100
+ default: "detailed",
101
+ description: "Level of detail: overview (brief), detailed (full docs), examples (with code examples)",
102
+ },
103
+ include_schemas: {
104
+ type: "boolean",
105
+ default: true,
106
+ description: "Include JSON schemas for requests/responses",
107
+ },
108
+ },
109
+ required: ["topic"],
110
+ },
111
+ };
@@ -0,0 +1,2 @@
1
+ import type { TopicDoc } from "../types.js";
2
+ export declare const agentDoc: TopicDoc;
@@ -0,0 +1,142 @@
1
+ export const agentDoc = {
2
+ topic: "agent",
3
+ title: "AI Agent Management",
4
+ description: `Agents are AI-powered automation units that use LLMs (like Claude) to make decisions and execute multi-step workflows.
5
+
6
+ ## Key Concepts
7
+ - Agents use LLMs for reasoning and decision-making
8
+ - Can call tools to perform actions
9
+ - Support multiple LLM providers (Anthropic, OpenAI, etc.)
10
+ - Configurable system prompts, temperature, max steps
11
+ - Can have triggers that invoke them automatically
12
+
13
+ ## LLM Configuration
14
+ - Type: Provider (e.g., "anthropic")
15
+ - Model: Specific model (e.g., "claude-4-sonnet-20250514")
16
+ - System prompt: Instructions for the agent
17
+ - Temperature: Creativity level (0-1)
18
+ - Max steps: Maximum reasoning iterations
19
+ - Reasoning: Enable/disable chain-of-thought`,
20
+ ai_hints: `- Create tools first, then create agent and associate tools
21
+ - System prompt is critical for agent behavior
22
+ - Lower temperature = more deterministic responses
23
+ - Max steps limits runaway agent loops
24
+ - Use triggers to invoke agents on events (table changes, etc.)`,
25
+ endpoints: [
26
+ {
27
+ method: "GET",
28
+ path: "/workspace/{workspace_id}/agent",
29
+ tool_name: "listAgents",
30
+ description: "List all AI agents in a workspace.",
31
+ parameters: [
32
+ { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
33
+ { name: "page", type: "integer", default: 1, description: "Page number" },
34
+ { name: "per_page", type: "integer", default: 50, description: "Items per page" },
35
+ { name: "search", type: "string", description: "Search by agent name" },
36
+ { name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript definition" },
37
+ { name: "include_draft", type: "boolean", default: false, description: "Include draft versions" }
38
+ ]
39
+ },
40
+ {
41
+ method: "GET",
42
+ path: "/workspace/{workspace_id}/agent/{agent_id}",
43
+ tool_name: "getAgent",
44
+ description: "Get details of a specific AI agent.",
45
+ parameters: [
46
+ { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
47
+ { name: "agent_id", type: "integer", required: true, in: "path", description: "Agent ID" },
48
+ { name: "include_xanoscript", type: "boolean", default: false, description: "Include XanoScript definition" },
49
+ { name: "include_draft", type: "boolean", default: false, description: "Include draft version" }
50
+ ]
51
+ },
52
+ {
53
+ method: "POST",
54
+ path: "/workspace/{workspace_id}/agent",
55
+ tool_name: "createAgent",
56
+ description: "Create a new AI agent with LLM configuration.",
57
+ parameters: [
58
+ { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" }
59
+ ],
60
+ request_body: {
61
+ type: "application/json",
62
+ properties: {
63
+ name: { type: "string", description: "Agent name", required: true },
64
+ description: { type: "string", description: "Agent description" },
65
+ xanoscript: { type: "string", description: "XanoScript agent definition", required: true }
66
+ }
67
+ },
68
+ example: {
69
+ method: "POST",
70
+ path: "/workspace/1/agent",
71
+ body: {
72
+ name: "support_agent",
73
+ description: "Customer support AI agent",
74
+ xanoscript: `agent support_agent {
75
+ llm {
76
+ type = "anthropic"
77
+ model = "claude-4-sonnet-20250514"
78
+ system_prompt = "You are a helpful customer support agent."
79
+ max_steps = 10
80
+ temperature = 0.3
81
+ }
82
+ tools = [lookup_order, update_ticket]
83
+ }`
84
+ }
85
+ }
86
+ },
87
+ {
88
+ method: "PUT",
89
+ path: "/workspace/{workspace_id}/agent/{agent_id}",
90
+ tool_name: "updateAgent",
91
+ description: "Update an existing AI agent.",
92
+ parameters: [
93
+ { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
94
+ { name: "agent_id", type: "integer", required: true, in: "path", description: "Agent ID" },
95
+ { name: "publish", type: "boolean", default: true, description: "Publish changes immediately" }
96
+ ],
97
+ request_body: {
98
+ type: "application/json",
99
+ properties: {
100
+ name: { type: "string", description: "Agent name" },
101
+ description: { type: "string", description: "Agent description" },
102
+ xanoscript: { type: "string", description: "XanoScript agent definition" }
103
+ }
104
+ }
105
+ },
106
+ {
107
+ method: "DELETE",
108
+ path: "/workspace/{workspace_id}/agent/{agent_id}",
109
+ tool_name: "deleteAgent",
110
+ description: "Delete an AI agent.",
111
+ parameters: [
112
+ { name: "workspace_id", type: "integer", required: true, in: "path", description: "Workspace ID" },
113
+ { name: "agent_id", type: "integer", required: true, in: "path", description: "Agent ID" }
114
+ ]
115
+ }
116
+ ],
117
+ schemas: {
118
+ Agent: {
119
+ type: "object",
120
+ properties: {
121
+ id: { type: "integer" },
122
+ name: { type: "string" },
123
+ description: { type: "string" },
124
+ llm: {
125
+ type: "object",
126
+ properties: {
127
+ type: { type: "string", description: "LLM provider (anthropic, openai, etc.)" },
128
+ model: { type: "string", description: "Model identifier" },
129
+ system_prompt: { type: "string" },
130
+ max_steps: { type: "integer" },
131
+ temperature: { type: "number" },
132
+ reasoning: { type: "boolean" }
133
+ }
134
+ },
135
+ tools: { type: "array", items: { type: "string" } },
136
+ created_at: { type: "string", format: "date-time" },
137
+ updated_at: { type: "string", format: "date-time" }
138
+ }
139
+ }
140
+ },
141
+ related_topics: ["tool", "mcp_server", "function"]
142
+ };
@@ -0,0 +1,2 @@
1
+ import type { TopicDoc } from "../types.js";
2
+ export declare const apiDoc: TopicDoc;