@xano/developer-mcp 1.0.75 → 2.0.0

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 (127) hide show
  1. package/README.md +104 -37
  2. package/dist/cli_docs/index.d.ts +13 -37
  3. package/dist/cli_docs/index.js +28 -39
  4. package/dist/cli_docs/topics/integration.js +1 -1
  5. package/dist/cli_docs/topics/workspace.js +1 -1
  6. package/dist/index.js +58 -55
  7. package/dist/lib.d.ts +3 -1
  8. package/dist/lib.js +1 -1
  9. package/dist/meta_api_docs/format.js +1 -1
  10. package/dist/meta_api_docs/index.d.ts +14 -42
  11. package/dist/meta_api_docs/index.js +34 -46
  12. package/dist/tools/cli_docs.d.ts +2 -3
  13. package/dist/tools/cli_docs.js +3 -5
  14. package/dist/tools/define_tool.d.ts +47 -0
  15. package/dist/tools/define_tool.js +36 -0
  16. package/dist/tools/index.d.ts +88 -221
  17. package/dist/tools/index.js +80 -109
  18. package/dist/tools/mcp_version.d.ts +4 -25
  19. package/dist/tools/mcp_version.js +12 -19
  20. package/dist/tools/meta_api_docs.d.ts +2 -3
  21. package/dist/tools/meta_api_docs.js +3 -5
  22. package/dist/tools/validate_xanoscript.d.ts +18 -65
  23. package/dist/tools/validate_xanoscript.js +56 -54
  24. package/dist/tools/xanoscript_docs.d.ts +25 -74
  25. package/dist/tools/xanoscript_docs.js +86 -83
  26. package/dist/xanoscript_docs/README.md +5 -5
  27. package/dist/xanoscript_docs/apis.md +2 -2
  28. package/dist/xanoscript_docs/database.md +1 -1
  29. package/dist/xanoscript_docs/essentials.md +6 -6
  30. package/dist/xanoscript_docs/functions.md +3 -3
  31. package/dist/xanoscript_docs/integrations.md +5 -5
  32. package/dist/xanoscript_docs/middleware.md +1 -1
  33. package/dist/xanoscript_docs/performance.md +4 -4
  34. package/dist/xanoscript_docs/realtime.md +2 -2
  35. package/dist/xanoscript_docs/security.md +1 -1
  36. package/dist/xanoscript_docs/survival.md +1 -1
  37. package/dist/xanoscript_docs/syntax/string-filters.md +1 -1
  38. package/dist/xanoscript_docs/syntax.md +9 -9
  39. package/dist/xanoscript_docs/tools.md +2 -2
  40. package/dist/xanoscript_docs/types.md +2 -2
  41. package/dist/xanoscript_docs/unit-testing.md +1 -1
  42. package/dist/xanoscript_docs/workflow-tests.md +1 -1
  43. package/dist/xanoscript_docs/working.md +4 -4
  44. package/package.json +5 -4
  45. package/dist/api_docs/format.d.ts +0 -5
  46. package/dist/api_docs/format.js +0 -171
  47. package/dist/api_docs/index.d.ts +0 -52
  48. package/dist/api_docs/index.js +0 -111
  49. package/dist/api_docs/topics/agent.d.ts +0 -2
  50. package/dist/api_docs/topics/agent.js +0 -142
  51. package/dist/api_docs/topics/api.d.ts +0 -2
  52. package/dist/api_docs/topics/api.js +0 -176
  53. package/dist/api_docs/topics/apigroup.d.ts +0 -2
  54. package/dist/api_docs/topics/apigroup.js +0 -124
  55. package/dist/api_docs/topics/authentication.d.ts +0 -2
  56. package/dist/api_docs/topics/authentication.js +0 -61
  57. package/dist/api_docs/topics/branch.d.ts +0 -2
  58. package/dist/api_docs/topics/branch.js +0 -73
  59. package/dist/api_docs/topics/file.d.ts +0 -2
  60. package/dist/api_docs/topics/file.js +0 -70
  61. package/dist/api_docs/topics/function.d.ts +0 -2
  62. package/dist/api_docs/topics/function.js +0 -164
  63. package/dist/api_docs/topics/history.d.ts +0 -2
  64. package/dist/api_docs/topics/history.js +0 -149
  65. package/dist/api_docs/topics/mcp_server.d.ts +0 -2
  66. package/dist/api_docs/topics/mcp_server.js +0 -139
  67. package/dist/api_docs/topics/middleware.d.ts +0 -2
  68. package/dist/api_docs/topics/middleware.js +0 -156
  69. package/dist/api_docs/topics/realtime.d.ts +0 -2
  70. package/dist/api_docs/topics/realtime.js +0 -112
  71. package/dist/api_docs/topics/start.d.ts +0 -2
  72. package/dist/api_docs/topics/start.js +0 -107
  73. package/dist/api_docs/topics/table.d.ts +0 -2
  74. package/dist/api_docs/topics/table.js +0 -195
  75. package/dist/api_docs/topics/task.d.ts +0 -2
  76. package/dist/api_docs/topics/task.js +0 -165
  77. package/dist/api_docs/topics/tool.d.ts +0 -2
  78. package/dist/api_docs/topics/tool.js +0 -150
  79. package/dist/api_docs/topics/workflows.d.ts +0 -2
  80. package/dist/api_docs/topics/workflows.js +0 -131
  81. package/dist/api_docs/topics/workspace.d.ts +0 -2
  82. package/dist/api_docs/topics/workspace.js +0 -153
  83. package/dist/api_docs/types.d.ts +0 -79
  84. package/dist/api_docs/types.js +0 -4
  85. package/dist/cli_docs/topics/run.d.ts +0 -2
  86. package/dist/cli_docs/topics/run.js +0 -248
  87. package/dist/meta_api_docs/format.test.d.ts +0 -1
  88. package/dist/meta_api_docs/format.test.js +0 -272
  89. package/dist/meta_api_docs/index.test.d.ts +0 -1
  90. package/dist/meta_api_docs/index.test.js +0 -128
  91. package/dist/meta_api_docs/types.test.d.ts +0 -1
  92. package/dist/meta_api_docs/types.test.js +0 -132
  93. package/dist/templates/init-workspace.d.ts +0 -10
  94. package/dist/templates/init-workspace.js +0 -278
  95. package/dist/templates/xanoscript-index.d.ts +0 -11
  96. package/dist/templates/xanoscript-index.js +0 -72
  97. package/dist/tools/index.test.d.ts +0 -1
  98. package/dist/tools/index.test.js +0 -179
  99. package/dist/tools/xanoscript_docs.test.d.ts +0 -1
  100. package/dist/tools/xanoscript_docs.test.js +0 -197
  101. package/dist/xanoscript.test.d.ts +0 -1
  102. package/dist/xanoscript.test.js +0 -421
  103. package/dist/xanoscript_docs/cheatsheet.md +0 -287
  104. package/dist/xanoscript_docs/ephemeral.md +0 -330
  105. package/dist/xanoscript_docs/quickstart.md +0 -692
  106. package/dist/xanoscript_docs/run.md +0 -196
  107. package/dist/xanoscript_docs/schema.md +0 -300
  108. package/dist/xanoscript_docs_auto/README.md +0 -119
  109. package/dist/xanoscript_docs_auto/agents.md +0 -446
  110. package/dist/xanoscript_docs_auto/apis.md +0 -517
  111. package/dist/xanoscript_docs_auto/control-flow.md +0 -543
  112. package/dist/xanoscript_docs_auto/database.md +0 -551
  113. package/dist/xanoscript_docs_auto/debugging.md +0 -527
  114. package/dist/xanoscript_docs_auto/filters.md +0 -464
  115. package/dist/xanoscript_docs_auto/functions.md +0 -431
  116. package/dist/xanoscript_docs_auto/integrations.md +0 -657
  117. package/dist/xanoscript_docs_auto/mcp-servers.md +0 -408
  118. package/dist/xanoscript_docs_auto/operators.md +0 -368
  119. package/dist/xanoscript_docs_auto/syntax.md +0 -287
  120. package/dist/xanoscript_docs_auto/tables.md +0 -447
  121. package/dist/xanoscript_docs_auto/tasks.md +0 -479
  122. package/dist/xanoscript_docs_auto/testing.md +0 -574
  123. package/dist/xanoscript_docs_auto/tools.md +0 -485
  124. package/dist/xanoscript_docs_auto/triggers.md +0 -595
  125. package/dist/xanoscript_docs_auto/types.md +0 -323
  126. package/dist/xanoscript_docs_auto/variables.md +0 -462
  127. package/dist/xanoscript_docs_auto/version.json +0 -5
