@venizia/ignis-docs 0.2.0 → 0.2.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 (174) hide show
  1. package/README.md +14 -14
  2. package/content/best-practices/api-usage-examples.md +39 -19
  3. package/content/best-practices/architectural-patterns.md +24 -13
  4. package/content/best-practices/architecture-decisions.md +29 -16
  5. package/content/best-practices/code-style-standards/advanced-patterns.md +43 -31
  6. package/content/best-practices/code-style-standards/constants-configuration.md +19 -4
  7. package/content/best-practices/code-style-standards/control-flow.md +33 -1
  8. package/content/best-practices/code-style-standards/documentation.md +28 -8
  9. package/content/best-practices/code-style-standards/function-patterns.md +15 -4
  10. package/content/best-practices/code-style-standards/index.md +7 -2
  11. package/content/best-practices/code-style-standards/naming-conventions.md +27 -3
  12. package/content/best-practices/code-style-standards/route-definitions.md +9 -5
  13. package/content/best-practices/code-style-standards/tooling.md +14 -1
  14. package/content/best-practices/code-style-standards/type-safety.md +39 -6
  15. package/content/best-practices/common-pitfalls.md +59 -35
  16. package/content/best-practices/contribution-workflow.md +8 -4
  17. package/content/best-practices/data-modeling.md +78 -62
  18. package/content/best-practices/deployment-strategies.md +56 -19
  19. package/content/best-practices/error-handling.md +247 -153
  20. package/content/best-practices/index.md +6 -0
  21. package/content/best-practices/performance-optimization.md +26 -13
  22. package/content/best-practices/security-guidelines.md +35 -9
  23. package/content/best-practices/testing-strategies.md +7 -2
  24. package/content/best-practices/troubleshooting-tips.md +27 -17
  25. package/content/extensions/components/api-reference.md +109 -323
  26. package/content/extensions/components/authentication/api.md +489 -602
  27. package/content/extensions/components/authentication/errors.md +135 -498
  28. package/content/extensions/components/authentication/index.md +89 -801
  29. package/content/extensions/components/authentication/usage.md +231 -955
  30. package/content/extensions/components/authorization/api.md +991 -644
  31. package/content/extensions/components/authorization/errors.md +204 -208
  32. package/content/extensions/components/authorization/getting-started.md +227 -0
  33. package/content/extensions/components/authorization/index.md +88 -795
  34. package/content/extensions/components/authorization/usage.md +219 -528
  35. package/content/extensions/components/health-check.md +77 -243
  36. package/content/extensions/components/index.md +24 -90
  37. package/content/extensions/components/mail/api.md +553 -285
  38. package/content/extensions/components/mail/errors.md +76 -62
  39. package/content/extensions/components/mail/index.md +111 -463
  40. package/content/extensions/components/mail/usage.md +139 -173
  41. package/content/extensions/components/request-tracker.md +70 -173
  42. package/content/extensions/components/socket-io/api.md +462 -785
  43. package/content/extensions/components/socket-io/errors.md +49 -51
  44. package/content/extensions/components/socket-io/index.md +69 -372
  45. package/content/extensions/components/socket-io/usage.md +212 -105
  46. package/content/extensions/components/static-asset/api.md +461 -141
  47. package/content/extensions/components/static-asset/errors.md +121 -53
  48. package/content/extensions/components/static-asset/index.md +84 -606
  49. package/content/extensions/components/static-asset/usage.md +184 -299
  50. package/content/extensions/components/template/index.md +3 -3
  51. package/content/extensions/components/websocket/api.md +311 -404
  52. package/content/extensions/components/websocket/errors.md +47 -56
  53. package/content/extensions/components/websocket/index.md +75 -407
  54. package/content/extensions/components/websocket/usage.md +120 -338
  55. package/content/extensions/helpers/cron/index.md +52 -160
  56. package/content/extensions/helpers/crypto/index.md +67 -480
  57. package/content/extensions/helpers/crypto/reference.md +528 -0
  58. package/content/extensions/helpers/env/index.md +64 -178
  59. package/content/extensions/helpers/error/index.md +286 -196
  60. package/content/extensions/helpers/index.md +61 -47
  61. package/content/extensions/helpers/inversion/index.md +76 -550
  62. package/content/extensions/helpers/inversion/reference.md +530 -0
  63. package/content/extensions/helpers/kafka/admin.md +23 -3
  64. package/content/extensions/helpers/kafka/compile-binary.md +83 -52
  65. package/content/extensions/helpers/kafka/consumer.md +65 -28
  66. package/content/extensions/helpers/kafka/examples.md +46 -253
  67. package/content/extensions/helpers/kafka/index.md +55 -617
  68. package/content/extensions/helpers/kafka/producer.md +156 -22
  69. package/content/extensions/helpers/kafka/schema-registry.md +59 -79
  70. package/content/extensions/helpers/logger/hf-logger.md +220 -0
  71. package/content/extensions/helpers/logger/index.md +78 -552
  72. package/content/extensions/helpers/logger/pino.md +105 -0
  73. package/content/extensions/helpers/logger/reference.md +937 -0
  74. package/content/extensions/helpers/network/api.md +276 -195
  75. package/content/extensions/helpers/network/index.md +87 -524
  76. package/content/extensions/helpers/queue/index.md +80 -897
  77. package/content/extensions/helpers/queue/reference.md +494 -0
  78. package/content/extensions/helpers/redis/index.md +86 -640
  79. package/content/extensions/helpers/redis/reference.md +784 -0
  80. package/content/extensions/helpers/secrets/index.md +136 -0
  81. package/content/extensions/helpers/socket-io/api.md +325 -204
  82. package/content/extensions/helpers/socket-io/index.md +79 -429
  83. package/content/extensions/helpers/storage/api.md +584 -464
  84. package/content/extensions/helpers/storage/index.md +80 -573
  85. package/content/extensions/helpers/types/index.md +75 -495
  86. package/content/extensions/helpers/types/reference.md +689 -0
  87. package/content/extensions/helpers/uid/index.md +176 -189
  88. package/content/extensions/helpers/websocket/api.md +366 -214
  89. package/content/extensions/helpers/websocket/index.md +68 -503
  90. package/content/extensions/helpers/worker-thread/index.md +62 -396
  91. package/content/extensions/helpers/worker-thread/reference.md +428 -0
  92. package/content/extensions/index.md +38 -39
  93. package/content/extensions/src-details/mcp-server.md +96 -548
  94. package/content/guides/core-concepts/persistent/datasources.md +2 -2
  95. package/content/guides/core-concepts/persistent/index.md +5 -1
  96. package/content/guides/core-concepts/persistent/models.md +1 -1
  97. package/content/guides/core-concepts/persistent/pglite.md +218 -0
  98. package/content/guides/core-concepts/persistent/postgres-drivers.md +21 -15
  99. package/content/guides/core-concepts/persistent/search-meilisearch.md +22 -12
  100. package/content/guides/core-concepts/persistent/search-typesense.md +28 -16
  101. package/content/guides/core-concepts/persistent/sqlite.md +296 -0
  102. package/content/guides/core-concepts/persistent/transactions.md +12 -11
  103. package/content/guides/core-concepts/secrets-vault.md +177 -0
  104. package/content/guides/core-concepts/services.md +1 -1
  105. package/content/guides/get-started/5-minute-quickstart.md +59 -206
  106. package/content/guides/get-started/philosophy.md +135 -670
  107. package/content/guides/get-started/setup.md +53 -74
  108. package/content/guides/migrations/redis-helpers-migration.md +5 -4
  109. package/content/guides/migrations/scoped-rbac-migration.md +5 -5
  110. package/content/guides/migrations/unified-connectors-migration.md +8 -7
  111. package/content/guides/tutorials/ecommerce-api.md +3 -8
  112. package/content/guides/tutorials/realtime-chat.md +1 -1
  113. package/content/references/base/application.md +64 -22
  114. package/content/references/base/components.md +3 -3
  115. package/content/references/base/connectors.md +79 -136
  116. package/content/references/base/controllers.md +12 -12
  117. package/content/references/base/datasources-reference.md +600 -0
  118. package/content/references/base/datasources.md +84 -444
  119. package/content/references/base/dependency-injection.md +25 -46
  120. package/content/references/base/filter-system/application-usage.md +95 -123
  121. package/content/references/base/filter-system/array-operators.md +33 -43
  122. package/content/references/base/filter-system/comparison-operators.md +55 -63
  123. package/content/references/base/filter-system/default-filter.md +144 -350
  124. package/content/references/base/filter-system/fields-order-pagination.md +116 -148
  125. package/content/references/base/filter-system/index.md +114 -253
  126. package/content/references/base/filter-system/json-filtering.md +52 -181
  127. package/content/references/base/filter-system/list-operators.md +28 -44
  128. package/content/references/base/filter-system/logical-operators.md +69 -114
  129. package/content/references/base/filter-system/null-operators.md +41 -98
  130. package/content/references/base/filter-system/pattern-matching.md +48 -51
  131. package/content/references/base/filter-system/quick-reference.md +93 -196
  132. package/content/references/base/filter-system/range-operators.md +22 -38
  133. package/content/references/base/filter-system/tips.md +70 -133
  134. package/content/references/base/filter-system/use-cases.md +173 -232
  135. package/content/references/base/grpc-controllers.md +53 -17
  136. package/content/references/base/index.md +5 -3
  137. package/content/references/base/middlewares.md +43 -28
  138. package/content/references/base/models-reference.md +886 -0
  139. package/content/references/base/models.md +81 -1452
  140. package/content/references/base/providers.md +8 -8
  141. package/content/references/base/repositories/advanced.md +281 -419
  142. package/content/references/base/repositories/index.md +84 -644
  143. package/content/references/base/repositories/mixins.md +25 -21
  144. package/content/references/base/repositories/relations.md +194 -375
  145. package/content/references/base/repositories/soft-deletable.md +67 -55
  146. package/content/references/base/secrets.md +267 -0
  147. package/content/references/base/services.md +8 -6
  148. package/content/references/configuration/environment-variables.md +73 -21
  149. package/content/references/configuration/index.md +51 -31
  150. package/content/references/index.md +1 -1
  151. package/content/references/quick-reference.md +3 -16
  152. package/content/references/utilities/crypto.md +35 -76
  153. package/content/references/utilities/date.md +33 -73
  154. package/content/references/utilities/duration.md +85 -0
  155. package/content/references/utilities/index.md +6 -2
  156. package/content/references/utilities/jsx-reference.md +298 -0
  157. package/content/references/utilities/jsx.md +82 -525
  158. package/content/references/utilities/module.md +81 -61
  159. package/content/references/utilities/parse.md +34 -64
  160. package/content/references/utilities/performance.md +33 -58
  161. package/content/references/utilities/promise.md +28 -62
  162. package/content/references/utilities/request.md +58 -218
  163. package/content/references/utilities/retry.md +139 -0
  164. package/content/references/utilities/schema.md +43 -137
  165. package/content/references/utilities/statuses-reference.md +361 -0
  166. package/content/references/utilities/statuses.md +63 -667
  167. package/dist/mcp-server/index.js +0 -0
  168. package/dist/mcp-server/tools/github/list-project-files.tool.d.ts +1 -1
  169. package/dist/mcp-server/tools/github/list-project-files.tool.d.ts.map +1 -1
  170. package/dist/mcp-server/tools/github/list-project-files.tool.js +3 -3
  171. package/dist/mcp-server/tools/github/search-code.tool.js +1 -1
  172. package/dist/mcp-server/tools/github/verify-dependencies.tool.js +1 -1
  173. package/dist/mcp-server/tools/github/view-source-file.tool.js +1 -1
  174. package/package.json +24 -23
