@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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Documentation Tool
|
|
3
|
+
*
|
|
4
|
+
* Retrieves documentation for the Xano CLI.
|
|
5
|
+
* Re-exports from the cli_docs module with ToolResult support.
|
|
6
|
+
*/
|
|
7
|
+
import { cliDocsToolDefinition, topics, getTopicNames, getTopicDescriptions } from "../cli_docs/index.js";
|
|
8
|
+
import type { CliDocsArgs, DetailLevel, TopicDoc } from "../cli_docs/types.js";
|
|
9
|
+
import type { ToolResult } from "./types.js";
|
|
10
|
+
export { cliDocsToolDefinition, topics as cliTopics, getTopicNames as getCliTopicNames, getTopicDescriptions as getCliTopicDescriptions, };
|
|
11
|
+
export type { CliDocsArgs, DetailLevel, TopicDoc };
|
|
12
|
+
export interface CliDocsResult {
|
|
13
|
+
documentation: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get Xano CLI documentation.
|
|
17
|
+
*
|
|
18
|
+
* @param args - Documentation arguments
|
|
19
|
+
* @returns Documentation content
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { cliDocs } from '@xano/developer-mcp';
|
|
24
|
+
*
|
|
25
|
+
* // Get overview
|
|
26
|
+
* const overview = cliDocs({ topic: 'start' });
|
|
27
|
+
*
|
|
28
|
+
* // Get function documentation with examples
|
|
29
|
+
* const functionDocs = cliDocs({
|
|
30
|
+
* topic: 'function',
|
|
31
|
+
* detail_level: 'examples'
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function cliDocs(args: CliDocsArgs): CliDocsResult;
|
|
36
|
+
/**
|
|
37
|
+
* Get CLI documentation and return a ToolResult.
|
|
38
|
+
*/
|
|
39
|
+
export declare function cliDocsTool(args: CliDocsArgs): ToolResult;
|
|
40
|
+
export { cliDocsToolDefinition as toolDefinition };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Documentation Tool
|
|
3
|
+
*
|
|
4
|
+
* Retrieves documentation for the Xano CLI.
|
|
5
|
+
* Re-exports from the cli_docs module with ToolResult support.
|
|
6
|
+
*/
|
|
7
|
+
import { handleCliDocs as _handleCliDocs, cliDocsToolDefinition, topics, getTopicNames, getTopicDescriptions, } from "../cli_docs/index.js";
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Re-exports
|
|
10
|
+
// =============================================================================
|
|
11
|
+
export { cliDocsToolDefinition, topics as cliTopics, getTopicNames as getCliTopicNames, getTopicDescriptions as getCliTopicDescriptions, };
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Standalone Tool Function
|
|
14
|
+
// =============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Get Xano CLI documentation.
|
|
17
|
+
*
|
|
18
|
+
* @param args - Documentation arguments
|
|
19
|
+
* @returns Documentation content
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { cliDocs } from '@xano/developer-mcp';
|
|
24
|
+
*
|
|
25
|
+
* // Get overview
|
|
26
|
+
* const overview = cliDocs({ topic: 'start' });
|
|
27
|
+
*
|
|
28
|
+
* // Get function documentation with examples
|
|
29
|
+
* const functionDocs = cliDocs({
|
|
30
|
+
* topic: 'function',
|
|
31
|
+
* detail_level: 'examples'
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function cliDocs(args) {
|
|
36
|
+
if (!args?.topic) {
|
|
37
|
+
throw new Error("'topic' parameter is required. Use topic='start' for overview.");
|
|
38
|
+
}
|
|
39
|
+
const documentation = _handleCliDocs(args);
|
|
40
|
+
return { documentation };
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get CLI documentation and return a ToolResult.
|
|
44
|
+
*/
|
|
45
|
+
export function cliDocsTool(args) {
|
|
46
|
+
if (!args?.topic) {
|
|
47
|
+
return {
|
|
48
|
+
success: false,
|
|
49
|
+
error: "Error: 'topic' parameter is required. Use cli_docs with topic='start' for overview.",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
const result = cliDocs(args);
|
|
54
|
+
return {
|
|
55
|
+
success: true,
|
|
56
|
+
data: result.documentation,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
61
|
+
return {
|
|
62
|
+
success: false,
|
|
63
|
+
error: `Error retrieving CLI documentation: ${errorMessage}`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Re-export tool definition for MCP
|
|
68
|
+
export { cliDocsToolDefinition as toolDefinition };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Xano Developer MCP Tools
|
|
3
|
+
*
|
|
4
|
+
* This module exports all tools for both MCP server usage and standalone library usage.
|
|
5
|
+
*
|
|
6
|
+
* @example MCP Server Usage (internal)
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { toolDefinitions, handleTool } from './tools/index.js';
|
|
9
|
+
*
|
|
10
|
+
* // Register tools with MCP server
|
|
11
|
+
* server.setRequestHandler(ListToolsRequestSchema, () => ({
|
|
12
|
+
* tools: toolDefinitions
|
|
13
|
+
* }));
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example Library Usage (external)
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {
|
|
19
|
+
* validateXanoscript,
|
|
20
|
+
* xanoscriptDocs,
|
|
21
|
+
* metaApiDocs,
|
|
22
|
+
* runApiDocs,
|
|
23
|
+
* cliDocs,
|
|
24
|
+
* mcpVersion
|
|
25
|
+
* } from '@xano/developer-mcp';
|
|
26
|
+
*
|
|
27
|
+
* // Use tools directly
|
|
28
|
+
* const result = validateXanoscript({ code: 'return 1 + 1' });
|
|
29
|
+
* const docs = xanoscriptDocs({ topic: 'syntax' });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import { validateXanoscript, validateXanoscriptTool, validateXanoscriptToolDefinition, type ValidateXanoscriptArgs, type ValidationResult, type ParserDiagnostic } from "./validate_xanoscript.js";
|
|
33
|
+
import { xanoscriptDocs, xanoscriptDocsTool, xanoscriptDocsToolDefinition, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult } from "./xanoscript_docs.js";
|
|
34
|
+
import { mcpVersion, mcpVersionTool, mcpVersionToolDefinition, getServerVersion, setServerVersion, type McpVersionResult } from "./mcp_version.js";
|
|
35
|
+
import { metaApiDocs, metaApiDocsTool, metaApiDocsToolDefinition, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult } from "./meta_api_docs.js";
|
|
36
|
+
import { runApiDocs, runApiDocsTool, runApiDocsToolDefinition, runApiTopics, getRunApiTopicNames, getRunApiTopicDescriptions, type RunApiDocsArgs, type RunApiDocsResult } from "./run_api_docs.js";
|
|
37
|
+
import { cliDocs, cliDocsTool, cliDocsToolDefinition, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult } from "./cli_docs.js";
|
|
38
|
+
import { type ToolResult, toMcpResponse } from "./types.js";
|
|
39
|
+
export { validateXanoscript, type ValidateXanoscriptArgs, type ValidationResult, type ParserDiagnostic, xanoscriptDocs, getXanoscriptDocsPath, setXanoscriptDocsPath, type XanoscriptDocsArgs, type XanoscriptDocsResult, mcpVersion, getServerVersion, setServerVersion, type McpVersionResult, metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, type MetaApiDocsArgs, type MetaApiDocsResult, runApiDocs, runApiTopics, getRunApiTopicNames, getRunApiTopicDescriptions, type RunApiDocsArgs, type RunApiDocsResult, cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult, type ToolResult, toMcpResponse, };
|
|
40
|
+
export { validateXanoscriptTool, xanoscriptDocsTool, mcpVersionTool, metaApiDocsTool, runApiDocsTool, cliDocsTool, };
|
|
41
|
+
export { validateXanoscriptToolDefinition, xanoscriptDocsToolDefinition, mcpVersionToolDefinition, metaApiDocsToolDefinition, runApiDocsToolDefinition, cliDocsToolDefinition, };
|
|
42
|
+
/**
|
|
43
|
+
* All tool definitions for MCP server registration
|
|
44
|
+
*/
|
|
45
|
+
export declare const toolDefinitions: ({
|
|
46
|
+
name: string;
|
|
47
|
+
description: string;
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: string;
|
|
50
|
+
properties: {
|
|
51
|
+
code: {
|
|
52
|
+
type: string;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
required: string[];
|
|
57
|
+
};
|
|
58
|
+
} | {
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: string;
|
|
63
|
+
properties: {};
|
|
64
|
+
required: never[];
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
inputSchema: {
|
|
70
|
+
type: string;
|
|
71
|
+
properties: {
|
|
72
|
+
topic: {
|
|
73
|
+
type: string;
|
|
74
|
+
enum: string[];
|
|
75
|
+
description: string;
|
|
76
|
+
};
|
|
77
|
+
detail_level: {
|
|
78
|
+
type: string;
|
|
79
|
+
enum: string[];
|
|
80
|
+
default: string;
|
|
81
|
+
description: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
required: string[];
|
|
85
|
+
};
|
|
86
|
+
})[];
|
|
87
|
+
/**
|
|
88
|
+
* Handle a tool call by name and return the result.
|
|
89
|
+
* This is used by the MCP server to dispatch tool calls.
|
|
90
|
+
*/
|
|
91
|
+
export declare function handleTool(name: string, args: Record<string, unknown>): ToolResult;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Xano Developer MCP Tools
|
|
3
|
+
*
|
|
4
|
+
* This module exports all tools for both MCP server usage and standalone library usage.
|
|
5
|
+
*
|
|
6
|
+
* @example MCP Server Usage (internal)
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { toolDefinitions, handleTool } from './tools/index.js';
|
|
9
|
+
*
|
|
10
|
+
* // Register tools with MCP server
|
|
11
|
+
* server.setRequestHandler(ListToolsRequestSchema, () => ({
|
|
12
|
+
* tools: toolDefinitions
|
|
13
|
+
* }));
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example Library Usage (external)
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {
|
|
19
|
+
* validateXanoscript,
|
|
20
|
+
* xanoscriptDocs,
|
|
21
|
+
* metaApiDocs,
|
|
22
|
+
* runApiDocs,
|
|
23
|
+
* cliDocs,
|
|
24
|
+
* mcpVersion
|
|
25
|
+
* } from '@xano/developer-mcp';
|
|
26
|
+
*
|
|
27
|
+
* // Use tools directly
|
|
28
|
+
* const result = validateXanoscript({ code: 'return 1 + 1' });
|
|
29
|
+
* const docs = xanoscriptDocs({ topic: 'syntax' });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
// =============================================================================
|
|
33
|
+
// Tool Imports
|
|
34
|
+
// =============================================================================
|
|
35
|
+
import { validateXanoscript, validateXanoscriptTool, validateXanoscriptToolDefinition, } from "./validate_xanoscript.js";
|
|
36
|
+
import { xanoscriptDocs, xanoscriptDocsTool, xanoscriptDocsToolDefinition, getXanoscriptDocsPath, setXanoscriptDocsPath, } from "./xanoscript_docs.js";
|
|
37
|
+
import { mcpVersion, mcpVersionTool, mcpVersionToolDefinition, getServerVersion, setServerVersion, } from "./mcp_version.js";
|
|
38
|
+
import { metaApiDocs, metaApiDocsTool, metaApiDocsToolDefinition, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions, } from "./meta_api_docs.js";
|
|
39
|
+
import { runApiDocs, runApiDocsTool, runApiDocsToolDefinition, runApiTopics, getRunApiTopicNames, getRunApiTopicDescriptions, } from "./run_api_docs.js";
|
|
40
|
+
import { cliDocs, cliDocsTool, cliDocsToolDefinition, cliTopics, getCliTopicNames, getCliTopicDescriptions, } from "./cli_docs.js";
|
|
41
|
+
import { toMcpResponse } from "./types.js";
|
|
42
|
+
// =============================================================================
|
|
43
|
+
// Standalone Tool Functions (for library usage)
|
|
44
|
+
// =============================================================================
|
|
45
|
+
export {
|
|
46
|
+
// Validation
|
|
47
|
+
validateXanoscript,
|
|
48
|
+
// XanoScript Documentation
|
|
49
|
+
xanoscriptDocs, getXanoscriptDocsPath, setXanoscriptDocsPath,
|
|
50
|
+
// MCP Version
|
|
51
|
+
mcpVersion, getServerVersion, setServerVersion,
|
|
52
|
+
// Meta API Documentation
|
|
53
|
+
metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescriptions,
|
|
54
|
+
// Run API Documentation
|
|
55
|
+
runApiDocs, runApiTopics, getRunApiTopicNames, getRunApiTopicDescriptions,
|
|
56
|
+
// CLI Documentation
|
|
57
|
+
cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, toMcpResponse, };
|
|
58
|
+
// =============================================================================
|
|
59
|
+
// Tool Result Functions (for internal MCP usage)
|
|
60
|
+
// =============================================================================
|
|
61
|
+
export { validateXanoscriptTool, xanoscriptDocsTool, mcpVersionTool, metaApiDocsTool, runApiDocsTool, cliDocsTool, };
|
|
62
|
+
// =============================================================================
|
|
63
|
+
// MCP Tool Definitions
|
|
64
|
+
// =============================================================================
|
|
65
|
+
export { validateXanoscriptToolDefinition, xanoscriptDocsToolDefinition, mcpVersionToolDefinition, metaApiDocsToolDefinition, runApiDocsToolDefinition, cliDocsToolDefinition, };
|
|
66
|
+
/**
|
|
67
|
+
* All tool definitions for MCP server registration
|
|
68
|
+
*/
|
|
69
|
+
export const toolDefinitions = [
|
|
70
|
+
validateXanoscriptToolDefinition,
|
|
71
|
+
xanoscriptDocsToolDefinition,
|
|
72
|
+
mcpVersionToolDefinition,
|
|
73
|
+
metaApiDocsToolDefinition,
|
|
74
|
+
runApiDocsToolDefinition,
|
|
75
|
+
cliDocsToolDefinition,
|
|
76
|
+
];
|
|
77
|
+
// =============================================================================
|
|
78
|
+
// Tool Handler (for MCP server)
|
|
79
|
+
// =============================================================================
|
|
80
|
+
/**
|
|
81
|
+
* Handle a tool call by name and return the result.
|
|
82
|
+
* This is used by the MCP server to dispatch tool calls.
|
|
83
|
+
*/
|
|
84
|
+
export function handleTool(name, args) {
|
|
85
|
+
switch (name) {
|
|
86
|
+
case "validate_xanoscript":
|
|
87
|
+
return validateXanoscriptTool(args);
|
|
88
|
+
case "xanoscript_docs":
|
|
89
|
+
return xanoscriptDocsTool(args);
|
|
90
|
+
case "mcp_version":
|
|
91
|
+
return mcpVersionTool();
|
|
92
|
+
case "meta_api_docs":
|
|
93
|
+
return metaApiDocsTool(args);
|
|
94
|
+
case "run_api_docs":
|
|
95
|
+
return runApiDocsTool(args);
|
|
96
|
+
case "cli_docs":
|
|
97
|
+
return cliDocsTool(args);
|
|
98
|
+
default:
|
|
99
|
+
return {
|
|
100
|
+
success: false,
|
|
101
|
+
error: `Unknown tool: ${name}`,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Version Tool
|
|
3
|
+
*
|
|
4
|
+
* Returns the current version of the Xano Developer MCP server.
|
|
5
|
+
* Can be used standalone or within the MCP server.
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolResult } from "./types.js";
|
|
8
|
+
export interface McpVersionResult {
|
|
9
|
+
version: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Get the MCP server version from package.json.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getServerVersion(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Set a custom version (useful for testing)
|
|
17
|
+
*/
|
|
18
|
+
export declare function setServerVersion(version: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Get the MCP server version.
|
|
21
|
+
*
|
|
22
|
+
* @returns Version information
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { mcpVersion } from '@xano/developer-mcp';
|
|
27
|
+
*
|
|
28
|
+
* const { version } = mcpVersion();
|
|
29
|
+
* console.log(`Running version ${version}`);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function mcpVersion(): McpVersionResult;
|
|
33
|
+
/**
|
|
34
|
+
* Get the MCP version and return a ToolResult.
|
|
35
|
+
*/
|
|
36
|
+
export declare function mcpVersionTool(): ToolResult;
|
|
37
|
+
export declare const mcpVersionToolDefinition: {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: string;
|
|
42
|
+
properties: {};
|
|
43
|
+
required: never[];
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Version Tool
|
|
3
|
+
*
|
|
4
|
+
* Returns the current version of the Xano Developer MCP server.
|
|
5
|
+
* Can be used standalone or within the MCP server.
|
|
6
|
+
*/
|
|
7
|
+
import { readFileSync } from "fs";
|
|
8
|
+
import { dirname, join } from "path";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Version Resolution
|
|
12
|
+
// =============================================================================
|
|
13
|
+
let _version = null;
|
|
14
|
+
/**
|
|
15
|
+
* Get the MCP server version from package.json.
|
|
16
|
+
*/
|
|
17
|
+
export function getServerVersion() {
|
|
18
|
+
if (_version !== null)
|
|
19
|
+
return _version;
|
|
20
|
+
try {
|
|
21
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
22
|
+
const __dirname = dirname(__filename);
|
|
23
|
+
// Try multiple paths for package.json
|
|
24
|
+
const possiblePaths = [
|
|
25
|
+
join(__dirname, "..", "..", "package.json"), // dist/tools -> root
|
|
26
|
+
join(__dirname, "..", "..", "..", "package.json"), // src/tools -> root
|
|
27
|
+
];
|
|
28
|
+
for (const p of possiblePaths) {
|
|
29
|
+
try {
|
|
30
|
+
const pkg = JSON.parse(readFileSync(p, "utf-8"));
|
|
31
|
+
if (pkg.version) {
|
|
32
|
+
const version = pkg.version;
|
|
33
|
+
_version = version;
|
|
34
|
+
return version;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Fallback
|
|
44
|
+
}
|
|
45
|
+
_version = "unknown";
|
|
46
|
+
return "unknown";
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Set a custom version (useful for testing)
|
|
50
|
+
*/
|
|
51
|
+
export function setServerVersion(version) {
|
|
52
|
+
_version = version;
|
|
53
|
+
}
|
|
54
|
+
// =============================================================================
|
|
55
|
+
// Standalone Tool Function
|
|
56
|
+
// =============================================================================
|
|
57
|
+
/**
|
|
58
|
+
* Get the MCP server version.
|
|
59
|
+
*
|
|
60
|
+
* @returns Version information
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* import { mcpVersion } from '@xano/developer-mcp';
|
|
65
|
+
*
|
|
66
|
+
* const { version } = mcpVersion();
|
|
67
|
+
* console.log(`Running version ${version}`);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export function mcpVersion() {
|
|
71
|
+
return { version: getServerVersion() };
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get the MCP version and return a ToolResult.
|
|
75
|
+
*/
|
|
76
|
+
export function mcpVersionTool() {
|
|
77
|
+
return {
|
|
78
|
+
success: true,
|
|
79
|
+
data: getServerVersion(),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
// =============================================================================
|
|
83
|
+
// MCP Tool Definition
|
|
84
|
+
// =============================================================================
|
|
85
|
+
export const mcpVersionToolDefinition = {
|
|
86
|
+
name: "mcp_version",
|
|
87
|
+
description: "Get the current version of the Xano Developer MCP server. " +
|
|
88
|
+
"Returns the version string from package.json.",
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: "object",
|
|
91
|
+
properties: {},
|
|
92
|
+
required: [],
|
|
93
|
+
},
|
|
94
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta API Documentation Tool
|
|
3
|
+
*
|
|
4
|
+
* Retrieves documentation for Xano's Meta API.
|
|
5
|
+
* Re-exports from the meta_api_docs module with ToolResult support.
|
|
6
|
+
*/
|
|
7
|
+
import { metaApiDocsToolDefinition, topics, getTopicNames, getTopicDescriptions } from "../meta_api_docs/index.js";
|
|
8
|
+
import type { MetaApiDocsArgs, DetailLevel, TopicDoc } from "../meta_api_docs/types.js";
|
|
9
|
+
import type { ToolResult } from "./types.js";
|
|
10
|
+
export { metaApiDocsToolDefinition, topics as metaApiTopics, getTopicNames as getMetaApiTopicNames, getTopicDescriptions as getMetaApiTopicDescriptions, };
|
|
11
|
+
export type { MetaApiDocsArgs, DetailLevel, TopicDoc };
|
|
12
|
+
export interface MetaApiDocsResult {
|
|
13
|
+
documentation: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get Xano Meta API documentation.
|
|
17
|
+
*
|
|
18
|
+
* @param args - Documentation arguments
|
|
19
|
+
* @returns Documentation content
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { metaApiDocs } from '@xano/developer-mcp';
|
|
24
|
+
*
|
|
25
|
+
* // Get overview
|
|
26
|
+
* const overview = metaApiDocs({ topic: 'start' });
|
|
27
|
+
*
|
|
28
|
+
* // Get workspace documentation with examples
|
|
29
|
+
* const workspaceDocs = metaApiDocs({
|
|
30
|
+
* topic: 'workspace',
|
|
31
|
+
* detail_level: 'examples',
|
|
32
|
+
* include_schemas: true
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function metaApiDocs(args: MetaApiDocsArgs): MetaApiDocsResult;
|
|
37
|
+
/**
|
|
38
|
+
* Get Meta API documentation and return a ToolResult.
|
|
39
|
+
*/
|
|
40
|
+
export declare function metaApiDocsTool(args: MetaApiDocsArgs): ToolResult;
|
|
41
|
+
export { metaApiDocsToolDefinition as toolDefinition };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta API Documentation Tool
|
|
3
|
+
*
|
|
4
|
+
* Retrieves documentation for Xano's Meta API.
|
|
5
|
+
* Re-exports from the meta_api_docs module with ToolResult support.
|
|
6
|
+
*/
|
|
7
|
+
import { handleMetaApiDocs as _handleMetaApiDocs, metaApiDocsToolDefinition, topics, getTopicNames, getTopicDescriptions, } from "../meta_api_docs/index.js";
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Re-exports
|
|
10
|
+
// =============================================================================
|
|
11
|
+
export { metaApiDocsToolDefinition, topics as metaApiTopics, getTopicNames as getMetaApiTopicNames, getTopicDescriptions as getMetaApiTopicDescriptions, };
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Standalone Tool Function
|
|
14
|
+
// =============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Get Xano Meta API documentation.
|
|
17
|
+
*
|
|
18
|
+
* @param args - Documentation arguments
|
|
19
|
+
* @returns Documentation content
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { metaApiDocs } from '@xano/developer-mcp';
|
|
24
|
+
*
|
|
25
|
+
* // Get overview
|
|
26
|
+
* const overview = metaApiDocs({ topic: 'start' });
|
|
27
|
+
*
|
|
28
|
+
* // Get workspace documentation with examples
|
|
29
|
+
* const workspaceDocs = metaApiDocs({
|
|
30
|
+
* topic: 'workspace',
|
|
31
|
+
* detail_level: 'examples',
|
|
32
|
+
* include_schemas: true
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function metaApiDocs(args) {
|
|
37
|
+
if (!args?.topic) {
|
|
38
|
+
throw new Error("'topic' parameter is required. Use topic='start' for overview.");
|
|
39
|
+
}
|
|
40
|
+
const documentation = _handleMetaApiDocs(args);
|
|
41
|
+
return { documentation };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get Meta API documentation and return a ToolResult.
|
|
45
|
+
*/
|
|
46
|
+
export function metaApiDocsTool(args) {
|
|
47
|
+
if (!args?.topic) {
|
|
48
|
+
return {
|
|
49
|
+
success: false,
|
|
50
|
+
error: "Error: 'topic' parameter is required. Use meta_api_docs with topic='start' for overview.",
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const result = metaApiDocs(args);
|
|
55
|
+
return {
|
|
56
|
+
success: true,
|
|
57
|
+
data: result.documentation,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
62
|
+
return {
|
|
63
|
+
success: false,
|
|
64
|
+
error: `Error retrieving API documentation: ${errorMessage}`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Re-export tool definition for MCP
|
|
69
|
+
export { metaApiDocsToolDefinition as toolDefinition };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run API Documentation Tool
|
|
3
|
+
*
|
|
4
|
+
* Retrieves documentation for Xano's Run API.
|
|
5
|
+
* Re-exports from the run_api_docs module with ToolResult support.
|
|
6
|
+
*/
|
|
7
|
+
import { runApiDocsToolDefinition, topics, getTopicNames, getTopicDescriptions } from "../run_api_docs/index.js";
|
|
8
|
+
import type { TopicDoc, DetailLevel } from "../meta_api_docs/types.js";
|
|
9
|
+
import type { ToolResult } from "./types.js";
|
|
10
|
+
export { runApiDocsToolDefinition, topics as runApiTopics, getTopicNames as getRunApiTopicNames, getTopicDescriptions as getRunApiTopicDescriptions, };
|
|
11
|
+
export type { TopicDoc, DetailLevel };
|
|
12
|
+
export interface RunApiDocsArgs {
|
|
13
|
+
topic: string;
|
|
14
|
+
detail_level?: DetailLevel;
|
|
15
|
+
include_schemas?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface RunApiDocsResult {
|
|
18
|
+
documentation: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get Xano Run API documentation.
|
|
22
|
+
*
|
|
23
|
+
* @param args - Documentation arguments
|
|
24
|
+
* @returns Documentation content
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { runApiDocs } from '@xano/developer-mcp';
|
|
29
|
+
*
|
|
30
|
+
* // Get overview
|
|
31
|
+
* const overview = runApiDocs({ topic: 'start' });
|
|
32
|
+
*
|
|
33
|
+
* // Get session documentation with examples
|
|
34
|
+
* const sessionDocs = runApiDocs({
|
|
35
|
+
* topic: 'session',
|
|
36
|
+
* detail_level: 'examples',
|
|
37
|
+
* include_schemas: true
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function runApiDocs(args: RunApiDocsArgs): RunApiDocsResult;
|
|
42
|
+
/**
|
|
43
|
+
* Get Run API documentation and return a ToolResult.
|
|
44
|
+
*/
|
|
45
|
+
export declare function runApiDocsTool(args: RunApiDocsArgs): ToolResult;
|
|
46
|
+
export { runApiDocsToolDefinition as toolDefinition };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run API Documentation Tool
|
|
3
|
+
*
|
|
4
|
+
* Retrieves documentation for Xano's Run API.
|
|
5
|
+
* Re-exports from the run_api_docs module with ToolResult support.
|
|
6
|
+
*/
|
|
7
|
+
import { handleRunApiDocs as _handleRunApiDocs, runApiDocsToolDefinition, topics, getTopicNames, getTopicDescriptions, } from "../run_api_docs/index.js";
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Re-exports
|
|
10
|
+
// =============================================================================
|
|
11
|
+
export { runApiDocsToolDefinition, topics as runApiTopics, getTopicNames as getRunApiTopicNames, getTopicDescriptions as getRunApiTopicDescriptions, };
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Standalone Tool Function
|
|
14
|
+
// =============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Get Xano Run API documentation.
|
|
17
|
+
*
|
|
18
|
+
* @param args - Documentation arguments
|
|
19
|
+
* @returns Documentation content
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { runApiDocs } from '@xano/developer-mcp';
|
|
24
|
+
*
|
|
25
|
+
* // Get overview
|
|
26
|
+
* const overview = runApiDocs({ topic: 'start' });
|
|
27
|
+
*
|
|
28
|
+
* // Get session documentation with examples
|
|
29
|
+
* const sessionDocs = runApiDocs({
|
|
30
|
+
* topic: 'session',
|
|
31
|
+
* detail_level: 'examples',
|
|
32
|
+
* include_schemas: true
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function runApiDocs(args) {
|
|
37
|
+
if (!args?.topic) {
|
|
38
|
+
throw new Error("'topic' parameter is required. Use topic='start' for overview.");
|
|
39
|
+
}
|
|
40
|
+
const documentation = _handleRunApiDocs(args.topic, args.detail_level, args.include_schemas);
|
|
41
|
+
return { documentation };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get Run API documentation and return a ToolResult.
|
|
45
|
+
*/
|
|
46
|
+
export function runApiDocsTool(args) {
|
|
47
|
+
if (!args?.topic) {
|
|
48
|
+
return {
|
|
49
|
+
success: false,
|
|
50
|
+
error: "Error: 'topic' parameter is required. Use run_api_docs with topic='start' for overview.",
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const result = runApiDocs(args);
|
|
55
|
+
return {
|
|
56
|
+
success: true,
|
|
57
|
+
data: result.documentation,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
62
|
+
return {
|
|
63
|
+
success: false,
|
|
64
|
+
error: `Error retrieving Run API documentation: ${errorMessage}`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Re-export tool definition for MCP
|
|
69
|
+
export { runApiDocsToolDefinition as toolDefinition };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common types for tool results
|
|
3
|
+
*/
|
|
4
|
+
export interface ToolResult {
|
|
5
|
+
success: boolean;
|
|
6
|
+
data?: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Convert a ToolResult to MCP tool response format
|
|
11
|
+
*/
|
|
12
|
+
export declare function toMcpResponse(result: ToolResult): {
|
|
13
|
+
content: {
|
|
14
|
+
type: "text";
|
|
15
|
+
text: string;
|
|
16
|
+
}[];
|
|
17
|
+
isError?: boolean;
|
|
18
|
+
};
|