package/README.md CHANGED
@@ -286,8 +286,9 @@ console.log(`Using version ${version}`);
286
286
  | `metaApiDocs` | Get Meta API documentation |
287
287
  | `cliDocs` | Get CLI documentation |
288
288
  | `mcpVersion` | Get the package version |
289
- | `toolDefinitions` | MCP tool definitions (for building custom MCP servers) |
290
- | `handleTool` | Tool dispatcher function (for building custom MCP servers) |
289
+ | `toolDefinitions` | MCP tool definitions (JSON Schema, for building custom MCP servers) |
290
+ | `toolSpecs` | Tool specs with Zod input/output shapes (preferred for new code — works directly with `McpServer.registerTool`) |
291
+ | `handleTool` | Async tool dispatcher (`Promise<ToolResult>`) for building custom MCP servers |
291
292
 
292
293
  ### TypeScript Support
293
294
 
@@ -322,7 +323,7 @@ import '@xano/developer-mcp/server';
322
323
 
323
324
  ## Available Tools
324
325
 
325
- ### 1. `validate_xanoscript`
326
+ ### 1. `xano_validate_xanoscript`
326
327
 
327
328
  Validates XanoScript code for syntax errors. Supports multiple input methods. The language server auto-detects the object type from the code syntax.
328
329
 