@@ -1,410 +1,170 @@
1
1
  # MCP Docs Server: Deep Dive
2
2
 
3
- This document provides a detailed look into the architecture, features, and internal workings of the IGNIS Documentation MCP Server. For a guide on how to use the server, see the [MCP Docs Server Quickstart](/guides/reference/mcp-docs-server).
3
+ The IGNIS Documentation MCP server exposes the wiki, and the GitHub repository, as ten MCP tools. An AI assistant calls them to answer questions about IGNIS with real content, instead of guessing. For setup, see the [MCP Docs Server Quickstart](/guides/reference/mcp-docs-server).
4
4
 
5
- ---
5
+ ## Architecture
6
6
 
7
- ## Architecture Overview
8
-
9
- ### System Architecture
7
+ Two tool groups sit behind one server. Documentation tools read local markdown files. Code tools call the GitHub API.
10
8
 
11
9
  ```mermaid
12
10
  graph TB
13
11
  AI[AI Assistant / MCP Client]
14
12
  MCP[MCPServer Entry Point]
15
-
13
+
16
14
  subgraph ToolLayer [Tools Layer]
17
15
  DocsTools[Documentation Tools]
18
16
  CodeTools[Code & Project Tools]
19
17
  end
20
-
18
+
21
19
  subgraph LogicLayer [Business Logic Layer]
22
- DocsHelper[Docs Helper]
23
- GitHubHelper[GitHub Helper]
20
+ DocsHelper[DocsHelper]
21
+ GitHubHelper[GithubHelper]
24
22
  end
25
-
23
+
26
24
  subgraph DataLayer [Data Sources]
27
- FS[File System / Wiki Docs]
25
+ FS[Local wiki markdown]
28
26
  GitHubAPI[GitHub API]
29
27
  end
30
28
 
31
29
  AI -->|MCP Protocol| MCP
32
30
  MCP --> DocsTools
33
31
  MCP --> CodeTools
34
-
32
+
35
33
  DocsTools --> DocsHelper
36
34
  CodeTools --> GitHubHelper
37
-
35
+
38
36
  DocsHelper --> FS
39
37
  GitHubHelper --> GitHubAPI
40
-
41
- style AI fill:#e1f5ff
42
- style MCP fill:#fff4e1
43
- style DocsTools fill:#f0f0f0
44
- style CodeTools fill:#f0f0f0
45
- style DocsHelper fill:#e8f5e9
46
- style GitHubHelper fill:#e8f5e9
47
- style FS fill:#f3e5f5
48
- style GitHubAPI fill:#e3f2fd
49
38
  ```
