@venizia/ignis-docs 0.0.1-1

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 (123) hide show
  1. package/mcp-server/dist/common/config.d.ts +27 -0
  2. package/mcp-server/dist/common/config.d.ts.map +1 -0
  3. package/mcp-server/dist/common/config.js +27 -0
  4. package/mcp-server/dist/common/config.js.map +1 -0
  5. package/mcp-server/dist/common/index.d.ts +3 -0
  6. package/mcp-server/dist/common/index.d.ts.map +1 -0
  7. package/mcp-server/dist/common/index.js +19 -0
  8. package/mcp-server/dist/common/index.js.map +1 -0
  9. package/mcp-server/dist/common/paths.d.ts +13 -0
  10. package/mcp-server/dist/common/paths.d.ts.map +1 -0
  11. package/mcp-server/dist/common/paths.js +23 -0
  12. package/mcp-server/dist/common/paths.js.map +1 -0
  13. package/mcp-server/dist/helpers/docs.helper.d.ts +81 -0
  14. package/mcp-server/dist/helpers/docs.helper.d.ts.map +1 -0
  15. package/mcp-server/dist/helpers/docs.helper.js +171 -0
  16. package/mcp-server/dist/helpers/docs.helper.js.map +1 -0
  17. package/mcp-server/dist/helpers/index.d.ts +3 -0
  18. package/mcp-server/dist/helpers/index.d.ts.map +1 -0
  19. package/mcp-server/dist/helpers/index.js +19 -0
  20. package/mcp-server/dist/helpers/index.js.map +1 -0
  21. package/mcp-server/dist/helpers/logger.helper.d.ts +7 -0
  22. package/mcp-server/dist/helpers/logger.helper.d.ts.map +1 -0
  23. package/mcp-server/dist/helpers/logger.helper.js +22 -0
  24. package/mcp-server/dist/helpers/logger.helper.js.map +1 -0
  25. package/mcp-server/dist/index.d.ts +3 -0
  26. package/mcp-server/dist/index.d.ts.map +1 -0
  27. package/mcp-server/dist/index.js +62 -0
  28. package/mcp-server/dist/index.js.map +1 -0
  29. package/mcp-server/dist/tools/base.tool.d.ts +98 -0
  30. package/mcp-server/dist/tools/base.tool.d.ts.map +1 -0
  31. package/mcp-server/dist/tools/base.tool.js +47 -0
  32. package/mcp-server/dist/tools/base.tool.js.map +1 -0
  33. package/mcp-server/dist/tools/get-doc-content.tool.d.ts +30 -0
  34. package/mcp-server/dist/tools/get-doc-content.tool.d.ts.map +1 -0
  35. package/mcp-server/dist/tools/get-doc-content.tool.js +127 -0
  36. package/mcp-server/dist/tools/get-doc-content.tool.js.map +1 -0
  37. package/mcp-server/dist/tools/get-doc-metadata.tool.d.ts +40 -0
  38. package/mcp-server/dist/tools/get-doc-metadata.tool.d.ts.map +1 -0
  39. package/mcp-server/dist/tools/get-doc-metadata.tool.js +121 -0
  40. package/mcp-server/dist/tools/get-doc-metadata.tool.js.map +1 -0
  41. package/mcp-server/dist/tools/index.d.ts +8 -0
  42. package/mcp-server/dist/tools/index.d.ts.map +1 -0
  43. package/mcp-server/dist/tools/index.js +18 -0
  44. package/mcp-server/dist/tools/index.js.map +1 -0
  45. package/mcp-server/dist/tools/list-categories.tool.d.ts +20 -0
  46. package/mcp-server/dist/tools/list-categories.tool.d.ts.map +1 -0
  47. package/mcp-server/dist/tools/list-categories.tool.js +105 -0
  48. package/mcp-server/dist/tools/list-categories.tool.js.map +1 -0
  49. package/mcp-server/dist/tools/list-docs.tool.d.ts +32 -0
  50. package/mcp-server/dist/tools/list-docs.tool.d.ts.map +1 -0
  51. package/mcp-server/dist/tools/list-docs.tool.js +121 -0
  52. package/mcp-server/dist/tools/list-docs.tool.js.map +1 -0
  53. package/mcp-server/dist/tools/search-docs.tool.d.ts +32 -0
  54. package/mcp-server/dist/tools/search-docs.tool.d.ts.map +1 -0
  55. package/mcp-server/dist/tools/search-docs.tool.js +120 -0
  56. package/mcp-server/dist/tools/search-docs.tool.js.map +1 -0
  57. package/package.json +102 -0
  58. package/wiki/get-started/5-minute-quickstart.md +266 -0
  59. package/wiki/get-started/best-practices/api-usage-examples.md +222 -0
  60. package/wiki/get-started/best-practices/architectural-patterns.md +129 -0
  61. package/wiki/get-started/best-practices/code-style-standards.md +122 -0
  62. package/wiki/get-started/best-practices/common-pitfalls.md +136 -0
  63. package/wiki/get-started/best-practices/contribution-workflow.md +145 -0
  64. package/wiki/get-started/best-practices/deployment-strategies.md +121 -0
  65. package/wiki/get-started/best-practices/performance-optimization.md +88 -0
  66. package/wiki/get-started/best-practices/security-guidelines.md +97 -0
  67. package/wiki/get-started/best-practices/troubleshooting-tips.md +100 -0
  68. package/wiki/get-started/building-a-crud-api.md +717 -0
  69. package/wiki/get-started/core-concepts/application.md +168 -0
  70. package/wiki/get-started/core-concepts/components.md +96 -0
  71. package/wiki/get-started/core-concepts/controllers.md +441 -0
  72. package/wiki/get-started/core-concepts/dependency-injection.md +160 -0
  73. package/wiki/get-started/core-concepts/persistent.md +591 -0
  74. package/wiki/get-started/core-concepts/services.md +88 -0
  75. package/wiki/get-started/index.md +65 -0
  76. package/wiki/get-started/mcp-docs-server.md +840 -0
  77. package/wiki/get-started/philosophy.md +123 -0
  78. package/wiki/get-started/prerequisites.md +113 -0
  79. package/wiki/get-started/quickstart.md +382 -0
  80. package/wiki/index.md +48 -0
  81. package/wiki/references/base/application.md +67 -0
  82. package/wiki/references/base/components.md +80 -0
  83. package/wiki/references/base/controllers.md +361 -0
  84. package/wiki/references/base/datasources.md +105 -0
  85. package/wiki/references/base/dependency-injection.md +83 -0
  86. package/wiki/references/base/models.md +104 -0
  87. package/wiki/references/base/repositories.md +118 -0
  88. package/wiki/references/base/services.md +97 -0
  89. package/wiki/references/components/authentication.md +224 -0
  90. package/wiki/references/components/health-check.md +190 -0
  91. package/wiki/references/components/index.md +61 -0
  92. package/wiki/references/components/request-tracker.md +35 -0
  93. package/wiki/references/components/socket-io.md +127 -0
  94. package/wiki/references/components/swagger.md +175 -0
  95. package/wiki/references/helpers/cron.md +94 -0
  96. package/wiki/references/helpers/crypto.md +117 -0
  97. package/wiki/references/helpers/env.md +67 -0
  98. package/wiki/references/helpers/error.md +80 -0
  99. package/wiki/references/helpers/index.md +21 -0
  100. package/wiki/references/helpers/inversion.md +141 -0
  101. package/wiki/references/helpers/logger.md +98 -0
  102. package/wiki/references/helpers/network.md +143 -0
  103. package/wiki/references/helpers/queue.md +131 -0
  104. package/wiki/references/helpers/redis.md +121 -0
  105. package/wiki/references/helpers/socket-io.md +103 -0
  106. package/wiki/references/helpers/storage.md +130 -0
  107. package/wiki/references/helpers/testing.md +115 -0
  108. package/wiki/references/helpers/worker-thread.md +162 -0
  109. package/wiki/references/src-details/core.md +249 -0
  110. package/wiki/references/src-details/dev-configs.md +302 -0
  111. package/wiki/references/src-details/docs.md +61 -0
  112. package/wiki/references/src-details/helpers.md +211 -0
  113. package/wiki/references/src-details/inversion.md +345 -0
  114. package/wiki/references/src-details/mcp-server.md +726 -0
  115. package/wiki/references/utilities/crypto.md +39 -0
  116. package/wiki/references/utilities/date.md +72 -0
  117. package/wiki/references/utilities/index.md +12 -0
  118. package/wiki/references/utilities/module.md +40 -0
  119. package/wiki/references/utilities/parse.md +68 -0
  120. package/wiki/references/utilities/performance.md +64 -0
  121. package/wiki/references/utilities/promise.md +83 -0
  122. package/wiki/references/utilities/request.md +66 -0
  123. package/wiki/references/utilities/schema.md +88 -0