@@ -340,24 +341,24 @@ Validates XanoScript code for syntax errors. Supports multiple input methods. Th
340
341
  **Examples:**
341
342
  ```
342
343
  // Validate code directly
343
- validate_xanoscript({ code: "var:result = 1 + 2" })
344
+ xano_validate_xanoscript({ code: "var:result = 1 + 2" })
344
345
 
345
346
  // Validate a single file
346
- validate_xanoscript({ file_path: "function/utils/format.xs" })
347
+ xano_validate_xanoscript({ file_path: "function/utils/format.xs" })
347
348
 
348
349
  // Validate multiple files
349
- validate_xanoscript({ file_paths: ["api/users/get.xs", "api/users/create.xs"] })
350
+ xano_validate_xanoscript({ file_paths: ["api/users/get.xs", "api/users/create.xs"] })
350
351
 
351
352
  // Validate all .xs files in a directory
352
- validate_xanoscript({ directory: "api/users" })
353
+ xano_validate_xanoscript({ directory: "api/users" })
353
354
 
354
355
  // Validate with a specific pattern
355
- validate_xanoscript({ directory: "src", pattern: "api/**/*.xs" })
356
+ xano_validate_xanoscript({ directory: "src", pattern: "api/**/*.xs" })
356
357
  ```
357
358
 
358
359
  **Returns:** List of errors with line/column positions and helpful suggestions, or confirmation of validity.
359
360
 
360
- ### 2. `xanoscript_docs`
361
+ ### 2. `xano_xanoscript_docs`
361
362
 
362
363
  Retrieves XanoScript programming language documentation with context-aware support.
363
364
 
@@ -415,37 +416,37 @@ Retrieves XanoScript programming language documentation with context-aware suppo
415
416
  **Examples:**
416
417
  ```
417
418
  // Get overview
418
- xanoscript_docs()
419
+ xano_xanoscript_docs()
419
420
 
420
421
  // Get survival kit for small context models (~800 tokens)
421
- xanoscript_docs({ tier: "survival" })
422
+ xano_xanoscript_docs({ tier: "survival" })
422
423
 
423
424
  // Get working reference for medium context models (~3500 tokens)
424
- xanoscript_docs({ tier: "working" })
425
+ xano_xanoscript_docs({ tier: "working" })
425
426
 
426
427
  // Get essentials (recommended first stop)
427
- xanoscript_docs({ topic: "essentials" })
428
+ xano_xanoscript_docs({ topic: "essentials" })
428
429
 
429
430
  // Get specific topic
430
- xanoscript_docs({ topic: "functions" })
431
+ xano_xanoscript_docs({ topic: "functions" })
431
432
 
432
433
  // Discover available topics with sizes
433
- xanoscript_docs({ mode: "index" })
434
+ xano_xanoscript_docs({ mode: "index" })
434
435
 
435
436
  // Budget-aware: load docs up to token limit
436
- xanoscript_docs({ file_path: "api/users/create_post.xs", max_tokens: 2000 })
437
+ xano_xanoscript_docs({ file_path: "api/users/create_post.xs", max_tokens: 2000 })
437
438
 
438
439
  // Context-aware: get all docs relevant to file being edited
439
- xanoscript_docs({ file_path: "api/users/create_post.xs" })
440
+ xano_xanoscript_docs({ file_path: "api/users/create_post.xs" })
440
441
 
441
442
  // Context-aware with exclusions (skip already-loaded topics)
442
- xanoscript_docs({ file_path: "api/users/create_post.xs", exclude_topics: ["syntax", "essentials"] })
443
+ xano_xanoscript_docs({ file_path: "api/users/create_post.xs", exclude_topics: ["syntax", "essentials"] })
443
444
 
444
445
  // Compact quick reference (uses less context)
445
- xanoscript_docs({ topic: "database", mode: "quick_reference" })
446
+ xano_xanoscript_docs({ topic: "database", mode: "quick_reference" })
446
447
  ```
447
448
 