50
39
 
51
- ### Component Responsibilities
52
-
53
- | Component | Responsibility | Key Features |
54
- |-----------|---------------|--------------|
55
- | **MCP Server** | Protocol handling, request routing | Stdio transport, tool registration |
56
- | **Docs Tools** | Wiki documentation access | Search, content retrieval, metadata |
57
- | **Code Tools** | Source code analysis | Code search, file listing, dependency check |
58
- | **DocsHelper** | Docs logic, search, caching | Fuse.js search, memory cache |
59
- | **GitHubHelper** | GitHub API integration | Repository search, content fetching |
60
-
61
- ---
40
+ Documentation tools read files that ship with the server - your local checkout. Code tools fetch from GitHub at a chosen branch (`main` by default), not from your local working tree. A local edit you haven't pushed won't show up in `searchCode` or `viewSourceFile`.
62
41
 
63
- ## Data Flow
42
+ At startup, `main()` loads every wiki document into memory once, before the server starts accepting requests. `DocsHelper.load()` is idempotent - later calls return the cached list instead of re-reading disk.
64
43
 
65
- ### Documentation Search Flow
66
-
67
- ```mermaid
68
- sequenceDiagram
69
- participant AI as AI Assistant
70
- participant MCP as MCP Server
71
- participant Tool as SearchDocsTool
72
- participant Helper as DocsHelper
73
- participant FS as File System
74
-
75
- AI->>MCP: searchDocs("dependency injection")
76
- MCP->>Tool: Route to tool handler
77
- Tool->>Helper: DocsHelper.searchDocuments()
78
-
79
- alt Cache Empty (First Call)
80
- Helper->>FS: Load all .md files
81
- FS-->>Helper: Raw markdown files
82
- Helper->>Helper: Build Fuse.js index
83
- end
84
-
85
- Helper->>Helper: Query Fuse.js index
86
- Helper-->>Tool: Search results
87
- Tool-->>MCP: Formatted response
88
- MCP-->>AI: JSON results
89
- ```
90
-
91
- ### Code Search Flow (GitHub)
92
-
93
- ```mermaid
94
- sequenceDiagram
95
- participant AI as AI Assistant
96
- participant MCP as MCP Server
97
- participant Tool as SearchCodeTool
98
- participant Helper as GitHubHelper
99
- participant API as GitHub API
100
-
101
- AI->>MCP: searchCode("BaseRestController")
102
- MCP->>Tool: Route to tool handler
103
- Tool->>Helper: GitHubHelper.searchCode()
104
- Helper->>API: GET /search/code
105
- API-->>Helper: JSON results
106
- Helper->>Helper: Process & Format
107
- Helper-->>Tool: Code matches
108
- Tool-->>MCP: Formatted response
109
- MCP-->>AI: JSON results
110
- ```
44
+ ## Tools reference
111
45
 
