@xano/developer-mcp 1.0.31 → 1.0.33

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 (45) hide show
  1. package/README.md +172 -9
  2. package/dist/cli_docs/topics/workspace.js +50 -6
  3. package/dist/index.d.ts +8 -0
  4. package/dist/index.js +14 -286
  5. package/dist/lib.d.ts +53 -0
  6. package/dist/lib.js +71 -0
  7. package/dist/tools/cli_docs.d.ts +40 -0
  8. package/dist/tools/cli_docs.js +68 -0
  9. package/dist/tools/index.d.ts +91 -0
  10. package/dist/tools/index.js +104 -0
  11. package/dist/tools/mcp_version.d.ts +45 -0
  12. package/dist/tools/mcp_version.js +94 -0
  13. package/dist/tools/meta_api_docs.d.ts +41 -0
  14. package/dist/tools/meta_api_docs.js +69 -0
  15. package/dist/tools/run_api_docs.d.ts +46 -0
  16. package/dist/tools/run_api_docs.js +69 -0
  17. package/dist/tools/types.d.ts +18 -0
  18. package/dist/tools/types.js +17 -0
  19. package/dist/tools/validate_xanoscript.d.ts +68 -0
  20. package/dist/tools/validate_xanoscript.js +114 -0
  21. package/dist/tools/xanoscript_docs.d.ts +72 -0
  22. package/dist/tools/xanoscript_docs.js +129 -0
  23. package/dist/xanoscript_docs/README.md +67 -31
  24. package/dist/xanoscript_docs/addons.md +2 -2
  25. package/dist/xanoscript_docs/agents.md +2 -2
  26. package/dist/xanoscript_docs/apis.md +9 -7
  27. package/dist/xanoscript_docs/branch.md +5 -4
  28. package/dist/xanoscript_docs/database.md +1 -1
  29. package/dist/xanoscript_docs/functions.md +2 -2
  30. package/dist/xanoscript_docs/integrations.md +1 -1
  31. package/dist/xanoscript_docs/mcp-servers.md +12 -12
  32. package/dist/xanoscript_docs/performance.md +1 -1
  33. package/dist/xanoscript_docs/realtime.md +1 -1
  34. package/dist/xanoscript_docs/run.md +15 -14
  35. package/dist/xanoscript_docs/schema.md +1 -1
  36. package/dist/xanoscript_docs/security.md +1 -1
  37. package/dist/xanoscript_docs/streaming.md +114 -92
  38. package/dist/xanoscript_docs/tables.md +1 -1
  39. package/dist/xanoscript_docs/tasks.md +16 -8
  40. package/dist/xanoscript_docs/testing.md +1 -1
  41. package/dist/xanoscript_docs/tools.md +1 -1
  42. package/dist/xanoscript_docs/triggers.md +1 -1
  43. package/dist/xanoscript_docs/types.md +1 -1
  44. package/dist/xanoscript_docs/workspace.md +6 -5
  45. package/package.json +22 -3
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";
@@ -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 };