448
- ### 3. `mcp_version`
449
+ ### 3. `xano_version`
449
450
 
450
451
  Get the current version of the Xano Developer MCP server.
451
452
 
@@ -455,10 +456,10 @@ Get the current version of the Xano Developer MCP server.
455
456
 
456
457
  **Example:**
457
458
  ```
458
- mcp_version()
459
+ xano_version()
459
460
  ```
460
461
 
461
- ### 4. `meta_api_docs`
462
+ ### 4. `xano_meta_api_docs`
462
463
 
463
464
  Get documentation for Xano's Meta API. Use this to understand how to programmatically manage Xano workspaces, databases, APIs, functions, agents, and more.
464
465
 
@@ -494,19 +495,19 @@ Get documentation for Xano's Meta API. Use this to understand how to programmati
494
495
  **Examples:**
495
496
  ```
496
497
  // Get overview of Meta API
497
- meta_api_docs({ topic: "start" })
498
+ xano_meta_api_docs({ topic: "start" })
498
499
 
499
500
  // Get detailed table documentation
500
- meta_api_docs({ topic: "table", detail_level: "detailed" })
501
+ xano_meta_api_docs({ topic: "table", detail_level: "detailed" })
501
502
 
502
503
  // Get examples without schemas (smaller context)
503
- meta_api_docs({ topic: "api", detail_level: "examples", include_schemas: false })
504
+ xano_meta_api_docs({ topic: "api", detail_level: "examples", include_schemas: false })
504
505
 
505
506
  // Step-by-step workflow guides
506
- meta_api_docs({ topic: "workflows" })
507
+ xano_meta_api_docs({ topic: "workflows" })
507
508
  ```
508
509
 
509
- ### 5. `cli_docs`
510
+ ### 5. `xano_cli_docs`
510
511
 
511
512
  Get documentation for the Xano CLI. The CLI is **optional but recommended** for local development workflows. Not all users will have it installed.
512
513
 
@@ -544,16 +545,16 @@ Use this tool to understand CLI commands for local development, code synchroniza
544
545
  **Examples:**
545
546
  ```
546
547
  // Get CLI setup guide
547
- cli_docs({ topic: "start" })
548
+ xano_cli_docs({ topic: "start" })
548
549
 
549
550
  // Learn when to use CLI vs Meta API
550
- cli_docs({ topic: "integration" })
551
+ xano_cli_docs({ topic: "integration" })
551
552
 
552
553
  // Get workspace sync commands
553
- cli_docs({ topic: "workspace", detail_level: "detailed" })
554
+ xano_cli_docs({ topic: "workspace", detail_level: "detailed" })
554
555
 
555
556
  // Profile management with examples
556
- cli_docs({ topic: "profile", detail_level: "examples" })
557
+ xano_cli_docs({ topic: "profile", detail_level: "examples" })
557
558
  ```
558
559
 
559
560
  ## MCP Resources
@@ -688,22 +689,22 @@ MCP Protocol (JSON-RPC over stdio)
688
689
  ▼
689
690
  Xano Developer MCP Server
690
691
  │
691
- ├─► validate_xanoscript → Parses code with XanoScript language server
692
+ ├─► xano_validate_xanoscript → Parses code with XanoScript language server
692
693
  │