46
+ ### Documentation tools
112
47
 
113
- ## Tools Reference
48
+ Read the wiki. Backed by `DocsHelper`, which loads every `.md` file under `content/` and builds a [Fuse.js](https://www.fusejs.io/) search index over it.
114
49
 
115
- ### 1. Documentation Tools
50
+ | Tool | Input | Purpose |
51
+ |------|-------|---------|
52
+ | `searchDocs` | `{ query, limit? }` | Fuzzy search titles and content |
53
+ | `getDocContent` | `{ id }` | Full markdown content of one document |
54
+ | `listDocs` | `{ category? }` | List documents, optionally filtered by category |
55
+ | `listCategories` | `{}` | List every category, alphabetically |
56
+ | `getDocMetadata` | `{ id }` | Word count, character count, last-modified date |
57
+ | `getPackageOverview` | `{ packageName? }` | Package summaries, sourced from `extensions/src-details/` |
116
58
 
117
- Tools for accessing the IGNIS Framework wiki and guide documentation.
59
+ `id` is the document's path relative to the wiki root, for example `extensions/helpers/redis/index.md`. Get one from a `searchDocs` or `listDocs` result.
118
60
 
119
- | Tool | Purpose | Use Case |
120
- |------|---------|----------|
121
- | `searchDocs` | Find docs by keyword | "How do I use Redis?" |
122
- | `getDocContent` | Get full document content | "Show me the Redis guide" |
123
- | `listDocs` | Browse available docs | "What guides are available?" |
124
- | `listCategories` | List doc categories | "Show me doc topics" |
125
- | `getDocMetadata` | Get doc statistics | "Is this guide long?" |
126
- | `getPackageOverview` | Get package summaries | "What does the core package do?" |
61
+ > [!NOTE]
62
+ > `getPackageOverview` matches `extensions/src-details/{packageName}.md` exactly. Today that directory holds only this page (`mcp-server.md`). Until sibling pages exist, every other name - `core`, `helpers`, `inversion`, `dev-configs`, `docs` - returns a "not found" error.
127
63
 
128
- #### `searchDocs`
129
- Fuzzy searches across all documentation titles and content.
130
- - **Input:** `{ query: string, limit?: number }`
131
- - **Returns:** List of matching documents with snippets and relevance scores.
64
+ ### Code & project tools
132
65
 
133
- #### `getDocContent`
134
- Retrieves the full markdown content of a specific document.
135
- - **Input:** `{ id: string }`
136
- - **Returns:** Full document content.
66
+ Explore the IGNIS repository on GitHub. Backed by `GithubHelper`, which reads via the GitHub REST API and `raw.githubusercontent.com`.
137
67
 
138
- #### `listDocs`
139
- Lists all documentation files, optionally filtered by category.
140
- - **Input:** `{ category?: string }`
141
- - **Returns:** List of document metadata (id, title, category).
68
+ | Tool | Input | Purpose |
69
+ |------|-------|---------|
70
+ | `searchCode` | `{ query, limit? }` | GitHub code search across the repo |
71
+ | `listProjectFiles` | `{ directoryPath? }` | List files and subdirectories at a path (default: repo root) |
72
+ | `viewSourceFile` | `{ filePath }` | Full content of one source file |
73
+ | `verifyDependencies` | `{ packagePath }` | Compare a package's `package.json` deps against the npm registry |
142
74
 
143
- #### `listCategories`
144
- Lists all unique documentation categories.
145
- - **Input:** `{}`
146
- - **Returns:** List of category names.
147
-
148
- #### `getDocMetadata`
149
- Retrieves statistics about a document without loading full content.
150
- - **Input:** `{ id: string }`
151
- - **Returns:** Word count, character count, last modified date.
152
-
153
- #### `getPackageOverview`
154
- Retrieves high-level information about specific framework packages.
155
- - **Input:** `{ packageName?: string }`
156
- - **Returns:** Package description, version, and purpose.
157
-
158
-
159
- ### 2. Code & Project Tools
160
-
161
- Tools for exploring the IGNIS codebase, searching source code, and verifying dependencies via GitHub.
162
-
163
- | Tool | Purpose | Use Case |
164
- |------|---------|----------|
165
- | `searchCode` | Search source code | "Find usages of BaseRestController" |
166
- | `listProjectFiles` | List repo files | "Show me files in packages/core" |
167
- | `viewSourceFile` | Read source code | "Read packages/core/src/index.ts" |
168
- | `verifyDependencies` | Check package.json | "Check dependencies for @venizia/core" |
169
-
170
- #### `searchCode`
171
- Searches the codebase using GitHub's code search API.
172
- - **Input:** `{ query: string, limit?: number, extension?: string }`
173
- - **Returns:** List of code matches with file paths and snippets.
174
-
175
- #### `listProjectFiles`
176
- Lists files and directories in the repository.
177
- - **Input:** `{ path?: string, recursive?: boolean }`
178
- - **Returns:** File tree structure.
179
-
180
- #### `viewSourceFile`
181
- Retrieves the raw content of a source code file.
182
- - **Input:** `{ path: string }`
183
- - **Returns:** Raw file content.
184
-
185
- #### `verifyDependencies`
186
- Checks the `package.json` of a specific package or the root project.
187
- - **Input:** `{ package?: string }`
188
- - **Returns:** List of dependencies and their versions.
75
+ `searchCode` uses GitHub's native query syntax. Qualifiers like `extension:ts` or `path:packages/core-server` go inside the `query` string itself - there is no separate `extension` parameter.
189
76
 
77
+ Every tool returns an `error` string field on failure, instead of throwing. Check for it before trusting the rest of the response.
190
78
 
191
79
  ## Resources
192
80
 
193
- The server exposes documentation as MCP resources for direct access:
81
+ The server also exposes each document as an MCP resource, for clients that read resources directly instead of calling `searchDocs`.
194
82
 
195
83
  | Property | Value |
196
84
  |----------|-------|
197
- | **URI Format** | `ignis://docs/{document-id}` |
198
- | **MIME Type** | `text/markdown` |
199
- | **Metadata** | Category and word count in description |
200
-
201
- **Example Resource:**
202
-
203
- ```json
204
- {
205
- "uri": "ignis://docs/guides/intro.md",
206
- "name": "Introduction",
207
- "description": "Getting Started - 450 words",
208
- "mimeType": "text/markdown"
209
- }
210
- ```
211
-
85
+ | URI format | `ignis://docs/{document-id}` |
86
+ | MIME type | `text/markdown` |
87
+ | Description | `{category} - {wordCount} words` |
212
88
 
213
- ## Search Configuration
89
+ ## Search configuration
214
90
 
215
- ### Fuse.js Settings
91
+ `searchDocs` and `searchCode` are tuned independently.
216
92
 
217
- The search engine uses optimized Fuse.js configuration:
218
-
219
- | Setting | Value | Explanation |
220
- |---------|-------|-------------|
221
- | **threshold** | 0.4 | Balance between strict and fuzzy matching |
222
- | **ignoreLocation** | true | Match anywhere in document, not just at start |
223
- | **findAllMatches** | true | Return all relevant matches, not just first |
224
- | **minMatchCharLength** | 2 | Minimum characters to trigger a match |
225
-
226
- ### Search Weights
227
-
228
- ```mermaid
229
- pie
230
- title Search Weight Distribution
231
- "Title" : 70
232
- "Content" : 30
233
- ```
93
+ | Setting | Docs (`searchDocs`) | Code (`searchCode`) |
94
+ |---|---|---|
95
+ | Default result limit | 10 | 10 |
96
+ | Max result limit | 50 | 30 |
97
+ | Minimum query length | 2 chars | 2 chars |
234
98
 
235
- | Field | Weight | Rationale |
236
- |-------|--------|-----------|
237
- | Title | 70% | Document titles are highly relevant |
238
- | Content | 30% | Body content provides context |
99
+ `searchDocs` also ranks by a weighted Fuse.js index:
239
100
 
240
- **Why this matters:** When you search for "dependency injection", documents with that phrase in the title will rank higher than those with it only in the content.
101
+ | Field | Weight |
102
+ |---|---|
103
+ | Title | 70% |
104
+ | Content | 30% |
241
105
 
106
+ `threshold: 0.4` tolerates typos and partial matches, without matching everything.
242
107
 
243
- ## Project Structure
108
+ ## Project structure
244
109
 
245
110
  ```
246
111
  mcp-server/
247
112
  ├── common/
248
- │ ├── config.ts # Configuration constants (MCPConfigs class)
249
- │ ├── logger.ts # Logging infrastructure
250
- │ ├── paths.ts # Path resolution
251
- │ └── index.ts # Common exports
113
+ │ ├── config.ts # MCPConfigs - server, GitHub, search settings
114
+ │ ├── guards.ts # isNonEmptyString - truthiness check for external data
115
+ │ ├── paths.ts # Paths - wiki directory resolution
116
+ │ └── index.ts
252
117
  ├── helpers/
253
- │ ├── docs.helper.ts # Documentation loading and searching
254
- │ ├── github.helper.ts # GitHub API integration
255
- │ ├── logger.helper.ts # Logging utilities
256
- │ └── index.ts # Helper exports
257
- ├── tools/
258
- │ ├── base.tool.ts # Abstract base class for tools
259
- │ ├── docs/ # Documentation tools
260
- │ │ ├── get-document-content.tool.ts
261
- │ │ ├── get-document-metadata.tool.ts
262
- │ │ ├── get-package-overview.tool.ts
263
- │ │ ├── list-categories.tool.ts
264
- │ │ ├── list-documents.tool.ts
265
- │ │ ├── search-documents.tool.ts
266
- │ │ └── index.ts
267
- │ ├── github/ # GitHub/Code tools
268
- │ │ ├── list-project-files.tool.ts
269
- │ │ ├── search-code.tool.ts
270
- │ │ ├── verify-dependencies.tool.ts
271
- │ │ ├── view-source-file.tool.ts
272
- │ │ └── index.ts
118
+ │ ├── docs.helper.ts # DocsHelper - load, search, cache
119
+ │ ├── github.helper.ts # GithubHelper - GitHub API + raw content
120
+ │ ├── logger.helper.ts # Logger - console logging
273
121
  │ └── index.ts
274
- ├── index.ts # Server entry point
122
+ ├── tools/
123
+ │ ├── base.tool.ts # BaseTool - abstract base every tool extends
124
+ │ ├── docs/ # 6 documentation tools
125
+ │ └── github/ # 4 code/project tools
126
+ ├── index.ts # Server entry point, tool registration, main()
275
127
  └── README.md
276
128
  ```
277
129
 
278
- ### File Responsibilities
279
-
280
- | File | Purpose | Key Exports |
281
- |------|---------|-------------|
282
- | `index.ts` | Server initialization, tool registration | `main()`, `mcpServer` |
283
- | `tools/base.tool.ts` | Abstract tool class, singleton pattern | `BaseTool`, `createTool` |
284
- | `helpers/docs.helper.ts` | Documentation loading, search, cache | `DocsHelper` class |
285
- | `helpers/github.helper.ts` | GitHub API integration | `GithubHelper` class |
286
- | `common/config.ts` | Centralized configuration | `MCPConfigs` class |
287
- | `common/logger.ts` | Structured logging | `Logger` class |
288
- | `common/paths.ts` | Path resolution | `Paths` object |
289
-
290
-
291
- ## Performance Characteristics
292
-
293
- ### Caching Strategy
294
-
295
- ```mermaid
296
- graph LR
297
- A[First Request] --> B{Cache Empty?}
298
- B -->|Yes| C[Load from FS]
299
- C --> D[Parse Frontmatter]
300
- D --> E[Build Fuse Index]
301
- E --> F[Store in Memory]
302
- F --> G[Return Results]
303
- B -->|No| G
304
-
305
- style C fill:#ffcdd2
306
- style F fill:#c8e6c9
307
- style G fill:#bbdefb
308
- ```
309
-
310
- ### Performance Metrics
311
-
312
- | Operation | First Call | Subsequent Calls | Notes |
313
- |-----------|-----------|------------------|-------|
314
- | **Load Docs** | ~50-200ms | 0ms | Cached in memory |
315
- | **Search** | ~100-300ms | ~5-20ms | Includes initial load |
316
- | **Get Content** | ~50-200ms | ~1-5ms | Fast lookup by ID |
317
- | **List Docs** | ~50-200ms | ~1-3ms | Pre-cached metadata |
318
- | **Memory Usage** | ~5-10MB | ~5-10MB | Scales with doc count |
319
-
320
- **Optimization Tips:**
130
+ `common/guards.ts` exists because everything this server reads is external and untyped - frontmatter, GitHub error bodies, npm registry responses. A key can be present but empty, which needs the same fallback as a missing key. `isNonEmptyString` makes that a deliberate truthiness check, not `??`.
321
131
 
322
- - First search is slower (loads all docs)
323
- - Subsequent searches are cached (very fast)
324
- - Memory usage is constant after first load
325
- - No disk I/O after initialization
132
+ ## Configuration
326
133
 
134
+ `MCPConfigs`, in `common/config.ts`, is a static class - not a config file. Change the constants, and rebuild.
327
135
 
328
- ## Error Handling
136
+ | Field | Default | Notes |
137
+ |---|---|---|
138
+ | `server.name` | `'ignis-docs'` | Reported to MCP clients |
139
+ | `github.branch` | `'main'` | Set at runtime via the CLI arg: `ignis-docs-mcp <branch>` |
140
+ | `github.repoOwner` / `repoName` | `VENIZIA-AI` / `ignis` | The repository code tools read from |
141
+ | `search.snippetLength` | `320` | Max characters in a `searchDocs` snippet |
142
+ | `fuse.threshold` | `0.4` | `0.0` = exact match only, `1.0` = match anything |
329
143
 
330
- ### Error Response Format
331
-
332
- All tools return consistent error responses:
333
-
334
- ```json
335
- {
336
- "error": "Document not found",
337
- "id": "requested-id"
338
- }
339
- ```
144
+ ## Error handling
340
145
 
341
- ### Common Errors
146
+ A tool never throws to the MCP client. Each `execute()` catches its own failures and returns `{ error: string, ...partial fields }`, matching that tool's output schema. `searchCode` also returns `rateLimitWarning` when GitHub's rate limit is running low - unauthenticated requests are capped at 10 per minute.
342
147
 
343
- | Error | Cause | Solution |
344
- |-------|-------|----------|
345
- | "Document not found" | Invalid document ID | Use `listDocs` to find valid IDs |
346
- | "Query too short" | Query < 2 characters | Use longer search query |
347
- | "Limit out of range" | Limit > 50 or < 1 | Use default (10) or valid range |
348
- | "Failed to load documentation" | File system error | Check wiki directory exists |
349
-
350
- ### Logging Levels
351
-
352
- | Level | Usage | Example |
353
- |-------|-------|---------|
354
- | **info** | General information | "Server started", "Docs loaded" |
355
- | **warn** | Non-critical issues | "Document not found" |
356
- | **error** | Critical errors | "Failed to load docs" |
357
- | **debug** | Development details | Search queries, cache hits |
148
+ ## Debugging
358
149
 
359
- **Enable debug logging:**
150
+ Set `DEBUG=1` to see `Logger.debug()` output - cache loads, search queries, and GitHub request URLs.
360
151
 
361
152
  ```bash
362
153
  DEBUG=1 ignis-docs-mcp
363
154
  ```
364
155
 
156
+ ## Extending the server
365
157
 
366
- ## Development Guide
367
-
368
- ### Tool Architecture Pattern
369
-
370
- All tools extend the `BaseTool` abstract class:
371
-
372
- ```typescript
373
- import type { Tool } from '@mastra/core/tools';
374
- import type { z } from 'zod';
375
-
376
- export abstract class BaseTool<TInputSchema extends z.ZodType, TOutputSchema extends z.ZodType> {
377
- abstract readonly id: string;
378
- abstract readonly description: string;
379
- abstract readonly inputSchema: TInputSchema;
380
- abstract readonly outputSchema: TOutputSchema;
381
-
382
- abstract execute(opts: z.infer<TInputSchema>): Promise<z.infer<TOutputSchema>>;
383
- abstract getTool(): Tool<z.input<TInputSchema>, z.infer<TOutputSchema>>;
384
- }
385
- ```
386
-
387
- ### Adding a New Tool
388
-
389
- **Step 1: Create Tool File**
390
-
391
- Create `tools/my-new-tool.tool.ts`:
158
+ Every tool extends `BaseTool<TInputSchema, TOutputSchema>` and implements `id`, `description`, `inputSchema`, `outputSchema`, `execute()`, and `getTool()`.
392
159
 
393
160
  ```typescript
394
161
  import { createTool } from '@mastra/core/tools';
395
162
  import { z } from 'zod';
396
163
  import { BaseTool } from '../base.tool';
397
164
 
398
- // Define schemas
399
- const InputSchema = z.object({
400
- param: z.string().describe('Parameter description'),
401
- });
402
-
403
- const OutputSchema = z.object({
404
- result: z.string().describe('Result description'),
405
- });
165
+ const InputSchema = z.object({ param: z.string().describe('Parameter description') });
166
+ const OutputSchema = z.object({ result: z.string().describe('Result description') });
406
167
 
407
- // Implement tool class
408
168
  export class MyNewTool extends BaseTool<typeof InputSchema, typeof OutputSchema> {
409
169
  readonly id = 'myNewTool';
410
170
  readonly description = 'What this tool does';
@@ -412,7 +172,6 @@ export class MyNewTool extends BaseTool<typeof InputSchema, typeof OutputSchema>
412
172
  readonly outputSchema = OutputSchema;
413
173
 
414
174
  async execute(opts: z.infer<typeof InputSchema>) {
415
- // Your logic here
416
175
  return { result: 'output' };
417
176
  }
418
177
 
@@ -428,232 +187,21 @@ export class MyNewTool extends BaseTool<typeof InputSchema, typeof OutputSchema>
428
187
  }
429
188
  ```
430
189
 
431
- **Step 2: Export from Index**
432
-
433
- Add to `tools/index.ts`:
434
-
435
- ```typescript
436
- export { MyNewTool } from './my-new-tool.tool';
437
- ```
438
-
439
- **Step 3: Register in Server**
440
-
441
- Add to `index.ts`:
442
-
443
- ```typescript
444
- import { MyNewTool } from './tools';
445
-
446
- const mcpServer = new MCPServer({
447
- tools: {
448
- myNewTool: new MyNewTool().getTool(),
449
- // ... other tools
450
- },
451
- });
452
- ```
453
-
454
- ### Configuration Updates
455
-
456
- Modify `common/config.ts` to adjust global settings. The configuration is now a class with static properties:
190
+ Export the class from `tools/index.ts`, then register it in `index.ts`:
457
191
 
458
192
  ```typescript
459
- export class MCPConfigs {
460
- // Server identification
461
- static readonly server = { name: 'ignis-docs', version: '0.0.1' } as const;
462
-
463
- // GitHub configuration (branch is runtime-configurable)
464
- static readonly github = {
465
- apiBase: 'https://api.github.com',
466
- rawContentBase: 'https://raw.githubusercontent.com',
467
- repoOwner: 'VENIZIA-AI',
468
- repoName: 'ignis',
469
- get branch(): string { return MCPConfigs._branch; },
470
- };
471
-
472
- // Set branch at runtime via CLI argument
473
- static setBranch(opts: { branch: string }) {
474
- MCPConfigs._branch = opts.branch;
475
- }
476
-
477
- // Documentation search settings
478
- static readonly search = {
479
- snippetLength: 320, // Max characters for content snippet
480
- defaultLimit: 10, // Default results per search
481
- maxLimit: 50, // Maximum allowed results
482
- minQueryLength: 2, // Minimum query length
483
- };
484
-
485
- // Code search settings (GitHub API)
486
- static readonly codeSearch = {
487
- defaultLimit: 10,
488
- maxLimit: 30, // GitHub API limit
489
- minQueryLength: 2,
490
- };
491
-
492
- // Fuse.js search engine settings
493
- static readonly fuse = {
494
- includeScore: true,
495
- threshold: 0.4, // 0.0 = exact, 1.0 = match anything
496
- minMatchCharLength: 2,
497
- findAllMatches: true,
498
- ignoreLocation: true,
499
- keys: [
500
- { name: 'title', weight: 0.7 },
501
- { name: 'content', weight: 0.3 },
502
- ],
503
- };
504
- }
505
- ```
506
-
507
- **Configuration Impact:**
508
-
509
- | Setting | Low Value | High Value |
510
- |---------|-----------|------------|
511
- | `threshold` | Stricter matches | More fuzzy matches |
512
- | `title weight` | Less title importance | More title importance |
513
- | `snippetLength` | Shorter previews | Longer previews |
514
-
515
-
516
- ## Best Practices
517
-
518
- ### For AI Assistants
519
-
520
- 1. **Search First**: Use `searchDocs` to find relevant documentation before fetching full content
521
- 2. **Filter Smart**: Use `listCategories` → `listDocs(category)` for category-specific browsing
522
- 3. **Check Size**: Use `getDocMetadata` before `getDocContent` for large documents
523
- 4. **Batch Queries**: If you need multiple docs, fetch IDs first then retrieve content
524
- 5. **Handle Errors**: Always check for error field in responses
525
-
526
- ### For Developers
527
-
528
- 1. **Document IDs**: Always use relative paths from wiki root (e.g., "guides/intro.md")
529
- 2. **Frontmatter**: Ensure all markdown files have `title` and `category` in frontmatter
530
- 3. **Search Queries**: Use descriptive queries for better results (minimum 2 characters)
531
- 4. **Result Limits**: Adjust limit parameter based on needs (default: 10, max: 50)
532
- 5. **Logging**: Enable DEBUG mode during development for detailed logs
533
-
534
- ### Workflow Examples
535
-
536
- **Example 1: Answer "How do I use Redis?"**
537
-
538
- ```
539
- 1. searchDocs("Redis") → Find relevant docs
540
- 2. Review snippets → Identify best match (e.g., "helpers/redis.md")
541
- 3. getDocContent("helpers/redis.md") → Retrieve full guide
542
- 4. Extract and format answer for user
543
- ```
544
-
545
- **Example 2: Browse helpers documentation**
546
-
547
- ```
548
- 1. listCategories() → Get all categories
549
- 2. listDocs({ category: "Helpers" }) → Get all helper docs
550
- 3. Present list to user → Let them choose
551
- 4. getDocContent(selectedId) → Show full documentation
552
- ```
553
-
554
- **Example 3: Check document before reading**
555
-
556
- ```
557
- 1. getDocMetadata("references/api.md") → Check length
558
- 2. If wordCount > 5000 → Warn user it's long
559
- 3. getDocContent("references/api.md") → Fetch full content
560
- ```
561
-
562
-
563
- ## Debugging
564
-
565
- ### Enable Debug Mode
566
-
567
- ```bash
568
- # Show all debug logs
569
- DEBUG=1 ignis-docs-mcp
570
-
571
- # Show specific component logs
572
- DEBUG=docs:search ignis-docs-mcp
573
- DEBUG=docs:cache ignis-docs-mcp
574
- ```
575
-
576
- ### Debug Output Examples
577
-
578
- ```
579
- [debug] Loading documentation from: /path/to/wiki
580
- [debug] Found 45 markdown files
581
- [debug] Building Fuse.js search index
582
- [debug] Cache populated with 45 documents
583
- [debug] Search query: "dependency injection"
584
- [debug] Found 3 matches in 12ms
585
- ```
586
-
587
- ### Common Debug Tasks
588
-
589
- | Task | Command | Expected Output |
590
- |------|---------|----------------|
591
- | Verify docs load | `DEBUG=1 ignis-docs-mcp` | "Cache populated with N documents" |
592
- | Check search | Use searchDocs tool | "Found N matches in Xms" |
593
- | Inspect cache | Check memory usage | ~5-10MB after first load |
594
-
595
-
596
- ## Roadmap
597
-
598
- ### Planned Features
599
-
600
- - [ ] **Prompts Support** - When @mastra/mcp library adds support
601
- - [ ] **Incremental Search** - Real-time search as user types
602
- - [ ] **Semantic Search** - AI-powered semantic matching
603
- - [ ] **Document Versioning** - Track documentation changes
604
- - [ ] **Multi-language Support** - i18n documentation support
605
-
606
- ### Contributing
607
-
608
- Want to add features or fix bugs? See the main IGNIS repository:
609
-
610
- - **Repository**: https://github.com/venizia-ai/ignis
611
- - **Issues**: Report bugs or request features
612
- - **Pull Requests**: Submit improvements
613
-
614
-
615
- ## FAQ
616
-
617
- ### How does caching work?
618
-
619
- Documentation is loaded into memory on the first request and stays cached for the lifetime of the server process. This means:
620
- - First search: ~100-300ms (loads all docs)
621
- - Subsequent searches: ~5-20ms (cached)
622
- - Memory usage: ~5-10MB (constant)
623
-
624
- ### Can I use this with other frameworks?
625
-
626
- Yes! The MCP server architecture is framework-agnostic. You can fork this repo and adapt it to serve documentation for any project by:
627
- 1. Replacing the wiki directory
628
- 2. Updating the server name/version
629
- 3. Adjusting configuration as needed
630
-
631
- ### How do I update the documentation?
632
-
633
- If you installed via npm:
634
- ```bash
635
- npm update -g @venizia/ignis-docs
636
- ```
637
-
638
- The package includes bundled documentation that updates with each release.
639
-
640
- ### What if a document isn't found?
641
-
642
- The tool returns an error object:
643
- ```json
644
- {
645
- "error": "Document not found",
646
- "id": "invalid-id"
647
- }
193
+ const mcpTools = {
194
+ // ...existing tools
195
+ myNewTool: new MyNewTool().getTool(),
196
+ };
648
197
  ```
649
198
 
650
- Use `listDocs()` to get valid document IDs.
199
+ > [!NOTE]
200
+ > The key you register the tool under - `myNewTool` here - is the name MCP clients see, not `this.id`. `MCPServer` overwrites the tool's `id` with its object key at registration time, so keep them identical to avoid confusing yourself later.
651
201
 
652
- ### How accurate is the fuzzy search?
202
+ ## See also
653
203
 
654
- The search uses a threshold of 0.4, which balances between strict and fuzzy matching:
655
- - Exact matches: Always ranked first
656
- - Close matches: Tolerate 1-2 character typos
657
- - Partial matches: Find substrings anywhere in title/content
204
+ - [MCP Docs Server Quickstart](/guides/reference/mcp-docs-server) - install and connect a client
205
+ - [Helpers Overview](/extensions/helpers/) - a directory `searchDocs` and `listDocs` can browse
658
206
 
659
- Adjust `MCPConfigs.fuse.threshold` to make it stricter (lower) or fuzzier (higher).
207
+ **Files:** [`docs/wiki/mcp-server`](https://github.com/VENIZIA-AI/ignis/blob/main/docs/wiki/mcp-server)