@@ -0,0 +1,27 @@
1
+ export declare const MCP_CONFIG: {
2
+ readonly server: {
3
+ readonly name: "ignis-docs";
4
+ readonly version: "0.0.1";
5
+ };
6
+ readonly search: {
7
+ readonly snippetLength: 300;
8
+ readonly defaultLimit: 10;
9
+ readonly maxLimit: 50;
10
+ readonly minQueryLength: 2;
11
+ };
12
+ readonly fuse: {
13
+ readonly includeScore: true;
14
+ readonly threshold: 0.4;
15
+ readonly minMatchCharLength: 2;
16
+ readonly findAllMatches: true;
17
+ readonly ignoreLocation: true;
18
+ readonly keys: readonly [{
19
+ readonly name: "title";
20
+ readonly weight: 0.7;
21
+ }, {
22
+ readonly name: "content";
23
+ readonly weight: 0.3;
24
+ }];
25
+ };
26
+ };
27
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../common/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;CAsBb,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MCP_CONFIG = void 0;
4
+ exports.MCP_CONFIG = {
5
+ server: {
6
+ name: "ignis-docs",
7
+ version: "0.0.1",
8
+ },
9
+ search: {
10
+ snippetLength: 300,
11
+ defaultLimit: 10,
12
+ maxLimit: 50,
13
+ minQueryLength: 2,
14
+ },
15
+ fuse: {
16
+ includeScore: true,
17
+ threshold: 0.4,
18
+ minMatchCharLength: 2,
19
+ findAllMatches: true,
20
+ ignoreLocation: true,
21
+ keys: [
22
+ { name: "title", weight: 0.7 },
23
+ { name: "content", weight: 0.3 },
24
+ ],
25
+ },
26
+ };
27
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../common/config.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACxB,MAAM,EAAE;QACN,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,OAAO;KACjB;IACD,MAAM,EAAE;QACN,aAAa,EAAE,GAAG;QAClB,YAAY,EAAE,EAAE;QAChB,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE,CAAC;KAClB;IACD,IAAI,EAAE;QACJ,YAAY,EAAE,IAAI;QAClB,SAAS,EAAE,GAAG;QACd,kBAAkB,EAAE,CAAC;QACrB,cAAc,EAAE,IAAI;QACpB,cAAc,EAAE,IAAI;QACpB,IAAI,EAAE;YACJ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE;YAC9B,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE;SACjC;KACF;CACO,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./paths";
2
+ export * from "./config";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../common/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./paths"), exports);
18
+ __exportStar(require("./config"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB"}
@@ -0,0 +1,13 @@
1
+ export declare class Paths {
2
+ static readonly WIKI: string;
3
+ static readonly GET_STARTED: string;
4
+ static readonly BEST_PRACTICES: string;
5
+ static readonly CORE_CONCEPTS: string;
6
+ static readonly REFERENCES: string;
7
+ static readonly BASE: string;
8
+ static readonly COMPONENTS: string;
9
+ static readonly HELPERS: string;
10
+ static readonly SOURCE_DETAILS: string;
11
+ static readonly UTILITIES: string;
12
+ }
13
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../common/paths.ts"],"names":[],"mappings":"AAKA,qBAAa,KAAK;IAChB,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAgC;IAEpD,MAAM,CAAC,QAAQ,CAAC,WAAW,SAAuC;IAClE,MAAM,CAAC,QAAQ,CAAC,cAAc,SAAiD;IAC/E,MAAM,CAAC,QAAQ,CAAC,aAAa,SAAgD;IAE7E,MAAM,CAAC,QAAQ,CAAC,UAAU,SAAsC;IAChE,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAsC;IAC1D,MAAM,CAAC,QAAQ,CAAC,UAAU,SAA4C;IACtE,MAAM,CAAC,QAAQ,CAAC,OAAO,SAAyC;IAChE,MAAM,CAAC,QAAQ,CAAC,cAAc,SAA6C;IAC3E,MAAM,CAAC,QAAQ,CAAC,SAAS,SAA2C;CACrE"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Paths = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const MCP_ROOT = __dirname;
9
+ const DOCS_ROOT = node_path_1.default.resolve(MCP_ROOT, "..", "..");
10
+ class Paths {
11
+ static { this.WIKI = node_path_1.default.join(DOCS_ROOT, "wiki"); }
12
+ static { this.GET_STARTED = node_path_1.default.join(this.WIKI, "get-started"); }
13
+ static { this.BEST_PRACTICES = node_path_1.default.join(this.GET_STARTED, "best-practices"); }
14
+ static { this.CORE_CONCEPTS = node_path_1.default.join(this.GET_STARTED, "core-concepts"); }
15
+ static { this.REFERENCES = node_path_1.default.join(this.WIKI, "references"); }
16
+ static { this.BASE = node_path_1.default.join(this.REFERENCES, "base"); }
17
+ static { this.COMPONENTS = node_path_1.default.join(this.REFERENCES, "components"); }
18
+ static { this.HELPERS = node_path_1.default.join(this.REFERENCES, "helpers"); }
19
+ static { this.SOURCE_DETAILS = node_path_1.default.join(this.REFERENCES, "src-details"); }
20
+ static { this.UTILITIES = node_path_1.default.join(this.REFERENCES, "utilities"); }
21
+ }
22
+ exports.Paths = Paths;
23
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../common/paths.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAE7B,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,MAAM,SAAS,GAAG,mBAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAErD,MAAa,KAAK;aACA,SAAI,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;aAEpC,gBAAW,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;aAClD,mBAAc,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;aAC/D,kBAAa,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;aAE7D,eAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;aAChD,SAAI,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;aAC1C,eAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;aACtD,YAAO,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;aAChD,mBAAc,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;aAC3D,cAAS,GAAG,mBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;;AAZtE,sBAaC"}
@@ -0,0 +1,81 @@
1
+ interface IDoc {
2
+ id: string;
3
+ title: string;
4
+ content: string;
5
+ category: string;
6
+ filePath: string;
7
+ }
8
+ interface ISearchOptions {
9
+ query: string;
10
+ limit?: number;
11
+ }
12
+ export declare class DocsHelper {
13
+ private static _docs;
14
+ private static _fuse;
15
+ /**
16
+ * Loads and caches documentation from the wiki.
17
+ */
18
+ static loadDocumentation(): Promise<IDoc[]>;
19
+ /**
20
+ * Clears the documentation cache.
21
+ */
22
+ static clearCache(): void;
23
+ /**
24
+ * Generates a smart snippet from content.
25
+ */
26
+ private static generateSnippet;
27
+ /**
28
+ * Searches the loaded documentation.
29
+ */
30
+ static searchDocs(opts: ISearchOptions): Promise<{
31
+ id: string;
32
+ title: string;
33
+ category: string;
34
+ snippet: string;
35
+ score: number | undefined;
36
+ }[]>;
37
+ /**
38
+ * Gets the full content of a specific document.
39
+ */
40
+ static getDocContent(opts: {
41
+ id: string;
42
+ }): Promise<string | null>;
43
+ /**
44
+ * Lists all available documentation files.
45
+ */
46
+ static listDocs(opts: {
47
+ category?: string;
48
+ }): Promise<{
49
+ id: string;
50
+ title: string;
51
+ category: string;
52
+ }[]>;
53
+ /**
54
+ * Lists all unique categories in the documentation.
55
+ */
56
+ static listCategories(): Promise<string[]>;
57
+ /**
58
+ * Gets metadata about a specific document.
59
+ */
60
+ static getDocMetadata(opts: {
61
+ id: string;
62
+ }): Promise<{
63
+ id: string;
64
+ title: string;
65
+ category: string;
66
+ wordCount: number;
67
+ charCount: number;
68
+ lastModified: Date;
69
+ size: number;
70
+ } | {
71
+ id: string;
72
+ title: string;
73
+ category: string;
74
+ wordCount: number;
75
+ charCount: number;
76
+ lastModified?: undefined;
77
+ size?: undefined;
78
+ } | null>;
79
+ }
80
+ export {};
81
+ //# sourceMappingURL=docs.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs.helper.d.ts","sourceRoot":"","sources":["../../helpers/docs.helper.ts"],"names":[],"mappings":"AAQA,UAAU,IAAI;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAc;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAA2B;IAE/C;;OAEG;WACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IA+CjD;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,IAAI;IAMzB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAc9B;;OAEG;WACU,UAAU,CAAC,IAAI,EAAE,cAAc;;;;;;;IAqB5C;;OAEG;WACU,aAAa,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAYxE;;OAEG;WACU,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;IAgBjD;;OAEG;WACU,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAShD;;OAEG;WACU,cAAc,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;CAiCjD"}
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DocsHelper = void 0;
7
+ const fast_glob_1 = __importDefault(require("fast-glob"));
8
+ const fuse_js_1 = __importDefault(require("fuse.js"));
9
+ const gray_matter_1 = __importDefault(require("gray-matter"));
10
+ const promises_1 = __importDefault(require("node:fs/promises"));
11
+ const node_path_1 = __importDefault(require("node:path"));
12
+ const common_1 = require("../common");
13
+ const logger_helper_1 = require("./logger.helper");
14
+ class DocsHelper {
15
+ static { this._docs = []; }
16
+ static { this._fuse = null; }
17
+ /**
18
+ * Loads and caches documentation from the wiki.
19
+ */
20
+ static async loadDocumentation() {
21
+ if (this._docs.length > 0) {
22
+ return this._docs;
23
+ }
24
+ try {
25
+ const files = await (0, fast_glob_1.default)("**/*.md", {
26
+ cwd: common_1.Paths.WIKI,
27
+ absolute: true,
28
+ ignore: ["node_modules"],
29
+ });
30
+ if (files.length === 0) {
31
+ logger_helper_1.Logger.warn(`No documentation files found in ${common_1.Paths.WIKI}`);
32
+ return [];
33
+ }
34
+ this._docs = await Promise.all(files.map(async (file) => {
35
+ const rawContent = await promises_1.default.readFile(file, "utf-8");
36
+ const { data, content } = (0, gray_matter_1.default)(rawContent);
37
+ return {
38
+ id: node_path_1.default.relative(common_1.Paths.WIKI, file),
39
+ title: data.title || node_path_1.default.basename(file, ".md"),
40
+ content,
41
+ category: data.category || "Uncategorized",
42
+ filePath: file,
43
+ };
44
+ }));
45
+ this._fuse = new fuse_js_1.default(this._docs, {
46
+ ...common_1.MCP_CONFIG.fuse,
47
+ keys: common_1.MCP_CONFIG.fuse.keys,
48
+ });
49
+ logger_helper_1.Logger.info(`Loaded ${this._docs.length} documentation files`);
50
+ return this._docs;
51
+ }
52
+ catch (error) {
53
+ logger_helper_1.Logger.error("Failed to load documentation:", error);
54
+ throw new Error(`Documentation loading failed: ${error instanceof Error ? error.message : "Unknown error"}`);
55
+ }
56
+ }
57
+ /**
58
+ * Clears the documentation cache.
59
+ */
60
+ static clearCache() {
61
+ this._docs = [];
62
+ this._fuse = null;
63
+ logger_helper_1.Logger.debug("Documentation cache cleared");
64
+ }
65
+ /**
66
+ * Generates a smart snippet from content.
67
+ */
68
+ static generateSnippet(content, maxLength = common_1.MCP_CONFIG.search.snippetLength) {
69
+ if (content.length <= maxLength) {
70
+ return content;
71
+ }
72
+ const trimmed = content.substring(0, maxLength);
73
+ const lastSpace = trimmed.lastIndexOf(" ");
74
+ return (lastSpace > 0 ? trimmed.substring(0, lastSpace) : trimmed) + "...";
75
+ }
76
+ /**
77
+ * Searches the loaded documentation.
78
+ */
79
+ static async searchDocs(opts) {
80
+ if (!this._fuse) {
81
+ await this.loadDocumentation();
82
+ }
83
+ if (!this._fuse) {
84
+ return [];
85
+ }
86
+ const limit = opts.limit ?? common_1.MCP_CONFIG.search.defaultLimit;
87
+ const results = this._fuse.search(opts.query).slice(0, limit);
88
+ return results.map(result => ({
89
+ id: result.item.id,
90
+ title: result.item.title,
91
+ category: result.item.category,
92
+ snippet: this.generateSnippet(result.item.content),
93
+ score: result.score,
94
+ }));
95
+ }
96
+ /**
97
+ * Gets the full content of a specific document.
98
+ */
99
+ static async getDocContent(opts) {
100
+ if (this._docs.length === 0) {
101
+ await this.loadDocumentation();
102
+ }
103
+ const doc = this._docs.find(d => d.id === opts.id);
104
+ if (doc) {
105
+ return doc.content;
106
+ }
107
+ return null;
108
+ }
109
+ /**
110
+ * Lists all available documentation files.
111
+ */
112
+ static async listDocs(opts) {
113
+ if (this._docs.length === 0) {
114
+ await this.loadDocumentation();
115
+ }
116
+ const filteredDocs = opts.category
117
+ ? this._docs.filter(d => d.category === opts.category)
118
+ : this._docs;
119
+ return filteredDocs.map(doc => ({
120
+ id: doc.id,
121
+ title: doc.title,
122
+ category: doc.category,
123
+ }));
124
+ }
125
+ /**
126
+ * Lists all unique categories in the documentation.
127
+ */
128
+ static async listCategories() {
129
+ if (this._docs.length === 0) {
130
+ await this.loadDocumentation();
131
+ }
132
+ const categories = new Set(this._docs.map(d => d.category));
133
+ return Array.from(categories).sort();
134
+ }
135
+ /**
136
+ * Gets metadata about a specific document.
137
+ */
138
+ static async getDocMetadata(opts) {
139
+ if (this._docs.length === 0) {
140
+ await this.loadDocumentation();
141
+ }
142
+ const doc = this._docs.find(d => d.id === opts.id);
143
+ if (!doc) {
144
+ return null;
145
+ }
146
+ try {
147
+ const stats = await promises_1.default.stat(doc.filePath);
148
+ return {
149
+ id: doc.id,
150
+ title: doc.title,
151
+ category: doc.category,
152
+ wordCount: doc.content.split(/\s+/).filter(Boolean).length,
153
+ charCount: doc.content.length,
154
+ lastModified: stats.mtime,
155
+ size: stats.size,
156
+ };
157
+ }
158
+ catch (error) {
159
+ logger_helper_1.Logger.error(`Failed to get metadata for ${opts.id}:`, error);
160
+ return {
161
+ id: doc.id,
162
+ title: doc.title,
163
+ category: doc.category,
164
+ wordCount: doc.content.split(/\s+/).filter(Boolean).length,
165
+ charCount: doc.content.length,
166
+ };
167
+ }
168
+ }
169
+ }
170
+ exports.DocsHelper = DocsHelper;
171
+ //# sourceMappingURL=docs.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs.helper.js","sourceRoot":"","sources":["../../helpers/docs.helper.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA2B;AAC3B,sDAA2B;AAC3B,8DAAiC;AACjC,gEAAkC;AAClC,0DAA6B;AAC7B,sCAA8C;AAC9C,mDAAyC;AAezC,MAAa,UAAU;aACN,UAAK,GAAW,EAAE,CAAC;aACnB,UAAK,GAAsB,IAAI,CAAC;IAE/C;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,iBAAiB;QAC5B,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;QAED,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,IAAA,mBAAE,EAAC,SAAS,EAAE;gBAChC,GAAG,EAAE,cAAK,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,CAAC,cAAc,CAAC;aACzB,CAAC,CAAC;YAEH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvB,sBAAM,CAAC,IAAI,CAAC,mCAAmC,cAAK,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC7D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MAAM;gBAC7B,YAAY,EAAE,KAAK,CAAC,KAAK;gBACzB,IAAI,EAAE,KAAK,CAAC,IAAI;aACjB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,sBAAM,CAAC,KAAK,CAAC,8BAA8B,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;YAC9D,OAAO;gBACL,EAAE,EAAE,GAAG,CAAC,EAAE;gBACV,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM;gBAC1D,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM;aAC9B,CAAC;QACJ,CAAC;IACH,CAAC;;AAzLH,gCA0LC"}
@@ -0,0 +1,3 @@
1
+ export * from "./docs.helper";
2
+ export * from "./logger.helper";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./docs.helper"), exports);
18
+ __exportStar(require("./logger.helper"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,kDAAgC"}
@@ -0,0 +1,7 @@
1
+ export declare class Logger {
2
+ static info(message: string, ...args: unknown[]): void;
3
+ static warn(message: string, ...args: unknown[]): void;
4
+ static error(message: string, ...args: unknown[]): void;
5
+ static debug(message: string, ...args: unknown[]): void;
6
+ }
7
+ //# sourceMappingURL=logger.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.helper.d.ts","sourceRoot":"","sources":["../../helpers/logger.helper.ts"],"names":[],"mappings":"AAAA,qBAAa,MAAM;IACjB,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAI/C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAI/C,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAIhD,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;CAOjD"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Logger = void 0;
4
+ class Logger {
5
+ static info(message, ...args) {
6
+ console.log(`[INFO] ${message}`, ...args);
7
+ }
8
+ static warn(message, ...args) {
9
+ console.warn(`[WARN] ${message}`, ...args);
10
+ }
11
+ static error(message, ...args) {
12
+ console.error(`[ERROR] ${message}`, ...args);
13
+ }
14
+ static debug(message, ...args) {
15
+ if (!process.env.DEBUG) {
16
+ return;
17
+ }
18
+ console.log(`[DEBUG] ${message}`, ...args);
19
+ }
20
+ }
21
+ exports.Logger = Logger;
22
+ //# sourceMappingURL=logger.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.helper.js","sourceRoot":"","sources":["../../helpers/logger.helper.ts"],"names":[],"mappings":";;;AAAA,MAAa,MAAM;IACjB,MAAM,CAAC,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;QAC7C,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;QAC7C,OAAO,CAAC,IAAI,CAAC,UAAU,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QAC9C,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QAC9C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF;AApBD,wBAoBC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const mcp_1 = require("@mastra/mcp");
5
+ const helpers_1 = require("./helpers");
6
+ const tools_1 = require("./tools");
7
+ // ----------------------------------------------------------------------------
8
+ // MCP SERVER CONFIGURATION
9
+ // ----------------------------------------------------------------------------
10
+ const mcpServer = new mcp_1.MCPServer({
11
+ name: "ignis-docs",
12
+ version: "0.0.1",
13
+ // Register tools using singleton instances
14
+ tools: {
15
+ search: new tools_1.SearchDocsTool().getTool(),
16
+ getDocContent: new tools_1.GetDocContentTool().getTool(),
17
+ listDocs: new tools_1.ListDocsTool().getTool(),
18
+ listCategories: new tools_1.ListCategoriesTool().getTool(),
19
+ getDocMetadata: new tools_1.GetDocMetadataTool().getTool(),
20
+ },
21
+ // Resource handlers for direct document access
22
+ resources: {
23
+ listResources: async () => {
24
+ const docs = await helpers_1.DocsHelper.loadDocumentation();
25
+ return docs.map(doc => {
26
+ const wordCount = doc.content.split(/\s+/).filter(Boolean).length;
27
+ return {
28
+ uri: `ignis://docs/${doc.id}`,
29
+ name: doc.title,
30
+ description: `${doc.category} - ${wordCount} words`,
31
+ mimeType: "text/markdown",
32
+ };
33
+ });
34
+ },
35
+ getResourceContent: async ({ uri }) => {
36
+ const id = uri.replace("ignis://docs/", "");
37
+ const content = await helpers_1.DocsHelper.getDocContent({ id });
38
+ if (content === null) {
39
+ return { text: `Resource not found: ${id}` };
40
+ }
41
+ return { text: content };
42
+ },
43
+ },
44
+ });
45
+ // ----------------------------------------------------------------------------
46
+ // SERVER INITIALIZATION
47
+ // ----------------------------------------------------------------------------
48
+ const main = async () => {
49
+ helpers_1.Logger.info("[main] Initializing Ignis MCP Documentation Server...");
50
+ try {
51
+ await helpers_1.DocsHelper.loadDocumentation();
52
+ helpers_1.Logger.info("[main] Documentation loaded successfully.");
53
+ await mcpServer.startStdio();
54
+ helpers_1.Logger.info("[main] Server started in Stdio mode.");
55
+ }
56
+ catch (error) {
57
+ helpers_1.Logger.error("Fatal error:", error);
58
+ process.exit(1);
59
+ }
60
+ };
61
+ main();
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","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,OAAO,GAAG,MAAM,oBAAU,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAEvD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACrB,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,EAAE,CAAC;YAC/C,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAC3B,CAAC;KACF;CACF,CAAC,CAAC;AAEH,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;IACtB,gBAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;IAErE,IAAI,CAAC;QACH,MAAM,oBAAU,CAAC,iBAAiB,EAAE,CAAC;QACrC,gBAAM,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QAEzD,MAAM,SAAS,CAAC,UAAU,EAAE,CAAC;QAC7B,gBAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAM,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AAEF,IAAI,EAAE,CAAC"}
@@ -0,0 +1,98 @@
1
+ import { createTool } from "@mastra/core/tools";
2
+ import type { z } from "zod";
3
+ /**
4
+ * The tool type returned by createTool.
5
+ */
6
+ export type TMastraTool = ReturnType<typeof createTool>;
7
+ /**
8
+ * Re-export createTool for use in subclasses.
9
+ */
10
+ export { createTool };
11
+ /**
12
+ * Abstract base class for all MCP documentation tools.
13
+ *
14
+ * Provides a consistent structure for tool implementation with:
15
+ * - Singleton pattern via getInstance()
16
+ * - Required abstract members for tool definition
17
+ * - Abstract toMastraTool() for type-safe conversion
18
+ *
19
+ * @template TInputSchema - The Zod input schema type
20
+ * @template TOutputSchema - The Zod output schema type
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * class MyTool extends BaseTool<typeof InputSchema, typeof OutputSchema> {
25
+ * readonly id = 'myTool';
26
+ * readonly description = 'Does something useful';
27
+ * readonly inputSchema = InputSchema;
28
+ * readonly outputSchema = OutputSchema;
29
+ *
30
+ * async execute(input: z.infer<typeof InputSchema>) {
31
+ * return { result: 'done' };
32
+ * }
33
+ *
34
+ * toMastraTool() {
35
+ * return createTool({
36
+ * id: this.id,
37
+ * description: this.description,
38
+ * inputSchema: this.inputSchema,
39
+ * outputSchema: this.outputSchema,
40
+ * execute: async ({ context }) => this.execute(context),
41
+ * });
42
+ * }
43
+ * }
44
+ * ```
45
+ */
46
+ export declare abstract class BaseTool<TInputSchema extends z.ZodType = z.ZodType, TOutputSchema extends z.ZodType = z.ZodType> {
47
+ /**
48
+ * Unique identifier for the tool.
49
+ * Used by MCP clients to invoke the tool.
50
+ *
51
+ * @example 'searchDocs', 'getDocContent', 'listCategories'
52
+ */
53
+ abstract readonly id: string;
54
+ /**
55
+ * Detailed description of the tool's purpose and usage.
56
+ * Should include: PURPOSE, WHEN TO USE, WHEN NOT TO USE, OUTPUT description.
57
+ * This helps AI agents understand when and how to use the tool.
58
+ */
59
+ abstract readonly description: string;
60
+ /**
61
+ * Zod schema defining the input parameters.
62
+ * Each field should have a .describe() for AI agent guidance.
63
+ */
64
+ abstract readonly inputSchema: TInputSchema;
65
+ /**
66
+ * Zod schema defining the output structure.
67
+ * Helps AI agents understand and parse the response.
68
+ */
69
+ abstract readonly outputSchema: TOutputSchema;
70
+ /**
71
+ * Executes the tool's main logic.
72
+ *
73
+ * @param input - Validated input matching inputSchema
74
+ * @returns Promise resolving to output matching outputSchema
75
+ */
76
+ abstract execute(input: z.infer<TInputSchema>): Promise<z.infer<TOutputSchema>>;
77
+ /**
78
+ * Converts this tool instance to a Mastra-compatible tool object.
79
+ * Must be implemented by each subclass to ensure proper type inference.
80
+ *
81
+ * @returns A tool object compatible with @mastra/core createTool format
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * toMastraTool() {
86
+ * return createTool({
87
+ * id: this.id,
88
+ * description: this.description,
89
+ * inputSchema: this.inputSchema,
90
+ * outputSchema: this.outputSchema,
91
+ * execute: async ({ context }) => this.execute(context),
92
+ * });
93
+ * }
94
+ * ```
95
+ */
96
+ abstract getTool(): TMastraTool;
97
+ }
98
+ //# sourceMappingURL=base.tool.d.ts.map