693
- ├─► xanoscript_docs → Context-aware docs from /xanoscript_docs/*.md
694
+ ├─► xano_xanoscript_docs → Context-aware docs from /xanoscript_docs/*.md
694
695
  │
695
- ├─► meta_api_docs → Meta API documentation with detail levels
696
+ ├─► xano_meta_api_docs → Meta API documentation with detail levels
696
697
  │
697
- ├─► cli_docs → CLI documentation for local development workflows
698
+ ├─► xano_cli_docs → CLI documentation for local development workflows
698
699
  │
699
- ├─► mcp_version → Returns server version from package.json
700
+ ├─► xano_version → Returns server version from package.json
700
701
  │
701
702
  └─► MCP Resources → Direct access to XanoScript documentation
702
703
  ```
703
704
 
704
705
  ## Authentication
705
706
 
706
- The MCP server and library functions do not require authentication. However, when using the documented APIs (Meta API) to interact with actual Xano services, you will need appropriate Xano API credentials. See the `meta_api_docs` tool for authentication details.
707
+ The MCP server and library functions do not require authentication. However, when using the documented APIs (Meta API) to interact with actual Xano services, you will need appropriate Xano API credentials. See the `xano_meta_api_docs` tool for authentication details.
707
708
 
708
709
  ## Development
709
710
 
@@ -796,6 +797,72 @@ describe("myFunction", () => {
796
797
  });
797
798
  ```
798
799
 
800
+ ## Upgrading from 1.x to 2.0
801
+
802
+ Version 2 modernizes the MCP server internals and normalizes all tool names
803
+ under a single `xano_` namespace. The high-level standalone library functions
804
+ (`validateXanoscript`, `xanoscriptDocs`, `metaApiDocs`, `cliDocs`, `mcpVersion`)
805
+ are unchanged.
806
+
807
+ ### Tool renames (MCP clients)
808
+
809
+ If your agent or MCP client config references tools by name, update them:
810
+
811
+ | 1.x | 2.0 |
812
+ |---|---|
813
+ | `validate_xanoscript` | `xano_validate_xanoscript` |
814
+ | `xanoscript_docs` | `xano_xanoscript_docs` |
815
+ | `meta_api_docs` | `xano_meta_api_docs` |
816
+ | `cli_docs` | `xano_cli_docs` |
817
+ | `mcp_version` | `xano_version` |
818
+
819
+ The single `xano_` prefix improves discoverability when multiple MCP servers
820
+ are installed and lets clients filter Xano tools by name pattern.
821
+
822
+ ### Library API
823
+
824
+ `handleTool(name, args)` is now `async` and returns `Promise<ToolResult>`
825
+ instead of `ToolResult`. Update call sites to use `await` and the new tool
826
+ names:
827
+
828
+ ```ts
829
+ // 1.x
830
+ const result = handleTool("xanoscript_docs", { topic: "syntax" });
831
+
832
+ // 2.0
833
+ const result = await handleTool("xano_xanoscript_docs", { topic: "syntax" });
834
+ ```
835
+
836
+ The individual `*ToolDefinition` exports (`validateXanoscriptToolDefinition`,
837
+ `xanoscriptDocsToolDefinition`, `mcpVersionToolDefinition`,
838
+ `metaApiDocsToolDefinition`, `cliDocsToolDefinition`) were removed in favor
839
+ of a single source of truth. Use `toolSpecs[name].definition` instead:
840
+
841
+ ```ts
842
+ // 1.x
843
+ import { validateXanoscriptToolDefinition } from "@xano/developer-mcp";
844
+
845
+ // 2.0
846
+ import { toolSpecs } from "@xano/developer-mcp";
847
+ const validateXanoscriptToolDefinition =
848
+ toolSpecs.xano_validate_xanoscript.definition;
849
+ ```
850
+
851
+ A new `ToolName` type export enumerates every registered tool name.
852
+
853
+ ### Notable fixes and additions
854
+
855
+ - `xano_xanoscript_docs` now correctly accepts the documented `tier` and
856
+ `max_tokens` parameters — previously they were silently dropped before
857
+ reaching the handler.
858
+ - The server is built on the modern `McpServer` API with Zod-derived schemas,
859
+ so the JSON Schema published over the wire can no longer drift from the
860
+ runtime parser.
861
+ - New `toolSpecs` export exposes each tool's Zod input/output shape — use it
862
+ when registering tools in a custom `McpServer`.
863
+ - `xano_validate_xanoscript` results now include a `warnings` count in
864
+ `structuredContent` on success.
865
+
799
866
  ## License
800
867
 
801
868
  See [LICENSE](LICENSE) for details.
@@ -4,6 +4,7 @@
4
4
  * This module exports all documentation topics and provides
5
5
  * the cli_docs tool handler for the MCP server.
6
6
  */
7
+ import { z } from "zod";
7
8
  import type { TopicDoc, CliDocsArgs } from "./types.js";
8
9
  /**
9
10
  * All available documentation topics
@@ -24,40 +25,15 @@ export declare function handleCliDocs(args: CliDocsArgs): string;
24
25
  /**
25
26
  * Tool definition for MCP server
26
27
  */
27
- export declare const cliDocsToolDefinition: {
28
- name: string;
29
- annotations: {
30
- readOnlyHint: boolean;
31
- destructiveHint: boolean;
32
- idempotentHint: boolean;
33
- openWorldHint: boolean;
34
- };
35
- description: string;
36
- inputSchema: {
37
- type: string;
38
- properties: {
39
- topic: {
40
- type: string;
41
- enum: string[];
42
- description: string;
43
- };
44
- detail_level: {
45
- type: string;
46
- enum: string[];
47
- default: string;
48
- description: string;
49
- };
50
- };
51
- required: string[];
52
- };
53
- outputSchema: {
54
- type: string;
55
- properties: {
56
- documentation: {
57
- type: string;
58
- description: string;
59
- };
60
- };
61
- required: string[];
62
- };
63
- };
28
+ export declare const cliDocsToolSpec: import("../tools/define_tool.js").BuiltTool<{
29
+ topic: z.ZodEnum<{
30
+ [x: string]: string;
31
+ }>;
32
+ detail_level: z.ZodOptional<z.ZodEnum<{
33
+ overview: "overview";
34
+ detailed: "detailed";
35
+ examples: "examples";
36
+ }>>;
37
+ }, {
38
+ documentation: z.ZodString;
39
+ }>;
@@ -4,7 +4,9 @@
4
4
  * This module exports all documentation topics and provides
