mcp-docs-service 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/handlers/health.js +7 -7
- package/dist/index.js +12 -15
- package/dist/schemas/tools.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -257,7 +257,8 @@ npx mcp-docs-service --health-check /path/to/docs
|
|
257
257
|
|
258
258
|
MCP Docs Service is designed to be resilient by default. The service automatically handles incomplete or poorly structured documentation without failing:
|
259
259
|
|
260
|
-
- Returns a minimum health score of
|
260
|
+
- Returns a minimum health score of 80 even with issues
|
261
|
+
- Automatically creates missing documentation directories
|
261
262
|
- Handles missing documentation directories gracefully
|
262
263
|
- Continues processing even when files have errors
|
263
264
|
- Provides lenient scoring for metadata completeness and broken links
|
@@ -270,6 +271,21 @@ This makes the service particularly useful for:
|
|
270
271
|
|
271
272
|
The service will always provide helpful feedback rather than failing, allowing you to incrementally improve your documentation over time.
|
272
273
|
|
274
|
+
## Version History
|
275
|
+
|
276
|
+
### v0.5.2
|
277
|
+
|
278
|
+
- Enhanced resilience by automatically creating missing documentation directories
|
279
|
+
- Improved tolerance mode with a minimum health score of 80
|
280
|
+
- Made tolerance mode the default for health checks
|
281
|
+
- Updated health check tool description to mention tolerance mode
|
282
|
+
|
283
|
+
### v0.5.1
|
284
|
+
|
285
|
+
- Added tolerance mode to health checks
|
286
|
+
- Fixed issues with test suite reliability
|
287
|
+
- Improved error handling in document operations
|
288
|
+
|
273
289
|
## Documentation
|
274
290
|
|
275
291
|
For more detailed information, check out our documentation:
|
package/dist/handlers/health.js
CHANGED
@@ -24,8 +24,8 @@ export class HealthCheckHandler {
|
|
24
24
|
async checkDocumentationHealth(basePath = "", options) {
|
25
25
|
try {
|
26
26
|
// Always use tolerance mode by default
|
27
|
-
const toleranceMode =
|
28
|
-
safeLog(`Checking documentation health with tolerance mode enabled
|
27
|
+
const toleranceMode = options?.toleranceMode !== false;
|
28
|
+
safeLog(`Checking documentation health with tolerance mode ${toleranceMode ? "enabled" : "disabled"}`);
|
29
29
|
// Get the full path to the docs directory
|
30
30
|
const docsPath = path.join(this.docsDir, basePath);
|
31
31
|
// Check if the directory exists
|
@@ -231,7 +231,7 @@ ${results.issues
|
|
231
231
|
// Deduct up to 30 points based on metadata completeness
|
232
232
|
const metadataDeduction = Math.round((30 * (100 - metadataCompleteness)) / 100);
|
233
233
|
score -= toleranceMode
|
234
|
-
? Math.min(metadataDeduction,
|
234
|
+
? Math.min(metadataDeduction, 10)
|
235
235
|
: metadataDeduction;
|
236
236
|
}
|
237
237
|
// Deduct points for broken links
|
@@ -239,7 +239,7 @@ ${results.issues
|
|
239
239
|
// Deduct 2 points per broken link, up to 20 points
|
240
240
|
const brokenLinksDeduction = Math.min(results.brokenLinks * 2, 20);
|
241
241
|
score -= toleranceMode
|
242
|
-
? Math.min(brokenLinksDeduction,
|
242
|
+
? Math.min(brokenLinksDeduction, 5)
|
243
243
|
: brokenLinksDeduction;
|
244
244
|
}
|
245
245
|
// Deduct points for orphaned documents
|
@@ -258,9 +258,9 @@ ${results.issues
|
|
258
258
|
? Math.min(missingRefsDeduction, 0)
|
259
259
|
: missingRefsDeduction;
|
260
260
|
}
|
261
|
-
// In tolerance mode, ensure a minimum score of
|
262
|
-
if (toleranceMode && score <
|
263
|
-
score =
|
261
|
+
// In tolerance mode, ensure a minimum score of 80
|
262
|
+
if (toleranceMode && score < 80) {
|
263
|
+
score = 80;
|
264
264
|
}
|
265
265
|
return Math.max(0, score);
|
266
266
|
}
|
package/dist/index.js
CHANGED
@@ -50,12 +50,12 @@ async function ensureDocsDirectory() {
|
|
50
50
|
}
|
51
51
|
}
|
52
52
|
catch (error) {
|
53
|
-
// Create directory if it doesn't exist
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
// Create directory if it doesn't exist
|
54
|
+
try {
|
55
|
+
await fs.mkdir(docsDir, { recursive: true });
|
56
|
+
safeLog(`Created docs directory: ${docsDir}`);
|
57
|
+
// Create a sample README.md if --create-dir is specified
|
58
|
+
if (createDir) {
|
59
59
|
const readmePath = path.join(docsDir, "README.md");
|
60
60
|
try {
|
61
61
|
await fs.access(readmePath);
|
@@ -74,14 +74,10 @@ This is the documentation directory for your project.
|
|
74
74
|
safeLog(`Created sample README.md in ${docsDir}`);
|
75
75
|
}
|
76
76
|
}
|
77
|
-
|
78
|
-
safeLog(`Error creating docs directory: ${error}`);
|
79
|
-
process.exit(1);
|
80
|
-
}
|
77
|
+
return;
|
81
78
|
}
|
82
|
-
|
83
|
-
safeLog(`Error
|
84
|
-
safeLog(`Use --create-dir to create it automatically`);
|
79
|
+
catch (error) {
|
80
|
+
safeLog(`Error creating docs directory: ${error}`);
|
85
81
|
process.exit(1);
|
86
82
|
}
|
87
83
|
}
|
@@ -144,7 +140,8 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
144
140
|
{
|
145
141
|
name: "check_documentation_health",
|
146
142
|
description: "Check the health of the documentation by analyzing frontmatter, links, and navigation. " +
|
147
|
-
"Returns a report with issues and a health score."
|
143
|
+
"Returns a report with issues and a health score. " +
|
144
|
+
"Uses tolerance mode by default to provide a more forgiving health score for incomplete documentation.",
|
148
145
|
inputSchema: zodToJsonSchema(CheckDocumentationHealthSchema),
|
149
146
|
},
|
150
147
|
// New tools for Phase 2
|
@@ -241,7 +238,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
241
238
|
if (!parsed.success) {
|
242
239
|
throw new Error(`Invalid arguments for check_documentation_health: ${parsed.error}`);
|
243
240
|
}
|
244
|
-
return await healthCheckHandler.checkDocumentationHealth(parsed.data.basePath);
|
241
|
+
return await healthCheckHandler.checkDocumentationHealth(parsed.data.basePath, { toleranceMode: parsed.data.toleranceMode });
|
245
242
|
}
|
246
243
|
// New tools for Phase 2
|
247
244
|
case "create_documentation_folder": {
|
package/dist/schemas/tools.js
CHANGED
@@ -44,6 +44,7 @@ export const SearchDocumentsSchema = ToolInputSchema.extend({
|
|
44
44
|
});
|
45
45
|
export const CheckDocumentationHealthSchema = ToolInputSchema.extend({
|
46
46
|
basePath: z.string().optional().default(""),
|
47
|
+
toleranceMode: z.boolean().optional().default(true),
|
47
48
|
});
|
48
49
|
// New schemas for Phase 2 features
|
49
50
|
export const CreateFolderSchema = ToolInputSchema.extend({
|
package/package.json
CHANGED