@xano/developer-mcp 1.0.31 → 1.0.32
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 +169 -6
- package/dist/index.d.ts +8 -0
- package/dist/index.js +14 -286
- package/dist/lib.d.ts +53 -0
- package/dist/lib.js +71 -0
- package/dist/tools/cli_docs.d.ts +40 -0
- package/dist/tools/cli_docs.js +68 -0
- package/dist/tools/index.d.ts +91 -0
- package/dist/tools/index.js +104 -0
- package/dist/tools/mcp_version.d.ts +45 -0
- package/dist/tools/mcp_version.js +94 -0
- package/dist/tools/meta_api_docs.d.ts +41 -0
- package/dist/tools/meta_api_docs.js +69 -0
- package/dist/tools/run_api_docs.d.ts +46 -0
- package/dist/tools/run_api_docs.js +69 -0
- package/dist/tools/types.d.ts +18 -0
- package/dist/tools/types.js +17 -0
- package/dist/tools/validate_xanoscript.d.ts +68 -0
- package/dist/tools/validate_xanoscript.js +114 -0
- package/dist/tools/xanoscript_docs.d.ts +72 -0
- package/dist/tools/xanoscript_docs.js +129 -0
- package/dist/xanoscript_docs/streaming.md +113 -91
- package/dist/xanoscript_docs/tasks.md +15 -7
- package/package.json +22 -3
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
|
-
An MCP server that gives AI assistants superpowers for developing on [Xano](https://xano.com) — complete with documentation, code validation, and workflow guides.
|
|
18
|
+
An MCP server and standalone library that gives AI assistants superpowers for developing on [Xano](https://xano.com) — complete with documentation, code validation, and workflow guides. Use it as an MCP server or import the tools directly in your own applications.
|
|
19
19
|
|
|
20
20
|
> 💡 **What's Xano?** The fastest way to build a scalable backend for your app — no code required. Build APIs, manage databases, and deploy instantly.
|
|
21
21
|
|
|
@@ -145,6 +145,159 @@ claude mcp add xano-developer node /path/to/xano-developer-mcp/dist/index.js
|
|
|
145
145
|
}
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
+
## Library Usage
|
|
149
|
+
|
|
150
|
+
In addition to using this package as an MCP server, you can import and use the tools directly in your own applications.
|
|
151
|
+
|
|
152
|
+
### Installation
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
npm install @xano/developer-mcp
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Importing Tools
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
import {
|
|
162
|
+
validateXanoscript,
|
|
163
|
+
xanoscriptDocs,
|
|
164
|
+
metaApiDocs,
|
|
165
|
+
runApiDocs,
|
|
166
|
+
cliDocs,
|
|
167
|
+
mcpVersion
|
|
168
|
+
} from '@xano/developer-mcp';
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Validate XanoScript Code
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
import { validateXanoscript } from '@xano/developer-mcp';
|
|
175
|
+
|
|
176
|
+
const result = validateXanoscript({ code: 'var:result = 1 + 2' });
|
|
177
|
+
|
|
178
|
+
if (result.valid) {
|
|
179
|
+
console.log('Code is valid!');
|
|
180
|
+
} else {
|
|
181
|
+
console.log('Validation errors:');
|
|
182
|
+
result.errors.forEach(error => {
|
|
183
|
+
console.log(` Line ${error.range.start.line + 1}: ${error.message}`);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Get XanoScript Documentation
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
import { xanoscriptDocs } from '@xano/developer-mcp';
|
|
192
|
+
|
|
193
|
+
// Get overview (README)
|
|
194
|
+
const overview = xanoscriptDocs();
|
|
195
|
+
console.log(overview.documentation);
|
|
196
|
+
|
|
197
|
+
// Get specific topic
|
|
198
|
+
const syntaxDocs = xanoscriptDocs({ topic: 'syntax' });
|
|
199
|
+
|
|
200
|
+
// Get context-aware docs for a file path
|
|
201
|
+
const apiDocs = xanoscriptDocs({ file_path: 'apis/users/create.xs' });
|
|
202
|
+
|
|
203
|
+
// Get compact quick reference
|
|
204
|
+
const quickRef = xanoscriptDocs({ topic: 'database', mode: 'quick_reference' });
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Get Meta API Documentation
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
import { metaApiDocs } from '@xano/developer-mcp';
|
|
211
|
+
|
|
212
|
+
// Get overview
|
|
213
|
+
const overview = metaApiDocs({ topic: 'start' });
|
|
214
|
+
|
|
215
|
+
// Get detailed documentation with examples
|
|
216
|
+
const workspaceDocs = metaApiDocs({
|
|
217
|
+
topic: 'workspace',
|
|
218
|
+
detail_level: 'examples',
|
|
219
|
+
include_schemas: true
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
console.log(workspaceDocs.documentation);
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Get Run API Documentation
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
import { runApiDocs } from '@xano/developer-mcp';
|
|
229
|
+
|
|
230
|
+
const sessionDocs = runApiDocs({
|
|
231
|
+
topic: 'session',
|
|
232
|
+
detail_level: 'detailed'
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
console.log(sessionDocs.documentation);
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Get CLI Documentation
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
import { cliDocs } from '@xano/developer-mcp';
|
|
242
|
+
|
|
243
|
+
const cliSetup = cliDocs({ topic: 'start' });
|
|
244
|
+
console.log(cliSetup.documentation);
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Get Package Version
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
import { mcpVersion } from '@xano/developer-mcp';
|
|
251
|
+
|
|
252
|
+
const { version } = mcpVersion();
|
|
253
|
+
console.log(`Using version ${version}`);
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Available Exports
|
|
257
|
+
|
|
258
|
+
| Export | Description |
|
|
259
|
+
|--------|-------------|
|
|
260
|
+
| `validateXanoscript` | Validate XanoScript code and get detailed error information |
|
|
261
|
+
| `xanoscriptDocs` | Get XanoScript language documentation |
|
|
262
|
+
| `metaApiDocs` | Get Meta API documentation |
|
|
263
|
+
| `runApiDocs` | Get Run API documentation |
|
|
264
|
+
| `cliDocs` | Get CLI documentation |
|
|
265
|
+
| `mcpVersion` | Get the package version |
|
|
266
|
+
| `toolDefinitions` | MCP tool definitions (for building custom MCP servers) |
|
|
267
|
+
| `handleTool` | Tool dispatcher function (for building custom MCP servers) |
|
|
268
|
+
|
|
269
|
+
### TypeScript Support
|
|
270
|
+
|
|
271
|
+
Full TypeScript support with exported types:
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
import type {
|
|
275
|
+
ValidateXanoscriptArgs,
|
|
276
|
+
ValidationResult,
|
|
277
|
+
ParserDiagnostic,
|
|
278
|
+
XanoscriptDocsArgs,
|
|
279
|
+
MetaApiDocsArgs,
|
|
280
|
+
RunApiDocsArgs,
|
|
281
|
+
CliDocsArgs,
|
|
282
|
+
ToolResult
|
|
283
|
+
} from '@xano/developer-mcp';
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Package Entry Points
|
|
287
|
+
|
|
288
|
+
The package provides multiple entry points:
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
// Main library entry (recommended)
|
|
292
|
+
import { validateXanoscript } from '@xano/developer-mcp';
|
|
293
|
+
|
|
294
|
+
// Tools module directly
|
|
295
|
+
import { validateXanoscript } from '@xano/developer-mcp/tools';
|
|
296
|
+
|
|
297
|
+
// Server module (for extending the MCP server)
|
|
298
|
+
import '@xano/developer-mcp/server';
|
|
299
|
+
```
|
|
300
|
+
|
|
148
301
|
## Available Tools
|
|
149
302
|
|
|
150
303
|
### 1. `validate_xanoscript`
|
|
@@ -407,12 +560,22 @@ The server also exposes XanoScript documentation as MCP resources for direct acc
|
|
|
407
560
|
```
|
|
408
561
|
xano-developer-mcp/
|
|
409
562
|
├── src/
|
|
410
|
-
│ ├── index.ts #
|
|
563
|
+
│ ├── index.ts # MCP server entry point
|
|
564
|
+
│ ├── lib.ts # Library entry point (for npm imports)
|
|
411
565
|
│ ├── xanoscript.ts # XanoScript documentation logic
|
|
412
566
|
│ ├── xanoscript.test.ts # Tests for xanoscript module
|
|
413
567
|
│ ├── xanoscript-language-server.d.ts # TypeScript declarations
|
|
568
|
+
│ ├── tools/ # Standalone tool modules
|
|
569
|
+
│ │ ├── index.ts # Unified tool exports
|
|
570
|
+
│ │ ├── types.ts # Common types (ToolResult)
|
|
571
|
+
│ │ ├── validate_xanoscript.ts # XanoScript validation tool
|
|
572
|
+
│ │ ├── xanoscript_docs.ts # XanoScript docs tool
|
|
573
|
+
│ │ ├── mcp_version.ts # Version tool
|
|
574
|
+
│ │ ├── meta_api_docs.ts # Meta API docs tool wrapper
|
|
575
|
+
│ │ ├── run_api_docs.ts # Run API docs tool wrapper
|
|
576
|
+
│ │ └── cli_docs.ts # CLI docs tool wrapper
|
|
414
577
|
│ ├── meta_api_docs/ # Meta API documentation
|
|
415
|
-
│ │ ├── index.ts # API docs
|
|
578
|
+
│ │ ├── index.ts # API docs handler
|
|
416
579
|
│ │ ├── index.test.ts # Tests for index
|
|
417
580
|
│ │ ├── types.ts # Type definitions
|
|
418
581
|
│ │ ├── types.test.ts # Tests for types
|
|
@@ -420,13 +583,13 @@ xano-developer-mcp/
|
|
|
420
583
|
│ │ ├── format.test.ts # Tests for formatter
|
|
421
584
|
│ │ └── topics/ # Individual topic modules
|
|
422
585
|
│ ├── run_api_docs/ # Run API documentation
|
|
423
|
-
│ │ ├── index.ts # Run API
|
|
586
|
+
│ │ ├── index.ts # Run API handler
|
|
424
587
|
│ │ ├── index.test.ts # Tests for index
|
|
425
588
|
│ │ ├── format.ts # Documentation formatter
|
|
426
589
|
│ │ ├── format.test.ts # Tests for formatter
|
|
427
590
|
│ │ └── topics/ # Individual topic modules
|
|
428
591
|
│ ├── cli_docs/ # Xano CLI documentation
|
|
429
|
-
│ │ ├── index.ts # CLI docs
|
|
592
|
+
│ │ ├── index.ts # CLI docs handler
|
|
430
593
|
│ │ ├── types.ts # Type definitions
|
|
431
594
|
│ │ ├── format.ts # Documentation formatter
|
|
432
595
|
│ │ └── topics/ # Individual topic modules
|
|
@@ -486,7 +649,7 @@ Xano Developer MCP Server
|
|
|
486
649
|
|
|
487
650
|
## Authentication
|
|
488
651
|
|
|
489
|
-
The MCP server
|
|
652
|
+
The MCP server and library functions do not require authentication. However, when using the documented APIs (Meta API, Run API) to interact with actual Xano services, you will need appropriate Xano API credentials. See the `meta_api_docs` and `run_api_docs` tools for authentication details.
|
|
490
653
|
|
|
491
654
|
## Development
|
|
492
655
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Xano Developer MCP Server
|
|
4
|
+
*
|
|
5
|
+
* This is the MCP server entry point. For library usage, import from the package root:
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { validateXanoscript, xanoscriptDocs } from '@xano/developer-mcp';
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
2
10
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Xano Developer MCP Server
|
|
4
|
+
*
|
|
5
|
+
* This is the MCP server entry point. For library usage, import from the package root:
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { validateXanoscript, xanoscriptDocs } from '@xano/developer-mcp';
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
2
10
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
11
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
12
|
import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
13
|
import { readFileSync } from "fs";
|
|
6
14
|
import { fileURLToPath } from "url";
|
|
7
15
|
import { dirname, join } from "path";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { metaApiDocsToolDefinition, handleMetaApiDocs } from "./meta_api_docs/index.js";
|
|
11
|
-
import { runApiDocsToolDefinition, handleRunApiDocs } from "./run_api_docs/index.js";
|
|
12
|
-
import { cliDocsToolDefinition, handleCliDocs } from "./cli_docs/index.js";
|
|
13
|
-
import { XANOSCRIPT_DOCS_V2, readXanoscriptDocsV2, getXanoscriptDocsVersion, getTopicDescriptions, } from "./xanoscript.js";
|
|
16
|
+
import { XANOSCRIPT_DOCS_V2, getXanoscriptDocsVersion } from "./xanoscript.js";
|
|
17
|
+
import { toolDefinitions, handleTool, toMcpResponse, } from "./tools/index.js";
|
|
14
18
|
const __filename = fileURLToPath(import.meta.url);
|
|
15
19
|
const __dirname = dirname(__filename);
|
|
16
20
|
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
|
|
@@ -91,288 +95,12 @@ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
|
91
95
|
// Tool Handlers
|
|
92
96
|
// =============================================================================
|
|
93
97
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
94
|
-
return {
|
|
95
|
-
tools: [
|
|
96
|
-
{
|
|
97
|
-
name: "validate_xanoscript",
|
|
98
|
-
description: "Validate XanoScript code for syntax errors. Returns a list of errors with line/column positions, or confirms the code is valid. The language server auto-detects the object type from the code syntax.",
|
|
99
|
-
inputSchema: {
|
|
100
|
-
type: "object",
|
|
101
|
-
properties: {
|
|
102
|
-
code: {
|
|
103
|
-
type: "string",
|
|
104
|
-
description: "The XanoScript code to validate",
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
required: ["code"],
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
name: "xanoscript_docs",
|
|
112
|
-
description: "Get XanoScript programming language documentation for AI code generation. " +
|
|
113
|
-
"Call without parameters for overview (README). " +
|
|
114
|
-
"Use 'topic' for specific documentation, or 'file_path' for context-aware docs based on the file you're editing. " +
|
|
115
|
-
"Use mode='quick_reference' for compact syntax cheatsheet (recommended for context efficiency).",
|
|
116
|
-
inputSchema: {
|
|
117
|
-
type: "object",
|
|
118
|
-
properties: {
|
|
119
|
-
topic: {
|
|
120
|
-
type: "string",
|
|
121
|
-
description: "Documentation topic. Available: " + getTopicDescriptions(),
|
|
122
|
-
},
|
|
123
|
-
file_path: {
|
|
124
|
-
type: "string",
|
|
125
|
-
description: "File path being edited (e.g., 'apis/users/create.xs', 'functions/utils/format.xs'). " +
|
|
126
|
-
"Returns all relevant docs based on file type using applyTo pattern matching.",
|
|
127
|
-
},
|
|
128
|
-
mode: {
|
|
129
|
-
type: "string",
|
|
130
|
-
enum: ["full", "quick_reference"],
|
|
131
|
-
description: "full = complete documentation, quick_reference = compact Quick Reference sections only. " +
|
|
132
|
-
"Use quick_reference for smaller context window usage.",
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
required: [],
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: "mcp_version",
|
|
140
|
-
description: "Get the current version of the Xano Developer MCP server. " +
|
|
141
|
-
"Returns the version string from package.json.",
|
|
142
|
-
inputSchema: {
|
|
143
|
-
type: "object",
|
|
144
|
-
properties: {},
|
|
145
|
-
required: [],
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
metaApiDocsToolDefinition,
|
|
149
|
-
runApiDocsToolDefinition,
|
|
150
|
-
cliDocsToolDefinition,
|
|
151
|
-
],
|
|
152
|
-
};
|
|
98
|
+
return { tools: toolDefinitions };
|
|
153
99
|
});
|
|
154
100
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return {
|
|
159
|
-
content: [
|
|
160
|
-
{
|
|
161
|
-
type: "text",
|
|
162
|
-
text: "Error: 'code' parameter is required",
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
isError: true,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
try {
|
|
169
|
-
const text = args.code;
|
|
170
|
-
const scheme = getSchemeFromContent(text);
|
|
171
|
-
const parser = xanoscriptParser(text, scheme);
|
|
172
|
-
if (parser.errors.length === 0) {
|
|
173
|
-
return {
|
|
174
|
-
content: [
|
|
175
|
-
{
|
|
176
|
-
type: "text",
|
|
177
|
-
text: "XanoScript is valid. No syntax errors found.",
|
|
178
|
-
},
|
|
179
|
-
],
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
const diagnostics = parser.errors.map((error) => {
|
|
183
|
-
const startOffset = error.token?.startOffset ?? 0;
|
|
184
|
-
const endOffset = error.token?.endOffset ?? 5;
|
|
185
|
-
const lines = text.substring(0, startOffset).split("\n");
|
|
186
|
-
const line = lines.length - 1;
|
|
187
|
-
const character = lines[lines.length - 1].length;
|
|
188
|
-
const endLines = text.substring(0, endOffset + 1).split("\n");
|
|
189
|
-
const endLine = endLines.length - 1;
|
|
190
|
-
const endCharacter = endLines[endLines.length - 1].length;
|
|
191
|
-
return {
|
|
192
|
-
range: {
|
|
193
|
-
start: { line, character },
|
|
194
|
-
end: { line: endLine, character: endCharacter },
|
|
195
|
-
},
|
|
196
|
-
message: error.message,
|
|
197
|
-
source: error.name || "XanoScript Parser",
|
|
198
|
-
};
|
|
199
|
-
});
|
|
200
|
-
const errorMessages = diagnostics.map((d, i) => {
|
|
201
|
-
const location = `Line ${d.range.start.line + 1}, Column ${d.range.start.character + 1}`;
|
|
202
|
-
return `${i + 1}. [${location}] ${d.message}`;
|
|
203
|
-
});
|
|
204
|
-
return {
|
|
205
|
-
content: [
|
|
206
|
-
{
|
|
207
|
-
type: "text",
|
|
208
|
-
text: `Found ${diagnostics.length} error(s):\n\n${errorMessages.join("\n")}`,
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
isError: true,
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
catch (error) {
|
|
215
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
216
|
-
return {
|
|
217
|
-
content: [
|
|
218
|
-
{
|
|
219
|
-
type: "text",
|
|
220
|
-
text: `Validation error: ${errorMessage}`,
|
|
221
|
-
},
|
|
222
|
-
],
|
|
223
|
-
isError: true,
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
if (request.params.name === "xanoscript_docs") {
|
|
228
|
-
const args = request.params.arguments;
|
|
229
|
-
const documentation = readXanoscriptDocsV2(XANOSCRIPT_DOCS_PATH, args);
|
|
230
|
-
return {
|
|
231
|
-
content: [
|
|
232
|
-
{
|
|
233
|
-
type: "text",
|
|
234
|
-
text: documentation,
|
|
235
|
-
},
|
|
236
|
-
],
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
if (request.params.name === "mcp_version") {
|
|
240
|
-
return {
|
|
241
|
-
content: [
|
|
242
|
-
{
|
|
243
|
-
type: "text",
|
|
244
|
-
text: SERVER_VERSION,
|
|
245
|
-
},
|
|
246
|
-
],
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
if (request.params.name === "meta_api_docs") {
|
|
250
|
-
const args = request.params.arguments;
|
|
251
|
-
if (!args?.topic) {
|
|
252
|
-
return {
|
|
253
|
-
content: [
|
|
254
|
-
{
|
|
255
|
-
type: "text",
|
|
256
|
-
text: "Error: 'topic' parameter is required. Use meta_api_docs with topic='start' for overview.",
|
|
257
|
-
},
|
|
258
|
-
],
|
|
259
|
-
isError: true,
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
try {
|
|
263
|
-
const documentation = handleMetaApiDocs({
|
|
264
|
-
topic: args.topic,
|
|
265
|
-
detail_level: args.detail_level,
|
|
266
|
-
include_schemas: args.include_schemas,
|
|
267
|
-
});
|
|
268
|
-
return {
|
|
269
|
-
content: [
|
|
270
|
-
{
|
|
271
|
-
type: "text",
|
|
272
|
-
text: documentation,
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
catch (error) {
|
|
278
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
279
|
-
return {
|
|
280
|
-
content: [
|
|
281
|
-
{
|
|
282
|
-
type: "text",
|
|
283
|
-
text: `Error retrieving API documentation: ${errorMessage}`,
|
|
284
|
-
},
|
|
285
|
-
],
|
|
286
|
-
isError: true,
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
if (request.params.name === "run_api_docs") {
|
|
291
|
-
const args = request.params.arguments;
|
|
292
|
-
if (!args?.topic) {
|
|
293
|
-
return {
|
|
294
|
-
content: [
|
|
295
|
-
{
|
|
296
|
-
type: "text",
|
|
297
|
-
text: "Error: 'topic' parameter is required. Use run_api_docs with topic='start' for overview.",
|
|
298
|
-
},
|
|
299
|
-
],
|
|
300
|
-
isError: true,
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
try {
|
|
304
|
-
const documentation = handleRunApiDocs(args.topic, args.detail_level, args.include_schemas);
|
|
305
|
-
return {
|
|
306
|
-
content: [
|
|
307
|
-
{
|
|
308
|
-
type: "text",
|
|
309
|
-
text: documentation,
|
|
310
|
-
},
|
|
311
|
-
],
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
catch (error) {
|
|
315
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
316
|
-
return {
|
|
317
|
-
content: [
|
|
318
|
-
{
|
|
319
|
-
type: "text",
|
|
320
|
-
text: `Error retrieving Run API documentation: ${errorMessage}`,
|
|
321
|
-
},
|
|
322
|
-
],
|
|
323
|
-
isError: true,
|
|
324
|
-
};
|
|
325
|
-
}
|
|
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
|
-
}
|
|
367
|
-
return {
|
|
368
|
-
content: [
|
|
369
|
-
{
|
|
370
|
-
type: "text",
|
|
371
|
-
text: `Unknown tool: ${request.params.name}`,
|
|
372
|
-
},
|
|
373
|
-
],
|
|
374
|
-
isError: true,
|
|
375
|
-
};
|
|
101
|
+
const { name, arguments: args } = request.params;
|
|
102
|
+
const result = handleTool(name, args || {});
|
|
103
|
+
return toMcpResponse(result);
|
|
376
104
|
});
|
|
377
105
|
// =============================================================================
|
|
378
106
|
// Start Server
|
package/dist/lib.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @xano/developer-mcp Library Entry Point
|
|
3
|
+
*
|
|
4
|
+
* This module exports all tools for use as a standalone library.
|
|
5
|
+
* Use this when you want to use the Xano tools outside of the MCP context.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import {
|
|
10
|
+
* validateXanoscript,
|
|
11
|
+
* xanoscriptDocs,
|
|
12
|
+
* metaApiDocs,
|
|
13
|
+
* runApiDocs,
|
|
14
|
+
* cliDocs,
|
|
15
|
+
* mcpVersion
|
|
16
|
+
* } from '@xano/developer-mcp';
|
|
17
|
+
*
|
|
18
|
+
* // Validate XanoScript code
|
|
19
|
+
* const validation = validateXanoscript({ code: 'return 1 + 1' });
|
|
20
|
+
* if (validation.valid) {
|
|
21
|
+
* console.log('Code is valid!');
|
|
22
|
+
* } else {
|
|
23
|
+
* console.log('Errors:', validation.errors);
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* // Get XanoScript documentation
|
|
27
|
+
* const docs = xanoscriptDocs({ topic: 'syntax', mode: 'quick_reference' });
|
|
28
|
+
* console.log(docs.documentation);
|
|
29
|
+
*
|
|
30
|
+
* // Get Meta API documentation
|
|
31
|
+
* const apiDocs = metaApiDocs({ topic: 'workspace', detail_level: 'examples' });
|
|
32
|
+
* console.log(apiDocs.documentation);
|
|
33
|
+
*
|
|
34
|
+
* // Get CLI documentation
|
|
35
|
+
* const cliDocs = cliDocs({ topic: 'start' });
|
|
36
|
+
* console.log(cliDocs.documentation);
|
|
37
|
+
*
|
|
38
|
+
* // Get version
|
|
39
|
+
* const { version } = mcpVersion();
|
|
40
|
+
* console.log(`Version: ${version}`);
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @packageDocumentation
|
|
44
|
+
*/
|
|
45
|
+
export { validateXanoscript, type ValidateXanoscriptArgs, type ValidationResult, type ParserDiagnostic, } from "./tools/validate_xanoscript.js";
|
|
46
|
+
export { xanoscriptDocs, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult, } from "./tools/xanoscript_docs.js";
|
|
47
|
+
export { mcpVersion, getServerVersion, setServerVersion, type McpVersionResult, } from "./tools/mcp_version.js";
|
|
48
|
+
export { metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult, } from "./tools/meta_api_docs.js";
|
|
49
|
+
export { runApiDocs, runApiTopics, getRunApiTopicNames, getRunApiTopicDescriptions, type RunApiDocsArgs, type RunApiDocsResult, } from "./tools/run_api_docs.js";
|
|
50
|
+
export { cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult, } from "./tools/cli_docs.js";
|
|
51
|
+
export { type ToolResult, toMcpResponse } from "./tools/types.js";
|
|
52
|
+
export { XANOSCRIPT_DOCS_V2, readXanoscriptDocsV2, getDocsForFilePath, extractQuickReference, getXanoscriptDocsVersion, getTopicNames as getXanoscriptTopicNames, getTopicDescriptions as getXanoscriptTopicDescriptions, type DocConfig, } from "./xanoscript.js";
|
|
53
|
+
export { toolDefinitions, handleTool, validateXanoscriptToolDefinition, xanoscriptDocsToolDefinition, mcpVersionToolDefinition, metaApiDocsToolDefinition, runApiDocsToolDefinition, cliDocsToolDefinition, } from "./tools/index.js";
|
package/dist/lib.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @xano/developer-mcp Library Entry Point
|
|
3
|
+
*
|
|
4
|
+
* This module exports all tools for use as a standalone library.
|
|
5
|
+
* Use this when you want to use the Xano tools outside of the MCP context.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import {
|
|
10
|
+
* validateXanoscript,
|
|
11
|
+
* xanoscriptDocs,
|
|
12
|
+
* metaApiDocs,
|
|
13
|
+
* runApiDocs,
|
|
14
|
+
* cliDocs,
|
|
15
|
+
* mcpVersion
|
|
16
|
+
* } from '@xano/developer-mcp';
|
|
17
|
+
*
|
|
18
|
+
* // Validate XanoScript code
|
|
19
|
+
* const validation = validateXanoscript({ code: 'return 1 + 1' });
|
|
20
|
+
* if (validation.valid) {
|
|
21
|
+
* console.log('Code is valid!');
|
|
22
|
+
* } else {
|
|
23
|
+
* console.log('Errors:', validation.errors);
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* // Get XanoScript documentation
|
|
27
|
+
* const docs = xanoscriptDocs({ topic: 'syntax', mode: 'quick_reference' });
|
|
28
|
+
* console.log(docs.documentation);
|
|
29
|
+
*
|
|
30
|
+
* // Get Meta API documentation
|
|
31
|
+
* const apiDocs = metaApiDocs({ topic: 'workspace', detail_level: 'examples' });
|
|
32
|
+
* console.log(apiDocs.documentation);
|
|
33
|
+
*
|
|
34
|
+
* // Get CLI documentation
|
|
35
|
+
* const cliDocs = cliDocs({ topic: 'start' });
|
|
36
|
+
* console.log(cliDocs.documentation);
|
|
37
|
+
*
|
|
38
|
+
* // Get version
|
|
39
|
+
* const { version } = mcpVersion();
|
|
40
|
+
* console.log(`Version: ${version}`);
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @packageDocumentation
|
|
44
|
+
*/
|
|
45
|
+
// =============================================================================
|
|
46
|
+
// Main Tool Exports
|
|
47
|
+
// =============================================================================
|
|
48
|
+
// Validation
|
|
49
|
+
export { validateXanoscript, } from "./tools/validate_xanoscript.js";
|
|
50
|
+
// XanoScript Documentation
|
|
51
|
+
export { xanoscriptDocs, getXanoscriptDocsPath, setXanoscriptDocsPath, } from "./tools/xanoscript_docs.js";
|
|
52
|
+
// MCP Version
|
|
53
|
+
export { mcpVersion, getServerVersion, setServerVersion, } from "./tools/mcp_version.js";
|
|
54
|
+
// Meta API Documentation
|
|
55
|
+
export { metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, } from "./tools/meta_api_docs.js";
|
|
56
|
+
// Run API Documentation
|
|
57
|
+
export { runApiDocs, runApiTopics, getRunApiTopicNames, getRunApiTopicDescriptions, } from "./tools/run_api_docs.js";
|
|
58
|
+
// CLI Documentation
|
|
59
|
+
export { cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, } from "./tools/cli_docs.js";
|
|
60
|
+
// =============================================================================
|
|
61
|
+
// Utility Exports
|
|
62
|
+
// =============================================================================
|
|
63
|
+
export { toMcpResponse } from "./tools/types.js";
|
|
64
|
+
// =============================================================================
|
|
65
|
+
// XanoScript Core Exports (for advanced usage)
|
|
66
|
+
// =============================================================================
|
|
67
|
+
export { XANOSCRIPT_DOCS_V2, readXanoscriptDocsV2, getDocsForFilePath, extractQuickReference, getXanoscriptDocsVersion, getTopicNames as getXanoscriptTopicNames, getTopicDescriptions as getXanoscriptTopicDescriptions, } from "./xanoscript.js";
|
|
68
|
+
// =============================================================================
|
|
69
|
+
// MCP Tool Definitions (for building custom MCP servers)
|
|
70
|
+
// =============================================================================
|
|
71
|
+
export { toolDefinitions, handleTool, validateXanoscriptToolDefinition, xanoscriptDocsToolDefinition, mcpVersionToolDefinition, metaApiDocsToolDefinition, runApiDocsToolDefinition, cliDocsToolDefinition, } from "./tools/index.js";
|