5
5
  * the cli_docs tool handler for the MCP server.
6
6
  */
7
+ import { z } from "zod";
7
8
  import { formatDocumentation } from "./format.js";
9
+ import { defineTool } from "../tools/define_tool.js";
8
10
  // Import all topic documentation
9
11
  import { authDoc } from "./topics/auth.js";
10
12
  import { startDoc } from "./topics/start.js";
@@ -71,14 +73,8 @@ export function handleCliDocs(args) {
71
73
  /**
72
74
  * Tool definition for MCP server
73
75
  */
74
- export const cliDocsToolDefinition = {
75
- name: "cli_docs",
76
- annotations: {
77
- readOnlyHint: true,
78
- destructiveHint: false,
79
- idempotentHint: true,
80
- openWorldHint: false,
81
- },
76
+ export const cliDocsToolSpec = defineTool({
77
+ name: "xano_cli_docs",
82
78
  description: `Get documentation for the Xano CLI. Use this to understand how to use the CLI for local development, code sync, and XanoScript execution.
83
79
 
84
80
  ## Topics
@@ -89,36 +85,29 @@ ${getTopicDescriptions()}
89
85
  - Use "auth" or "profile" to understand authentication options
90
86
  - Use "integration" to understand when to use CLI vs Meta API
91
87
  - Use specific topics for command reference (workspace, sandbox, branch, release, tenant, function, etc.)`,
92
- inputSchema: {
93
- type: "object",
94
- properties: {
95
- topic: {
96
- type: "string",
97
- enum: getTopicNames(),
98
- description: "Documentation topic to retrieve. Start with 'start' for installation and setup. " +
99
- "Example: topic='function' for function management commands, topic='sandbox' for the personal dev environment.",
100
- },
101
- detail_level: {
102
- type: "string",
103
- enum: ["overview", "detailed", "examples"],
104
- default: "detailed",
105
- description: "Level of detail to return. " +
106
- "'overview' = brief summary of commands and their purpose. " +
107
- "'detailed' = full command reference with flags and arguments. " +
108
- "'examples' = includes usage examples for each command. " +
109
- "Default: 'detailed'.",
110
- },
111
- },
112
- required: ["topic"],
88
+ annotations: {
89
+ readOnlyHint: true,
90
+ destructiveHint: false,
91
+ idempotentHint: true,
92
+ openWorldHint: false,
113
93
  },
114
- outputSchema: {
115
- type: "object",
116
- properties: {
117
- documentation: {
118
- type: "string",
119
- description: "The CLI documentation content for the requested topic.",
120
- },
121
- },
122
- required: ["documentation"],
94
+ inputShape: {
95
+ topic: z
96
+ .enum(getTopicNames())
97
+ .describe("Documentation topic to retrieve. Start with 'start' for installation and setup. " +
98
+ "Example: topic='function' for function management commands, topic='sandbox' for the personal dev environment."),
99
+ detail_level: z
100
+ .enum(["overview", "detailed", "examples"])
101
+ .optional()
102
+ .describe("Level of detail to return. " +
103
+ "'overview' = brief summary of commands and their purpose. " +
104
+ "'detailed' = full command reference with flags and arguments. " +
105
+ "'examples' = includes usage examples for each command. " +
106
+ "Default: 'detailed'."),
123
107
  },
124
- };
108
+ outputShape: {
109
+ documentation: z
110
+ .string()
111
+ .describe("The CLI documentation content for the requested topic."),
112
+ },
113
+ });
@@ -102,7 +102,7 @@ curl -H "Authorization: Bearer $TOKEN" https://instance.xano.io/api:meta/workspa
102
102
  "Init git: `cd xano && git init && git add . && git commit -m 'Initial'`",
103
103
  "Create feature branch: `git checkout -b feature/new-api`",
104
104
  "Edit .xs files in your IDE",
105
- "Validate with MCP: Use `validate_xanoscript` tool",
105
+ "Validate with MCP: Use `xano_validate_xanoscript` tool",
106
106
  "Push to Xano: `xano workspace push -d ./xano`",
107
107
  "Test in Xano dashboard",
108
108
  "Commit changes: `git add . && git commit -m 'Add new API'`"
@@ -276,7 +276,7 @@ For lighter-weight iterative development without pulling the whole workspace, se
276
276
  "Pull workspace: `xano workspace pull -d ./code`",
277
277
  "Navigate to organized folders: `api/{group}/`, `function/`, `table/`, etc.",
278
278
  "Edit .xs files in your IDE (files use snake_case naming)",
279
- "Validate changes: Use xanoscript_docs MCP tool",
279
+ "Validate changes: Use xano_xanoscript_docs MCP tool",
280
280
  "Push changes: `xano workspace push -d ./code`",
281
281
  "Test in Xano dashboard or via API"
282
282
  ],
package/dist/index.js CHANGED
@@ -7,14 +7,13 @@
7
7
  * import { validateXanoscript, xanoscriptDocs } from '@xano/developer-mcp';
8
8
  * ```
9
9
  */
10
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
10
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
11
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
12
- import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
13
12
  import { readFileSync } from "fs";
14
13
  import { fileURLToPath } from "url";
15
14
  import { dirname, join } from "path";
16
15
  import { XANOSCRIPT_DOCS_V2, getXanoscriptDocsVersion } from "./xanoscript.js";
17
- import { toolDefinitions, handleTool, toMcpResponse, getXanoscriptDocsPath, } from "./tools/index.js";
16
+ import { toolSpecs, handleTool, toMcpResponse, getXanoscriptDocsPath, } from "./tools/index.js";
18
17
  const __filename = fileURLToPath(import.meta.url);
19
18
  const __dirname = dirname(__filename);
20
19
  const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
@@ -23,69 +22,73 @@ if (process.argv.includes("--version") || process.argv.includes("-v")) {
23
22
  console.log(SERVER_VERSION);
24
23
  process.exit(0);
25
24
  }
26
- // =============================================================================
27
- // Path Resolution (uses shared path from tools/xanoscript_docs.ts)
28
- // =============================================================================
29
25
  const XANOSCRIPT_DOCS_PATH = getXanoscriptDocsPath();
30
26
  // =============================================================================
31
27
  // MCP Server Setup
32
28
  // =============================================================================
33
- const server = new Server({
29
+ const server = new McpServer({
34
30
  name: "xano-developer-mcp",
35
31
  version: SERVER_VERSION,
36
- description: "MCP server for Xano Headless API documentation and XanoScript code validation",
37
- }, {
38
- capabilities: {
39
- tools: {},
40
- resources: {},
41
- },
42
32
  });
43
33
  // =============================================================================
44
- // Resource Handlers (MCP Resources)
34
+ // Tool Registration
45
35
  // =============================================================================
46
- server.setRequestHandler(ListResourcesRequestSchema, async () => {
47
- const resources = Object.entries(XANOSCRIPT_DOCS_V2).map(([key, config]) => ({
48
- uri: `xanoscript://docs/${key}`,
49
- name: key,
50
- description: config.description,
51
- mimeType: "text/markdown",
52
- }));
53
- return { resources };
54
- });
55
- server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
56
- const { uri } = request.params;
57
- const match = uri.match(/^xanoscript:\/\/docs\/(.+)$/);
58
- if (!match) {
59
- throw new Error(`Unknown resource URI: ${uri}`);
60
- }
61
- const topic = match[1];
62
- const config = XANOSCRIPT_DOCS_V2[topic];
63
- if (!config) {
64
- throw new Error(`Unknown topic: ${topic}. Available: ${Object.keys(XANOSCRIPT_DOCS_V2).join(", ")}`);
65
- }
66
- const content = readFileSync(join(XANOSCRIPT_DOCS_PATH, config.file), "utf-8");
67
- const version = getXanoscriptDocsVersion(XANOSCRIPT_DOCS_PATH);
68
- return {
69
- contents: [
70
- {
71
- uri,
72
- mimeType: "text/markdown",
73
- text: `${content}\n\n---\nDocumentation version: ${version}`,
74
- },
75
- ],
76
- };
77
- });
36
+ for (const spec of Object.values(toolSpecs)) {
37
+ server.registerTool(spec.name, {
38
+ description: spec.description,
39
+ annotations: spec.annotations,
40
+ inputSchema: spec.inputShape,
41
+ outputSchema: spec.outputShape,
42
+ },
43
+ // The SDK validates args against `inputShape` before invoking; handleTool
44
+ // re-parses defensively so it's also safe to call from library code.
45
+ // Any thrown error is converted into a structured ToolResult so the client
46
+ // sees a useful message instead of a transport-level failure.
47
+ async (args) => {
48
+ try {
49
+ const result = await handleTool(spec.name, args ?? {});
50
+ return toMcpResponse(result);
51
+ }
52
+ catch (error) {
53
+ const message = error instanceof Error ? error.message : String(error);
54
+ console.error(`[${spec.name}] handler threw:`, error);
55
+ return toMcpResponse({
56
+ success: false,
57
+ error: `Internal error in ${spec.name}: ${message}`,
58
+ });
59
+ }
60
+ });
61
+ }
78
62
  // =============================================================================
