mcp-docs-service 0.1.1 → 0.2.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.
- package/CHANGELOG.md +43 -0
- package/LICENSE +1 -1
- package/README.md +28 -15
- package/dist/handlers/docs.d.ts +17 -0
- package/dist/handlers/docs.js +280 -0
- package/dist/handlers/docs.js.map +1 -0
- package/dist/handlers/file.d.ts +32 -0
- package/dist/handlers/file.js +222 -0
- package/dist/handlers/file.js.map +1 -0
- package/dist/handlers/index.d.ts +1 -0
- package/dist/handlers/index.js +3 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/index.d.ts +2 -24
- package/dist/index.js +431 -49
- package/dist/index.js.map +1 -1
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +3 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/tools.d.ts +141 -0
- package/dist/schemas/tools.js +46 -0
- package/dist/schemas/tools.js.map +1 -0
- package/dist/types/docs.d.ts +49 -0
- package/dist/types/docs.js +2 -0
- package/dist/types/docs.js.map +1 -0
- package/dist/types/file.d.ts +21 -0
- package/dist/types/file.js +2 -0
- package/dist/types/file.js.map +1 -0
- package/dist/types/index.d.ts +34 -43
- package/dist/types/index.js +3 -5
- package/dist/types/index.js.map +1 -1
- package/dist/types/tools.d.ts +11 -0
- package/dist/types/tools.js +2 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/utils/file.d.ts +24 -0
- package/dist/utils/file.js +94 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/index.d.ts +1 -60
- package/dist/utils/index.js +2 -151
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/path.d.ts +16 -0
- package/dist/utils/path.js +39 -0
- package/dist/utils/path.js.map +1 -0
- package/package.json +20 -6
- package/dist/cli/bin.d.ts +0 -6
- package/dist/cli/bin.js +0 -49
- package/dist/cli/bin.js.map +0 -1
- package/dist/cli/index.d.ts +0 -16
- package/dist/cli/index.js +0 -96
- package/dist/cli/index.js.map +0 -1
- package/dist/core/docAnalyzer.d.ts +0 -25
- package/dist/core/docAnalyzer.js +0 -118
- package/dist/core/docAnalyzer.js.map +0 -1
- package/dist/core/docManager.d.ts +0 -48
- package/dist/core/docManager.js +0 -257
- package/dist/core/docManager.js.map +0 -1
- package/dist/core/docProcessor.d.ts +0 -20
- package/dist/core/docProcessor.js +0 -127
- package/dist/core/docProcessor.js.map +0 -1
- package/dist/core/mcpDocsServer.d.ts +0 -61
- package/dist/core/mcpDocsServer.js +0 -395
- package/dist/core/mcpDocsServer.js.map +0 -1
package/dist/utils/index.js
CHANGED
@@ -1,152 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
* Utility functions for the MCP Documentation Service
|
4
|
-
*/
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.generateExcerpt = exports.calculateRelevance = exports.escapeRegex = exports.joinPaths = exports.getDirectoryName = exports.getFileName = exports.getFileExtension = exports.normalizePath = exports.isValidPath = void 0;
|
7
|
-
/**
|
8
|
-
* Check if a path is valid
|
9
|
-
* @param path - Path to check
|
10
|
-
* @returns True if the path is valid, false otherwise
|
11
|
-
*/
|
12
|
-
function isValidPath(path) {
|
13
|
-
// Ensure path doesn't contain invalid characters or sequences
|
14
|
-
return !path.includes("..") && !path.includes("//") && !path.startsWith("/");
|
15
|
-
}
|
16
|
-
exports.isValidPath = isValidPath;
|
17
|
-
/**
|
18
|
-
* Normalize a path
|
19
|
-
* @param path - Path to normalize
|
20
|
-
* @returns Normalized path
|
21
|
-
*/
|
22
|
-
function normalizePath(path) {
|
23
|
-
// Replace backslashes with forward slashes
|
24
|
-
path = path.replace(/\\/g, "/");
|
25
|
-
// Remove leading and trailing slashes
|
26
|
-
path = path.replace(/^\/+|\/+$/g, "");
|
27
|
-
// Replace multiple slashes with a single slash
|
28
|
-
path = path.replace(/\/+/g, "/");
|
29
|
-
return path;
|
30
|
-
}
|
31
|
-
exports.normalizePath = normalizePath;
|
32
|
-
/**
|
33
|
-
* Get file extension
|
34
|
-
* @param path - Path to get extension from
|
35
|
-
* @returns File extension
|
36
|
-
*/
|
37
|
-
function getFileExtension(path) {
|
38
|
-
const match = path.match(/\.([^.]+)$/);
|
39
|
-
return match ? `.${match[1].toLowerCase()}` : "";
|
40
|
-
}
|
41
|
-
exports.getFileExtension = getFileExtension;
|
42
|
-
/**
|
43
|
-
* Get file name
|
44
|
-
* @param path - Path to get name from
|
45
|
-
* @returns File name
|
46
|
-
*/
|
47
|
-
function getFileName(path) {
|
48
|
-
const match = path.match(/([^/]+)$/);
|
49
|
-
return match ? match[1] : "";
|
50
|
-
}
|
51
|
-
exports.getFileName = getFileName;
|
52
|
-
/**
|
53
|
-
* Get directory name
|
54
|
-
* @param path - Path to get directory name from
|
55
|
-
* @returns Directory name
|
56
|
-
*/
|
57
|
-
function getDirectoryName(path) {
|
58
|
-
const match = path.match(/([^/]+)\/[^/]+$/);
|
59
|
-
return match ? match[1] : "";
|
60
|
-
}
|
61
|
-
exports.getDirectoryName = getDirectoryName;
|
62
|
-
/**
|
63
|
-
* Join paths
|
64
|
-
* @param paths - Paths to join
|
65
|
-
* @returns Joined path
|
66
|
-
*/
|
67
|
-
function joinPaths(...paths) {
|
68
|
-
return normalizePath(paths.join("/"));
|
69
|
-
}
|
70
|
-
exports.joinPaths = joinPaths;
|
71
|
-
/**
|
72
|
-
* Escape regex special characters
|
73
|
-
* @param str - String to escape
|
74
|
-
* @returns Escaped string
|
75
|
-
*/
|
76
|
-
function escapeRegex(str) {
|
77
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
78
|
-
}
|
79
|
-
exports.escapeRegex = escapeRegex;
|
80
|
-
/**
|
81
|
-
* Calculate relevance score
|
82
|
-
* @param text - Text to search in
|
83
|
-
* @param query - Query to search for
|
84
|
-
* @returns Relevance score (0-1)
|
85
|
-
*/
|
86
|
-
function calculateRelevance(text, query) {
|
87
|
-
if (!query || !text)
|
88
|
-
return 0;
|
89
|
-
// Convert to lowercase for case-insensitive matching
|
90
|
-
const lowerText = text.toLowerCase();
|
91
|
-
const lowerQuery = query.toLowerCase();
|
92
|
-
// Check if the query is in the text
|
93
|
-
if (!lowerText.includes(lowerQuery))
|
94
|
-
return 0;
|
95
|
-
// Calculate relevance based on frequency and position
|
96
|
-
const frequency = (lowerText.match(new RegExp(escapeRegex(lowerQuery), "g")) || []).length;
|
97
|
-
const position = lowerText.indexOf(lowerQuery);
|
98
|
-
const textLength = text.length;
|
99
|
-
// Higher relevance for:
|
100
|
-
// - More occurrences of the query
|
101
|
-
// - Earlier position of the query
|
102
|
-
// - Shorter text (query is more significant in shorter text)
|
103
|
-
const frequencyFactor = Math.min(frequency / 5, 1); // Cap at 1
|
104
|
-
const positionFactor = 1 - position / textLength;
|
105
|
-
const lengthFactor = 1 - Math.min(textLength / 1000, 0.9); // Cap at 0.9
|
106
|
-
return frequencyFactor * 0.4 + positionFactor * 0.4 + lengthFactor * 0.2;
|
107
|
-
}
|
108
|
-
exports.calculateRelevance = calculateRelevance;
|
109
|
-
/**
|
110
|
-
* Generate excerpt
|
111
|
-
* @param text - Text to generate excerpt from
|
112
|
-
* @param query - Query to highlight
|
113
|
-
* @param length - Excerpt length
|
114
|
-
* @returns Excerpt
|
115
|
-
*/
|
116
|
-
function generateExcerpt(text, query, length = 150) {
|
117
|
-
if (!text)
|
118
|
-
return "";
|
119
|
-
if (!query)
|
120
|
-
return text.substring(0, length);
|
121
|
-
// Find the position of the query
|
122
|
-
const lowerText = text.toLowerCase();
|
123
|
-
const lowerQuery = query.toLowerCase();
|
124
|
-
const position = lowerText.indexOf(lowerQuery);
|
125
|
-
if (position === -1) {
|
126
|
-
// Query not found, return the beginning of the text
|
127
|
-
return text.substring(0, length) + (text.length > length ? "..." : "");
|
128
|
-
}
|
129
|
-
// Calculate start and end positions for the excerpt
|
130
|
-
const halfLength = Math.floor(length / 2);
|
131
|
-
let start = Math.max(0, position - halfLength);
|
132
|
-
let end = Math.min(text.length, position + query.length + halfLength);
|
133
|
-
// Adjust if the excerpt is shorter than the desired length
|
134
|
-
if (end - start < length) {
|
135
|
-
if (start === 0) {
|
136
|
-
end = Math.min(text.length, length);
|
137
|
-
}
|
138
|
-
else if (end === text.length) {
|
139
|
-
start = Math.max(0, text.length - length);
|
140
|
-
}
|
141
|
-
}
|
142
|
-
// Generate the excerpt
|
143
|
-
let excerpt = text.substring(start, end);
|
144
|
-
// Add ellipsis if needed
|
145
|
-
if (start > 0)
|
146
|
-
excerpt = "..." + excerpt;
|
147
|
-
if (end < text.length)
|
148
|
-
excerpt = excerpt + "...";
|
149
|
-
return excerpt;
|
150
|
-
}
|
151
|
-
exports.generateExcerpt = generateExcerpt;
|
1
|
+
// Re-export all utility functions
|
2
|
+
export * from "./path.js";
|
152
3
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,cAAc,WAAW,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/**
|
2
|
+
* Normalizes a path consistently
|
3
|
+
*/
|
4
|
+
export declare function normalizePath(p: string): string;
|
5
|
+
/**
|
6
|
+
* Expands the home directory tilde (~) in a path
|
7
|
+
*/
|
8
|
+
export declare function expandHome(filepath: string): string;
|
9
|
+
/**
|
10
|
+
* Validates that a path is within allowed directories
|
11
|
+
* @param p The path to validate
|
12
|
+
* @param allowedDirectories Array of allowed directory paths
|
13
|
+
* @returns The normalized path if valid
|
14
|
+
* @throws Error if path is not within allowed directories
|
15
|
+
*/
|
16
|
+
export declare function validatePath(p: string, allowedDirectories: string[]): Promise<string>;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import path from "path";
|
2
|
+
import os from "os";
|
3
|
+
/**
|
4
|
+
* Normalizes a path consistently
|
5
|
+
*/
|
6
|
+
export function normalizePath(p) {
|
7
|
+
return path.normalize(p);
|
8
|
+
}
|
9
|
+
/**
|
10
|
+
* Expands the home directory tilde (~) in a path
|
11
|
+
*/
|
12
|
+
export function expandHome(filepath) {
|
13
|
+
if (filepath.startsWith("~/") || filepath === "~") {
|
14
|
+
return path.join(os.homedir(), filepath.slice(1));
|
15
|
+
}
|
16
|
+
return filepath;
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* Validates that a path is within allowed directories
|
20
|
+
* @param p The path to validate
|
21
|
+
* @param allowedDirectories Array of allowed directory paths
|
22
|
+
* @returns The normalized path if valid
|
23
|
+
* @throws Error if path is not within allowed directories
|
24
|
+
*/
|
25
|
+
export async function validatePath(p, allowedDirectories) {
|
26
|
+
const normalizedPath = normalizePath(path.resolve(expandHome(p)));
|
27
|
+
// Check if the path is within any of the allowed directories
|
28
|
+
const isAllowed = allowedDirectories.some((dir) => {
|
29
|
+
const relativePath = path.relative(dir, normalizedPath);
|
30
|
+
return (relativePath !== "" &&
|
31
|
+
!relativePath.startsWith("..") &&
|
32
|
+
!path.isAbsolute(relativePath));
|
33
|
+
});
|
34
|
+
if (!isAllowed) {
|
35
|
+
throw new Error(`Access denied: ${p} is not within allowed directories`);
|
36
|
+
}
|
37
|
+
return normalizedPath;
|
38
|
+
}
|
39
|
+
//# sourceMappingURL=path.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/utils/path.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,CAAS;IACrC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,QAAQ,KAAK,GAAG,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,CAAS,EACT,kBAA4B;IAE5B,MAAM,cAAc,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAElE,6DAA6D;IAC7D,MAAM,SAAS,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;QAChD,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACxD,OAAO,CACL,YAAY,KAAK,EAAE;YACnB,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC;YAC9B,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAC/B,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,oCAAoC,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
package/package.json
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"name": "mcp-docs-service",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.2.1",
|
4
4
|
"description": "MCP Documentation Management Service - A Model Context Protocol implementation for documentation management",
|
5
|
+
"type": "module",
|
5
6
|
"main": "dist/index.js",
|
6
7
|
"types": "dist/index.d.ts",
|
7
8
|
"bin": {
|
@@ -9,9 +10,11 @@
|
|
9
10
|
},
|
10
11
|
"scripts": {
|
11
12
|
"build": "tsc",
|
12
|
-
"
|
13
|
+
"prepare": "npm run build",
|
14
|
+
"watch": "tsc --watch",
|
13
15
|
"test": "echo \"No tests yet\" && exit 0",
|
14
|
-
"start": "node dist/cli/bin.js"
|
16
|
+
"start": "node dist/cli/bin.js",
|
17
|
+
"prepare-publish": "node scripts/prepare-publish.js"
|
15
18
|
},
|
16
19
|
"keywords": [
|
17
20
|
"mcp",
|
@@ -19,21 +22,32 @@
|
|
19
22
|
"cursor",
|
20
23
|
"claude",
|
21
24
|
"markdown",
|
22
|
-
"model-context-protocol"
|
25
|
+
"model-context-protocol",
|
26
|
+
"knowledge-base",
|
27
|
+
"documentation-management",
|
28
|
+
"llm-context"
|
23
29
|
],
|
24
30
|
"author": "Aleks Petrov",
|
25
31
|
"license": "MIT",
|
26
32
|
"dependencies": {
|
27
|
-
"
|
33
|
+
"@modelcontextprotocol/sdk": "^0.5.0",
|
34
|
+
"diff": "^7.0.0",
|
35
|
+
"glob": "^11.0.1",
|
36
|
+
"js-yaml": "^4.1.0",
|
37
|
+
"minimatch": "^10.0.1",
|
38
|
+
"zod-to-json-schema": "^3.23.5"
|
28
39
|
},
|
29
40
|
"devDependencies": {
|
41
|
+
"@types/diff": "^7.0.1",
|
30
42
|
"@types/js-yaml": "^4.0.5",
|
31
43
|
"@types/node": "^18.0.0",
|
32
|
-
"
|
44
|
+
"shx": "^0.3.4",
|
45
|
+
"typescript": "^5.3.3"
|
33
46
|
},
|
34
47
|
"files": [
|
35
48
|
"dist",
|
36
49
|
"README.md",
|
50
|
+
"CHANGELOG.md",
|
37
51
|
"LICENSE"
|
38
52
|
],
|
39
53
|
"engines": {
|
package/dist/cli/bin.d.ts
DELETED
package/dist/cli/bin.js
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
"use strict";
|
3
|
-
/**
|
4
|
-
* MCP Documentation Management Service CLI
|
5
|
-
* This is the entry point for the CLI when run via npx
|
6
|
-
*/
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
8
|
-
const index_js_1 = require("./index.js");
|
9
|
-
// Parse command line arguments
|
10
|
-
const args = process.argv.slice(2);
|
11
|
-
const options = {
|
12
|
-
docsDir: "./docs",
|
13
|
-
createIfNotExists: false,
|
14
|
-
help: false,
|
15
|
-
};
|
16
|
-
// Process arguments
|
17
|
-
for (let i = 0; i < args.length; i++) {
|
18
|
-
const arg = args[i];
|
19
|
-
if (arg === "--docs-dir" && i + 1 < args.length) {
|
20
|
-
options.docsDir = args[++i];
|
21
|
-
}
|
22
|
-
else if (arg === "--create-dir") {
|
23
|
-
options.createIfNotExists = true;
|
24
|
-
}
|
25
|
-
else if (arg === "--help" || arg === "-h") {
|
26
|
-
options.help = true;
|
27
|
-
}
|
28
|
-
}
|
29
|
-
// Show help if requested
|
30
|
-
if (options.help) {
|
31
|
-
console.log(`
|
32
|
-
MCP Documentation Service
|
33
|
-
|
34
|
-
Usage:
|
35
|
-
npx mcp-docs-service [options]
|
36
|
-
|
37
|
-
Options:
|
38
|
-
--docs-dir <path> Specify the docs directory (default: ./docs)
|
39
|
-
--create-dir Create the docs directory if it doesn't exist
|
40
|
-
--help, -h Show this help message
|
41
|
-
`);
|
42
|
-
process.exit(0);
|
43
|
-
}
|
44
|
-
// Start the main process
|
45
|
-
(0, index_js_1.main)(options).catch((error) => {
|
46
|
-
console.error("Fatal error:", error);
|
47
|
-
process.exit(1);
|
48
|
-
});
|
49
|
-
//# sourceMappingURL=bin.js.map
|
package/dist/cli/bin.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/cli/bin.ts"],"names":[],"mappings":";;AAEA;;;GAGG;;AAEH,yCAAkC;AAElC,+BAA+B;AAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,QAAQ;IACjB,iBAAiB,EAAE,KAAK;IACxB,IAAI,EAAE,KAAK;CACZ,CAAC;AAEF,oBAAoB;AACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IACpC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAEpB,IAAI,GAAG,KAAK,YAAY,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE;QAC/C,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;KAC7B;SAAM,IAAI,GAAG,KAAK,cAAc,EAAE;QACjC,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;KAClC;SAAM,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE;QAC3C,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;KACrB;CACF;AAED,yBAAyB;AACzB,IAAI,OAAO,CAAC,IAAI,EAAE;IAChB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;GAUX,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,yBAAyB;AACzB,IAAA,eAAI,EAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC5B,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/cli/index.d.ts
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* CLI interface for the MCP Documentation Management Service
|
3
|
-
*
|
4
|
-
* This script is meant to be run from the command line to start the MCP server.
|
5
|
-
* It reads queries from stdin, processes them, and writes results to stdout.
|
6
|
-
*
|
7
|
-
* Usage:
|
8
|
-
* npx mcp-docs-service [options]
|
9
|
-
*/
|
10
|
-
/**
|
11
|
-
* Main function to process stdin commands
|
12
|
-
*/
|
13
|
-
export declare function main(options?: {
|
14
|
-
docsDir: string;
|
15
|
-
createIfNotExists: boolean;
|
16
|
-
}): Promise<void>;
|
package/dist/cli/index.js
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* CLI interface for the MCP Documentation Management Service
|
4
|
-
*
|
5
|
-
* This script is meant to be run from the command line to start the MCP server.
|
6
|
-
* It reads queries from stdin, processes them, and writes results to stdout.
|
7
|
-
*
|
8
|
-
* Usage:
|
9
|
-
* npx mcp-docs-service [options]
|
10
|
-
*/
|
11
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
12
|
-
if (k2 === undefined) k2 = k;
|
13
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
14
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
15
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
16
|
-
}
|
17
|
-
Object.defineProperty(o, k2, desc);
|
18
|
-
}) : (function(o, m, k, k2) {
|
19
|
-
if (k2 === undefined) k2 = k;
|
20
|
-
o[k2] = m[k];
|
21
|
-
}));
|
22
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
23
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
24
|
-
}) : function(o, v) {
|
25
|
-
o["default"] = v;
|
26
|
-
});
|
27
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
28
|
-
if (mod && mod.__esModule) return mod;
|
29
|
-
var result = {};
|
30
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
31
|
-
__setModuleDefault(result, mod);
|
32
|
-
return result;
|
33
|
-
};
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
35
|
-
exports.main = void 0;
|
36
|
-
const index_js_1 = require("../index.js");
|
37
|
-
const readline = __importStar(require("readline"));
|
38
|
-
/**
|
39
|
-
* Main function to process stdin commands
|
40
|
-
*/
|
41
|
-
async function main(options = {
|
42
|
-
docsDir: "./docs",
|
43
|
-
createIfNotExists: false,
|
44
|
-
}) {
|
45
|
-
console.error("MCP Documentation Management Service started.");
|
46
|
-
console.error(`Using docs directory: ${options.docsDir}`);
|
47
|
-
if (options.createIfNotExists) {
|
48
|
-
console.error("Will create directory if it doesn't exist");
|
49
|
-
}
|
50
|
-
console.error("Reading from stdin, writing results to stdout...");
|
51
|
-
// Create a custom query function that uses the specified docs directory
|
52
|
-
const query = (sql) => (0, index_js_1.query)(sql, {
|
53
|
-
docsDir: options.docsDir,
|
54
|
-
createIfNotExists: options.createIfNotExists,
|
55
|
-
});
|
56
|
-
// Create readline interface
|
57
|
-
const rl = readline.createInterface({
|
58
|
-
input: process.stdin,
|
59
|
-
output: process.stdout,
|
60
|
-
terminal: false,
|
61
|
-
});
|
62
|
-
// Handle process termination
|
63
|
-
process.on("SIGINT", () => {
|
64
|
-
console.error("\nMCP Documentation Management Service terminated.");
|
65
|
-
process.exit(0);
|
66
|
-
});
|
67
|
-
// Process lines from stdin
|
68
|
-
rl.on("line", async (line) => {
|
69
|
-
if (line.trim()) {
|
70
|
-
try {
|
71
|
-
// Process the command and write the result to stdout
|
72
|
-
const result = await query(line.trim());
|
73
|
-
console.log(JSON.stringify(result));
|
74
|
-
}
|
75
|
-
catch (error) {
|
76
|
-
// Log errors to stderr and write error result to stdout
|
77
|
-
console.error(`Error processing command: ${error instanceof Error ? error.message : String(error)}`);
|
78
|
-
console.log(JSON.stringify({
|
79
|
-
success: false,
|
80
|
-
error: error instanceof Error ? error.message : String(error),
|
81
|
-
}));
|
82
|
-
}
|
83
|
-
}
|
84
|
-
});
|
85
|
-
// Handle end of input
|
86
|
-
rl.on("close", () => {
|
87
|
-
console.error("Input stream closed. Waiting for output to flush...");
|
88
|
-
// Add a delay before exiting to ensure all output is flushed
|
89
|
-
setTimeout(() => {
|
90
|
-
console.error("Exiting...");
|
91
|
-
process.exit(0);
|
92
|
-
}, 1000);
|
93
|
-
});
|
94
|
-
}
|
95
|
-
exports.main = main;
|
96
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cli/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0CAAqD;AACrD,mDAAqC;AAErC;;GAEG;AACI,KAAK,UAAU,IAAI,CACxB,UAGI;IACF,OAAO,EAAE,QAAQ;IACjB,iBAAiB,EAAE,KAAK;CACzB;IAED,OAAO,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAC/D,OAAO,CAAC,KAAK,CAAC,yBAAyB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1D,IAAI,OAAO,CAAC,iBAAiB,EAAE;QAC7B,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC5D;IACD,OAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAElE,wEAAwE;IACxE,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,EAAE,CAC5B,IAAA,gBAAa,EAAC,GAAG,EAAE;QACjB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;KAC7C,CAAC,CAAC;IAEL,4BAA4B;IAC5B,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;QAClC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,6BAA6B;IAC7B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACpE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,2BAA2B;IAC3B,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAC3B,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE;YACf,IAAI;gBACF,qDAAqD;gBACrD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;gBACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;aACrC;YAAC,OAAO,KAAc,EAAE;gBACvB,wDAAwD;gBACxD,OAAO,CAAC,KAAK,CACX,6BACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACvD,EAAE,CACH,CAAC;gBACF,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CAAC;oBACb,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;iBAC9D,CAAC,CACH,CAAC;aACH;SACF;IACH,CAAC,CAAC,CAAC;IAEH,sBAAsB;IACtB,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QAClB,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACrE,6DAA6D;QAC7D,UAAU,CAAC,GAAG,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,EAAE,IAAI,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC;AArED,oBAqEC"}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Document Analyzer for generating insights about documentation
|
3
|
-
*/
|
4
|
-
import { DocAnalysisResult } from "../types/index.js";
|
5
|
-
import { DocManager } from "./docManager.js";
|
6
|
-
export declare class DocAnalyzer {
|
7
|
-
private docManager;
|
8
|
-
constructor(docManager: DocManager);
|
9
|
-
/**
|
10
|
-
* Analyze the documentation and generate insights
|
11
|
-
*/
|
12
|
-
analyzeDocumentation(directory?: string): Promise<DocAnalysisResult>;
|
13
|
-
/**
|
14
|
-
* Find documentation gaps (directories with few or no documents)
|
15
|
-
*/
|
16
|
-
findDocumentationGaps(): Promise<Record<string, number>>;
|
17
|
-
/**
|
18
|
-
* Calculate overall documentation health score (0-100)
|
19
|
-
*/
|
20
|
-
calculateHealthScore(): Promise<number>;
|
21
|
-
/**
|
22
|
-
* Generate suggestions for improving documentation
|
23
|
-
*/
|
24
|
-
generateSuggestions(): Promise<string[]>;
|
25
|
-
}
|
package/dist/core/docAnalyzer.js
DELETED
@@ -1,118 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* Document Analyzer for generating insights about documentation
|
4
|
-
*/
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.DocAnalyzer = void 0;
|
7
|
-
class DocAnalyzer {
|
8
|
-
constructor(docManager) {
|
9
|
-
this.docManager = docManager;
|
10
|
-
}
|
11
|
-
/**
|
12
|
-
* Analyze the documentation and generate insights
|
13
|
-
*/
|
14
|
-
async analyzeDocumentation(directory) {
|
15
|
-
const summaries = await this.docManager.getAllDocumentSummaries(directory);
|
16
|
-
// Count documents by status
|
17
|
-
const byStatus = {};
|
18
|
-
summaries.forEach((doc) => {
|
19
|
-
const status = doc.status || "undefined";
|
20
|
-
byStatus[status] = (byStatus[status] || 0) + 1;
|
21
|
-
});
|
22
|
-
// Count documents by directory
|
23
|
-
const byDirectory = {};
|
24
|
-
summaries.forEach((doc) => {
|
25
|
-
const dirPath = doc.path.split("/").slice(0, -1).join("/");
|
26
|
-
byDirectory[dirPath] = (byDirectory[dirPath] || 0) + 1;
|
27
|
-
});
|
28
|
-
// Find documents missing descriptions
|
29
|
-
const missingDescriptions = summaries.filter((doc) => !doc.description);
|
30
|
-
// Find recently updated documents (if lastUpdated is available)
|
31
|
-
let recentlyUpdated = [];
|
32
|
-
const docsWithDates = summaries.filter((doc) => doc.lastUpdated);
|
33
|
-
if (docsWithDates.length > 0) {
|
34
|
-
recentlyUpdated = docsWithDates
|
35
|
-
.sort((a, b) => {
|
36
|
-
const dateA = a.lastUpdated ? new Date(a.lastUpdated).getTime() : 0;
|
37
|
-
const dateB = b.lastUpdated ? new Date(b.lastUpdated).getTime() : 0;
|
38
|
-
return dateB - dateA;
|
39
|
-
})
|
40
|
-
.slice(0, 5); // Get the 5 most recently updated
|
41
|
-
}
|
42
|
-
return {
|
43
|
-
documentCount: summaries.length,
|
44
|
-
byStatus,
|
45
|
-
byDirectory,
|
46
|
-
recentlyUpdated,
|
47
|
-
missingDescriptions,
|
48
|
-
};
|
49
|
-
}
|
50
|
-
/**
|
51
|
-
* Find documentation gaps (directories with few or no documents)
|
52
|
-
*/
|
53
|
-
async findDocumentationGaps() {
|
54
|
-
const directories = await this.docManager.listDirectories();
|
55
|
-
const gaps = {};
|
56
|
-
for (const dir of directories) {
|
57
|
-
const files = await this.docManager.listMarkdownFiles(dir);
|
58
|
-
if (files.length < 2) {
|
59
|
-
// Consider a directory with less than 2 docs as a gap
|
60
|
-
gaps[dir] = files.length;
|
61
|
-
}
|
62
|
-
}
|
63
|
-
return gaps;
|
64
|
-
}
|
65
|
-
/**
|
66
|
-
* Calculate overall documentation health score (0-100)
|
67
|
-
*/
|
68
|
-
async calculateHealthScore() {
|
69
|
-
const summaries = await this.docManager.getAllDocumentSummaries();
|
70
|
-
if (summaries.length === 0) {
|
71
|
-
return 0; // No documents
|
72
|
-
}
|
73
|
-
// Calculate metrics
|
74
|
-
const withDescription = summaries.filter((doc) => doc.description).length;
|
75
|
-
const withTags = summaries.filter((doc) => doc.tags && doc.tags.length > 0).length;
|
76
|
-
const withStatus = summaries.filter((doc) => doc.status).length;
|
77
|
-
// Calculate score components (each worth up to 33.3 points)
|
78
|
-
const descriptionScore = (withDescription / summaries.length) * 33.3;
|
79
|
-
const tagsScore = (withTags / summaries.length) * 33.3;
|
80
|
-
const statusScore = (withStatus / summaries.length) * 33.3;
|
81
|
-
// Calculate the overall score
|
82
|
-
const healthScore = descriptionScore + tagsScore + statusScore;
|
83
|
-
return Math.round(healthScore);
|
84
|
-
}
|
85
|
-
/**
|
86
|
-
* Generate suggestions for improving documentation
|
87
|
-
*/
|
88
|
-
async generateSuggestions() {
|
89
|
-
const analysis = await this.analyzeDocumentation();
|
90
|
-
const gaps = await this.findDocumentationGaps();
|
91
|
-
const healthScore = await this.calculateHealthScore();
|
92
|
-
const suggestions = [];
|
93
|
-
// Suggest adding descriptions to documents that lack them
|
94
|
-
if (analysis.missingDescriptions &&
|
95
|
-
analysis.missingDescriptions.length > 0) {
|
96
|
-
suggestions.push(`Add descriptions to ${analysis.missingDescriptions.length} documents that are missing them.`);
|
97
|
-
}
|
98
|
-
// Suggest creating documents in empty or sparse directories
|
99
|
-
if (Object.keys(gaps).length > 0) {
|
100
|
-
for (const [dir, count] of Object.entries(gaps)) {
|
101
|
-
suggestions.push(`Add more documentation to the ${dir} directory (currently has ${count} documents).`);
|
102
|
-
}
|
103
|
-
}
|
104
|
-
// General suggestions based on health score
|
105
|
-
if (healthScore < 50) {
|
106
|
-
suggestions.push("Improve overall documentation quality by adding proper metadata to existing documents.");
|
107
|
-
}
|
108
|
-
// Suggestion for adding status to documents
|
109
|
-
if (analysis.byStatus &&
|
110
|
-
analysis.byStatus["undefined"] &&
|
111
|
-
analysis.byStatus["undefined"] > 0) {
|
112
|
-
suggestions.push(`Add status (draft, review, or published) to ${analysis.byStatus["undefined"]} documents.`);
|
113
|
-
}
|
114
|
-
return suggestions;
|
115
|
-
}
|
116
|
-
}
|
117
|
-
exports.DocAnalyzer = DocAnalyzer;
|
118
|
-
//# sourceMappingURL=docAnalyzer.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version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,CAAC;QAEtD,MAAM,WAAW,GAAa,EAAE,CAAC;QAEjC,0DAA0D;QAC1D,IACE,QAAQ,CAAC,mBAAmB;YAC5B,QAAQ,CAAC,mBAAmB,CAAC,MAAM,GAAG,CAAC,EACvC;YACA,WAAW,CAAC,IAAI,CACd,uBAAuB,QAAQ,CAAC,mBAAmB,CAAC,MAAM,mCAAmC,CAC9F,CAAC;SACH;QAED,4DAA4D;QAC5D,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBAC/C,WAAW,CAAC,IAAI,CACd,iCAAiC,GAAG,6BAA6B,KAAK,cAAc,CACrF,CAAC;aACH;SACF;QAED,4CAA4C;QAC5C,IAAI,WAAW,GAAG,EAAE,EAAE;YACpB,WAAW,CAAC,IAAI,CACd,wFAAwF,CACzF,CAAC;SACH;QAED,4CAA4C;QAC5C,IACE,QAAQ,CAAC,QAAQ;YACjB,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC;YAC9B,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,EAClC;YACA,WAAW,CAAC,IAAI,CACd,+CAA+C,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,aAAa,CAC3F,CAAC;SACH;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AApJD,kCAoJC"}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Document Manager for handling file operations
|
3
|
-
*/
|
4
|
-
import { DocContent, DocCreateParams, DocSummary, DocUpdateParams, SearchOptions } from "../types/index.js";
|
5
|
-
export declare class DocManager {
|
6
|
-
private baseDir;
|
7
|
-
private options;
|
8
|
-
constructor(baseDir?: string, options?: {
|
9
|
-
createIfNotExists?: boolean;
|
10
|
-
fileExtensions?: string[];
|
11
|
-
});
|
12
|
-
/**
|
13
|
-
* Initialize the docs directory
|
14
|
-
*/
|
15
|
-
private initializeDirectory;
|
16
|
-
/**
|
17
|
-
* List all markdown files in a directory recursively
|
18
|
-
*/
|
19
|
-
listMarkdownFiles(dir?: string): Promise<string[]>;
|
20
|
-
/**
|
21
|
-
* Get document content and metadata
|
22
|
-
*/
|
23
|
-
getDocument(filePath: string): Promise<DocContent | null>;
|
24
|
-
/**
|
25
|
-
* List directories in the docs folder
|
26
|
-
*/
|
27
|
-
listDirectories(dir?: string): Promise<string[]>;
|
28
|
-
/**
|
29
|
-
* Create a new document
|
30
|
-
*/
|
31
|
-
createDocument(params: DocCreateParams): Promise<boolean>;
|
32
|
-
/**
|
33
|
-
* Update an existing document
|
34
|
-
*/
|
35
|
-
updateDocument(params: DocUpdateParams): Promise<boolean>;
|
36
|
-
/**
|
37
|
-
* Delete a document
|
38
|
-
*/
|
39
|
-
deleteDocument(filePath: string): Promise<boolean>;
|
40
|
-
/**
|
41
|
-
* Basic search for documents matching query
|
42
|
-
*/
|
43
|
-
searchDocuments(options: SearchOptions): Promise<DocSummary[]>;
|
44
|
-
/**
|
45
|
-
* Get all documents as summaries
|
46
|
-
*/
|
47
|
-
getAllDocumentSummaries(directory?: string): Promise<DocSummary[]>;
|
48
|
-
}
|