mcp-docs-service 0.2.0 → 0.2.3
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 +52 -0
- package/LICENSE +1 -1
- package/README.md +30 -57
- package/dist/cli/bin.d.ts +5 -3
- package/dist/cli/bin.js +41 -37
- package/dist/cli/bin.js.map +1 -1
- package/dist/handlers/docs.d.ts +26 -0
- package/dist/handlers/docs.js +513 -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 +473 -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 +164 -0
- package/dist/schemas/tools.js +53 -0
- package/dist/schemas/tools.js.map +1 -0
- package/dist/types/docs.d.ts +74 -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 +70 -0
- package/dist/utils/path.js.map +1 -0
- package/package.json +20 -8
- package/dist/cli/index.d.ts +0 -16
- package/dist/cli/index.js +0 -108
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/jsonrpc.d.ts +0 -29
- package/dist/cli/jsonrpc.js +0 -121
- package/dist/cli/jsonrpc.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/CHANGELOG.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to the MCP Docs Service will be documented in this file.
|
4
|
+
|
5
|
+
## [0.2.2] - 2024-03-12
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
|
9
|
+
- Fixed health check tool to properly access docs directory
|
10
|
+
- Improved path validation to better handle relative paths
|
11
|
+
- Enhanced CLI to support custom docs directory with `--docs-dir` and `--create-dir` options
|
12
|
+
- Added better error handling and fallback for invalid paths
|
13
|
+
|
14
|
+
### Added
|
15
|
+
|
16
|
+
- Added troubleshooting section to health check documentation
|
17
|
+
|
18
|
+
## [0.2.1] - 2023-03-15
|
19
|
+
|
20
|
+
### Added
|
21
|
+
|
22
|
+
- New `check_documentation_health` tool for analyzing documentation quality
|
23
|
+
- Documentation health score calculation based on metadata completeness, broken links, and orphaned documents
|
24
|
+
- Detailed issue reporting for documentation problems
|
25
|
+
- Updated documentation with examples and usage guidelines for the health check tool
|
26
|
+
|
27
|
+
## [0.2.0] - 2023-03-14
|
28
|
+
|
29
|
+
### Added
|
30
|
+
|
31
|
+
- Added proper CLI support with `npx mcp-docs-service`
|
32
|
+
- Added support for custom docs directory with `--docs-dir` option
|
33
|
+
- Added support for creating docs directory with `--create-dir` option
|
34
|
+
- Added Cursor integration guide
|
35
|
+
- Added Claude Desktop integration guide
|
36
|
+
|
37
|
+
### Fixed
|
38
|
+
|
39
|
+
- Fixed MCP response format to comply with the latest protocol
|
40
|
+
- Fixed path validation for Windows paths
|
41
|
+
- Fixed error handling for invalid paths
|
42
|
+
|
43
|
+
## [0.1.0] - 2023-03-10
|
44
|
+
|
45
|
+
### Added
|
46
|
+
|
47
|
+
- Initial release with core documentation management features
|
48
|
+
- Support for reading, writing, and editing markdown files with frontmatter
|
49
|
+
- Support for listing documents and getting structure
|
50
|
+
- Support for generating navigation
|
51
|
+
- Support for searching documents
|
52
|
+
- Support for generating knowledge bases for LLM context
|
package/LICENSE
CHANGED
package/README.md
CHANGED
@@ -7,9 +7,26 @@ The MCP Documentation Service is a custom implementation of the Model Context Pr
|
|
7
7
|
- **Document Management**: Create, read, update, and delete markdown documentation files
|
8
8
|
- **Metadata Management**: Work with document frontmatter (YAML metadata)
|
9
9
|
- **Search**: Search through documentation using keywords and filters
|
10
|
+
- **Knowledge Base Generation**: Create comprehensive knowledge bases for LLM context
|
11
|
+
- **Structure Analysis**: Analyze documentation structure and relationships
|
12
|
+
- **Navigation Generation**: Generate navigation structures for documentation
|
13
|
+
- **Tag Management**: Organize documentation by tags and categories
|
10
14
|
- **Analytics**: Analyze documentation health and get suggestions for improvement
|
11
15
|
- **Custom Directory Support**: Specify a custom docs directory and create it if it doesn't exist
|
12
|
-
|
16
|
+
|
17
|
+
## Documentation
|
18
|
+
|
19
|
+
Comprehensive documentation is available in the `docs` directory:
|
20
|
+
|
21
|
+
- [Getting Started Guide](docs/guides/getting-started.md) - Introduction to the MCP Docs Manager
|
22
|
+
- [API Overview](docs/api/overview.md) - Overview of the API and available tools
|
23
|
+
- [Tools Reference](docs/api/tools-reference.md) - Complete reference of all available tools
|
24
|
+
- [Features Overview](docs/features.md) - Comprehensive overview of all features
|
25
|
+
- [Basic Usage Tutorial](docs/tutorials/basic-usage.md) - Tutorial for basic usage
|
26
|
+
- [Examples](docs/examples/) - Code examples for common tasks
|
27
|
+
- [Navigation Generator](docs/examples/navigation-generator.md) - Example of how to generate navigation for documentation
|
28
|
+
- [Knowledge Base Generator](docs/examples/knowledge-base-generator.md) - Example of how to generate a knowledge base for LLM context
|
29
|
+
- [Roadmap](docs/roadmap.md) - Development roadmap and planned features
|
13
30
|
|
14
31
|
## Installation
|
15
32
|
|
@@ -178,13 +195,9 @@ async function example() {
|
|
178
195
|
example();
|
179
196
|
```
|
180
197
|
|
181
|
-
## Query
|
198
|
+
## Query Format
|
182
199
|
|
183
|
-
The service
|
184
|
-
|
185
|
-
### SQL-like Format
|
186
|
-
|
187
|
-
The traditional SQL-like query format:
|
200
|
+
The service uses a SQL-like query format to execute commands:
|
188
201
|
|
189
202
|
```
|
190
203
|
command_name(param1="value1", param2="value2")
|
@@ -196,60 +209,20 @@ For example:
|
|
196
209
|
get_document(path="architecture/overview.md")
|
197
210
|
```
|
198
211
|
|
199
|
-
### JSON-RPC 2.0 Format
|
200
|
-
|
201
|
-
As of version 0.2.0, the service also supports the JSON-RPC 2.0 format used by Cursor and other MCP clients:
|
202
|
-
|
203
|
-
```json
|
204
|
-
{
|
205
|
-
"jsonrpc": "2.0",
|
206
|
-
"method": "get_document",
|
207
|
-
"params": {
|
208
|
-
"path": "architecture/overview.md"
|
209
|
-
},
|
210
|
-
"id": 1
|
211
|
-
}
|
212
|
-
```
|
213
|
-
|
214
|
-
The service automatically detects the format of the input and processes it accordingly.
|
215
|
-
|
216
212
|
## Available Commands
|
217
213
|
|
218
|
-
###
|
219
|
-
|
220
|
-
- **list_files(directory="")**: List all markdown files (optionally in a specific directory)
|
221
|
-
- **list_directories(directory="")**: List all directories (optionally in a specific directory)
|
222
|
-
- **get_document(path="path/to/doc.md")**: Get a document's content and metadata
|
223
|
-
- **create_document(path="path/to/doc.md", content="content", metadata={...})**: Create a new document
|
224
|
-
- **update_document(path="path/to/doc.md", content="updated content", metadata={...})**: Update an existing document
|
225
|
-
- **delete_document(path="path/to/doc.md")**: Delete a document
|
214
|
+
### Documentation Tools
|
226
215
|
|
227
|
-
|
228
|
-
|
229
|
-
- **
|
230
|
-
- **
|
231
|
-
- **
|
232
|
-
- **
|
216
|
+
- **read_document(path="path/to/doc.md")**: Read a markdown document and extract its content and metadata
|
217
|
+
- **list_documents(basePath="")**: List all markdown documents in a directory
|
218
|
+
- **get_structure(basePath="")**: Get the structure of the documentation directory
|
219
|
+
- **get_navigation(basePath="")**: Get the navigation structure for the documentation
|
220
|
+
- **get_docs_knowledge_base(basePath="", includeSummaries=true, maxSummaryLength=500)**: Create a comprehensive knowledge base of documentation for LLM context
|
221
|
+
- **write_document(path="path/to/doc.md", content="content", metadata={...})**: Write content to a markdown document with frontmatter
|
222
|
+
- **edit_document(path="path/to/doc.md", edits=[{oldText: "...", newText: "..."}])**: Apply edits to a markdown document while preserving frontmatter
|
223
|
+
- **delete_document(path="path/to/doc.md")**: Delete a markdown document
|
224
|
+
- **search_documents(basePath="", query="search term", tags=["tag1"], status="published")**: Search for markdown documents matching criteria
|
233
225
|
|
234
226
|
## License
|
235
227
|
|
236
228
|
MIT
|
237
|
-
|
238
|
-
Just published MCP Dcumentation Service 🔥
|
239
|
-
Open source, vibe coding only.A tool that lets AI assistants interact with your documentation through the Model Context Protocol.It enables AI tools like Claude and Cursor to read, create, update, and analyze your markdown docs with a simple query interface.Key features:
|
240
|
-
✅ Document CRUD operations with frontmatter support
|
241
|
-
✅ Documentation search and health analytics
|
242
|
-
✅ Custom directory handlingtest it: `npx mcp-docs-service`
|
243
|
-
|
244
|
-
Why document your project when working with AI assistants like Claude in Cursor?Good documentation gives AI context about your project's architecture, decisions, and conventions. This means:• More accurate code suggestions
|
245
|
-
• Better understanding of your codebase
|
246
|
-
• Fewer misunderstandings and errors
|
247
|
-
• Consistent implementation of patternsDocumentation is the map that helps AI navigate your code landscape.
|
248
|
-
|
249
|
-
Use with Cursor IDE:1. Set up mcp-docs-service in your .cursor/mcp.json 2. Ask Cursor: "Analyze our documentation health" 3. Cursor uses MCP to scan your docs and report issues 4. Ask: "Create a guide for our authentication system" 5. Cursor generates a well-structured doc based on your codeThe AI can now read and write to your docs directory, keeping documentation in sync with code changes 💥
|
250
|
-
|
251
|
-
With Claude Desktop:1. Configure mcp-docs-service in claude_desktop_config.json 2. Ask: "What's our approach to error handling?" 3. Claude searches your docs and explains your patterns 4. Say: "Our validation changed, update the API docs" 5. Claude updates the relevant markdown filesClaude becomes your documentation assistant, maintaining docs without switching contexts or tools.
|
252
|
-
|
253
|
-
Real example from my workflow:"Claude, analyze our docs and identify gaps in our API documentation"Claude found 7 endpoints missing docs, created templates for each, and suggested improvements to our existing docs.This took 2 minutes instead of hours of manual review!Documentation becomes a living part of your codebase, not an afterthought.
|
254
|
-
|
255
|
-
Getting started is simple:1. npm install -g mcp-docs-service 2. Add to your AI tool config 3. Start asking questions about your docsFull setup guide: npmjs.com/packa…This is just v0.1.1 - I'd love feedback on how you're using it and what features would help your documentation workflow.
|
package/dist/cli/bin.d.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
/**
|
3
|
-
* MCP
|
4
|
-
*
|
3
|
+
* MCP Docs Service CLI
|
4
|
+
*
|
5
|
+
* This is the entry point for the CLI version of the MCP Docs Service.
|
6
|
+
* It simply imports and runs the main service.
|
5
7
|
*/
|
6
|
-
|
8
|
+
import "../index.js";
|
package/dist/cli/bin.js
CHANGED
@@ -1,49 +1,53 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
-
"use strict";
|
3
2
|
/**
|
4
|
-
* MCP
|
5
|
-
*
|
3
|
+
* MCP Docs Service CLI
|
4
|
+
*
|
5
|
+
* This is the entry point for the CLI version of the MCP Docs Service.
|
6
|
+
* It simply imports and runs the main service.
|
6
7
|
*/
|
7
|
-
|
8
|
-
|
8
|
+
import path from "path";
|
9
|
+
import fs from "fs";
|
10
|
+
import { fileURLToPath } from "url";
|
11
|
+
// Get the current directory
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
13
|
+
const __dirname = path.dirname(__filename);
|
9
14
|
// Parse command line arguments
|
10
15
|
const args = process.argv.slice(2);
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
help: false,
|
15
|
-
};
|
16
|
-
// Process arguments
|
16
|
+
let docsDir = path.join(process.cwd(), "docs");
|
17
|
+
let createDir = false;
|
18
|
+
// Parse arguments
|
17
19
|
for (let i = 0; i < args.length; i++) {
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
if (args[i] === "--docs-dir" && i + 1 < args.length) {
|
21
|
+
docsDir = path.resolve(args[i + 1]);
|
22
|
+
i++; // Skip the next argument
|
21
23
|
}
|
22
|
-
else if (
|
23
|
-
|
24
|
-
}
|
25
|
-
else if (arg === "--help" || arg === "-h") {
|
26
|
-
options.help = true;
|
24
|
+
else if (args[i] === "--create-dir") {
|
25
|
+
createDir = true;
|
27
26
|
}
|
28
27
|
}
|
29
|
-
//
|
30
|
-
if (
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
`);
|
42
|
-
process.exit(0);
|
28
|
+
// Create docs directory if it doesn't exist and --create-dir is specified
|
29
|
+
if (createDir) {
|
30
|
+
try {
|
31
|
+
if (!fs.existsSync(docsDir)) {
|
32
|
+
fs.mkdirSync(docsDir, { recursive: true });
|
33
|
+
console.log(`Created docs directory: ${docsDir}`);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
catch (error) {
|
37
|
+
console.error(`Error creating docs directory: ${error}`);
|
38
|
+
process.exit(1);
|
39
|
+
}
|
43
40
|
}
|
44
|
-
//
|
45
|
-
|
46
|
-
console.error(
|
41
|
+
// Ensure the docs directory exists
|
42
|
+
if (!fs.existsSync(docsDir)) {
|
43
|
+
console.error(`Error: Docs directory does not exist: ${docsDir}`);
|
44
|
+
console.error(`Use --create-dir to create it automatically`);
|
47
45
|
process.exit(1);
|
48
|
-
}
|
46
|
+
}
|
47
|
+
// Add the docs directory to process.argv so it's available to the main service
|
48
|
+
process.argv.push(docsDir);
|
49
|
+
// Import the main service
|
50
|
+
import "../index.js";
|
51
|
+
// The main service will handle the CLI arguments and execution
|
52
|
+
// No additional code needed here as the main index.ts already has CLI functionality
|
49
53
|
//# sourceMappingURL=bin.js.map
|
package/dist/cli/bin.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/cli/bin.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/cli/bin.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,4BAA4B;AAC5B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,+BAA+B;AAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;AAC/C,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,kBAAkB;AAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;IACrC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,YAAY,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACpD,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACpC,CAAC,EAAE,CAAC,CAAC,yBAAyB;IAChC,CAAC;SAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,cAAc,EAAE,CAAC;QACtC,SAAS,GAAG,IAAI,CAAC;IACnB,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,IAAI,SAAS,EAAE,CAAC;IACd,IAAI,CAAC;QACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3C,OAAO,CAAC,GAAG,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,kCAAkC,KAAK,EAAE,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,mCAAmC;AACnC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5B,OAAO,CAAC,KAAK,CAAC,yCAAyC,OAAO,EAAE,CAAC,CAAC;IAClE,OAAO,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;IAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,+EAA+E;AAC/E,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAE3B,0BAA0B;AAC1B,OAAO,aAAa,CAAC;AAErB,+DAA+D;AAC/D,oFAAoF"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { ToolResponse } from "../types/tools.js";
|
2
|
+
/**
|
3
|
+
* Reads a markdown document and extracts its content and metadata
|
4
|
+
*/
|
5
|
+
export declare function readDocument(docPath: string, allowedDirectories: string[]): Promise<ToolResponse>;
|
6
|
+
/**
|
7
|
+
* Lists all markdown documents in a directory
|
8
|
+
*/
|
9
|
+
export declare function listDocuments(basePath: string, allowedDirectories: string[]): Promise<ToolResponse>;
|
10
|
+
/**
|
11
|
+
* Gets the structure of the documentation directory
|
12
|
+
*/
|
13
|
+
export declare function getStructure(basePath: string, allowedDirectories: string[]): Promise<ToolResponse>;
|
14
|
+
/**
|
15
|
+
* Gets the navigation structure for the documentation
|
16
|
+
*/
|
17
|
+
export declare function getNavigation(basePath: string, allowedDirectories: string[]): Promise<ToolResponse>;
|
18
|
+
/**
|
19
|
+
* Checks the health of documentation
|
20
|
+
*/
|
21
|
+
export declare function checkDocumentationHealth(basePath: string, options: {
|
22
|
+
checkLinks?: boolean;
|
23
|
+
checkMetadata?: boolean;
|
24
|
+
checkOrphans?: boolean;
|
25
|
+
requiredMetadataFields?: string[];
|
26
|
+
}, allowedDirectories: string[]): Promise<ToolResponse>;
|