79
- // Tool Handlers
63
+ // Resource Registration (XanoScript docs as MCP resources)
80
64
  // =============================================================================
81
- server.setRequestHandler(ListToolsRequestSchema, async () => {
82
- return { tools: toolDefinitions };
83
- });
84
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
85
- const { name, arguments: args } = request.params;
86
- const result = handleTool(name, args || {});
87
- return toMcpResponse(result);
88
- });
65
+ for (const [key, config] of Object.entries(XANOSCRIPT_DOCS_V2)) {
66
+ const resourceUri = `xanoscript://docs/${key}`;
67
+ server.registerResource(key, resourceUri, {
68
+ description: config.description,
69
+ mimeType: "text/markdown",
70
+ }, async (uri) => {
71
+ try {
72
+ const content = readFileSync(join(XANOSCRIPT_DOCS_PATH, config.file), "utf-8");
73
+ const version = getXanoscriptDocsVersion(XANOSCRIPT_DOCS_PATH);
74
+ return {
75
+ contents: [
76
+ {
77
+ uri: uri.href,
78
+ mimeType: "text/markdown",
79
+ text: `${content}\n\n---\nDocumentation version: ${version}`,
80
+ },
81
+ ],
82
+ };
83
+ }
84
+ catch (error) {
85
+ const message = error instanceof Error ? error.message : String(error);
86
+ console.error(`[resource ${key}] Failed to read ${config.file} from ${XANOSCRIPT_DOCS_PATH}:`, error);
87
+ throw new Error(`Failed to read XanoScript docs resource "${key}" (${uri.href}) ` +
88
+ `from ${join(XANOSCRIPT_DOCS_PATH, config.file)}: ${message}`);
89
+ }
90
+ });
91
+ }
89
92
  // =============================================================================
90
93
  // Start Server
91
94
  // =============================================================================
package/dist/lib.d.ts CHANGED
@@ -48,4 +48,6 @@ export { metaApiDocs, metaApiTopics, getMetaApiTopicNames, getMetaApiTopicDescri
48
48
  export { cliDocs, cliTopics, getCliTopicNames, getCliTopicDescriptions, type CliDocsArgs, type CliDocsResult, } from "./tools/cli_docs.js";
49
49
  export { type ToolResult, toMcpResponse } from "./tools/types.js";
50
50
  export { XANOSCRIPT_DOCS_V2, readXanoscriptDocsV2, readXanoscriptDocsStructured, getDocsForFilePath, extractQuickReference, getXanoscriptDocsVersion, clearDocsCache, getTopicNames as getXanoscriptTopicNames, getTopicDescriptions as getXanoscriptTopicDescriptions, type DocConfig, } from "./xanoscript.js";
51
- export { toolDefinitions, handleTool, validateXanoscriptToolDefinition, xanoscriptDocsToolDefinition, mcpVersionToolDefinition, metaApiDocsToolDefinition, cliDocsToolDefinition, } from "./tools/index.js";
51
+ export { toolDefinitions, toolSpecs, handleTool, } from "./tools/index.js";
52
+ export type { ToolName } from "./tools/index.js";
53
+ export type { BuiltTool, ToolDefinition, ToolSpec, ToolAnnotations, JsonSchema, } from "./tools/define_tool.js";
package/dist/lib.js CHANGED
@@ -65,4 +65,4 @@ export { XANOSCRIPT_DOCS_V2, readXanoscriptDocsV2, readXanoscriptDocsStructured,
65
65
  // =============================================================================
66
66
  // MCP Tool Definitions (for building custom MCP servers)
67
67
  // =============================================================================
68
- export { toolDefinitions, handleTool, validateXanoscriptToolDefinition, xanoscriptDocsToolDefinition, mcpVersionToolDefinition, metaApiDocsToolDefinition, cliDocsToolDefinition, } from "./tools/index.js";
68
+ export { toolDefinitions, toolSpecs, handleTool, } from "./tools/index.js";
@@ -11,7 +11,7 @@ https://<your-instance-subdomain>.xano.io/api:meta/<endpoint>
11
11
  \`\`\`
12
12
  Authorization: \`Bearer <your-access-token>\`
13
13
  `,
14
- toolName: "meta_api_docs",
14
+ toolName: "xano_meta_api_docs",
15
15
  };
16
16
  function formatParameter(param) {
17
17
  const required = param.required ? " (required)" : "";