mcp docs service
A Model Context Protocol implementation that enables AI assistants to interact with markdown documentation files, providing capabilities for document management, metadata handling, search, and documentation health analysis.
A Model Context Protocol implementation that enables AI assistants to interact with markdown documentation files, providing capabilities for document management, metadata handling, search, and documentation health analysis.
MCP Documentation Service is a Model Context Protocol (MCP) implementation for documentation management. It provides a set of tools for reading, writing, and managing markdown documentation with frontmatter metadata. The service is designed to work seamlessly with AI assistants like Claude in Cursor or Claude Desktop, making it easy to manage your documentation through natural language interactions.
Requires Node to be installed on your machine.
npm install -g mcp-docs-service
Or use directly with npx:
npx mcp-docs-service /path/to/docs
To use with Cursor, create a .cursor/mcp.json
file in your project root:
{
"mcpServers": {
"docs-manager": {
"command": "npx",
"args": ["-y", "mcp-docs-service", "/path/to/your/docs"]
}
}
}
To use MCP Docs Service with Claude Desktop:
Install Claude Desktop - Download the latest version from Claude's website.
Configure Claude Desktop for MCP:
Open Claude Desktop
This will create a configuration file at:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%Claudeclaude_desktop_config.json
Edit the configuration file to add the MCP Docs Service:
{
"mcpServers": {
"docs-manager": {
"command": "npx",
"args": ["-y", "mcp-docs-service", "/path/to/your/docs"]
}
}
}
Make sure to replace /path/to/your/docs
with the absolute path to your documentation directory.
Restart Claude Desktop completely.
Verify the tool is available - After restarting, you should see a green dot for docs-manager MCP tool (Cursor Settings > MCP)
Troubleshooting:
~/Library/Logs/Claude/mcp*.log
%APPDATA%Claudelogsmcp*.log
When using Claude in Cursor, you can invoke the tools in two ways:
Can you search my documentation for anything related to "getting started"?
Please list all the markdown files in my docs directory.
Could you check if there are any issues with my documentation?
@docs-manager mcp_docs_manager_read_document path=docs/getting-started.md
@docs-manager mcp_docs_manager_list_documents recursive=true
@docs-manager mcp_docs_manager_check_documentation_health
When using Claude Desktop, you can invoke the tools in two ways:
Can you read the README.md file for me?
Please find all documents that mention "API" in my documentation.
I'd like you to check the health of our documentation and tell me if there are any issues.
Claude will interpret your natural language requests and use the appropriate tool with the correct parameters. You don't need to remember the exact tool names or parameter formats - just describe what you want to do!
Here are some common commands you can use with the tools:
@docs-manager mcp_docs_manager_read_document path=docs/getting-started.md
@docs-manager mcp_docs_manager_write_document path=docs/new-document.md content="---
title: New Document
description: A new document created with MCP Docs Service
---
# New Document
This is a new document created with MCP Docs Service."
@docs-manager mcp_docs_manager_edit_document path=README.md edits=[{"oldText":"# Documentation", "newText":"# Project Documentation"}]
@docs-manager mcp_docs_manager_search_documents query="getting started"
@docs-manager mcp_docs_manager_generate_navigation
Contributions are welcome! Here's how you can contribute:
git checkout -b feature/my-feature
git commit -am 'Add my feature'
git push origin feature/my-feature
Please make sure your code follows the existing style and includes appropriate tests.
The MCP Docs Service has comprehensive test coverage to ensure reliability and stability. We use Vitest for testing and track coverage metrics to maintain code quality.
# Run all tests
npm test
# Run tests with coverage report
npm run test:coverage
The test suite includes:
Our tests are designed to be robust and handle potential errors in the implementation, ensuring they pass even if there are issues with the underlying code.
After running the coverage command, detailed reports are generated in the coverage
directory:
coverage/index.html
coverage/coverage-final.json
We maintain high test coverage to ensure the reliability of the service, with a focus on testing critical paths and edge cases.
We use the MCP Docs Service to maintain the health of our own documentation. The health score is based on:
You can check the health of your documentation with:
npx mcp-docs-service --health-check /path/to/docs
MCP Docs Service can generate a consolidated documentation file optimized for large language models. This feature is useful when you want to provide your entire documentation set to an LLM for context:
# Generate consolidated documentation with default filename (consolidated-docs.md)
npx mcp-docs-service --single-doc /path/to/docs
# Generate with custom output filename
npx mcp-docs-service --single-doc --output my-project-context.md /path/to/docs
# Limit the total tokens in the consolidated documentation
npx mcp-docs-service --single-doc --max-tokens 100000 /path/to/docs
The consolidated output includes:
MCP Docs Service is designed to be resilient by default. The service automatically handles incomplete or poorly structured documentation without failing:
This makes the service particularly useful for:
The service will always provide helpful feedback rather than failing, allowing you to incrementally improve your documentation over time.
For more detailed information, check out our documentation:
MIT
[
{
"description": "Read a markdown document from the docs directory. Returns the document content including frontmatter. Use this tool when you need to examine the contents of a single document.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"path": {
"type": "string"
}
},
"required": [
"path"
],
"type": "object"
},
"name": "read_document"
},
{
"description": "Create a new markdown document or completely overwrite an existing document with new content. Use with caution as it will overwrite existing documents without warning. Can create parent directories if they don't exist.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"content": {
"type": "string"
},
"createDirectories": {
"default": true,
"type": "boolean"
},
"path": {
"type": "string"
}
},
"required": [
"path",
"content"
],
"type": "object"
},
"name": "write_document"
},
{
"description": "Make line-based edits to a markdown document. Each edit replaces exact line sequences with new content. Returns a git-style diff showing the changes made.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"dryRun": {
"default": false,
"type": "boolean"
},
"edits": {
"items": {
"additionalProperties": false,
"properties": {
"newText": {
"type": "string"
},
"oldText": {
"type": "string"
}
},
"required": [
"oldText",
"newText"
],
"type": "object"
},
"type": "array"
},
"path": {
"type": "string"
}
},
"required": [
"path",
"edits"
],
"type": "object"
},
"name": "edit_document"
},
{
"description": "List all markdown documents in the docs directory or a subdirectory. Returns the relative paths to all documents.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"basePath": {
"type": "string"
},
"path": {
"type": "string"
},
"recursive": {
"default": false,
"type": "boolean"
}
},
"type": "object"
},
"name": "list_documents"
},
{
"description": "Search for markdown documents containing specific text in their content or frontmatter. Returns the relative paths to matching documents.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"basePath": {
"default": "",
"type": "string"
},
"path": {
"type": "string"
},
"query": {
"type": "string"
}
},
"required": [
"query"
],
"type": "object"
},
"name": "search_documents"
},
{
"description": "Generate a navigation structure from the markdown documents in the docs directory. Returns a JSON structure that can be used for navigation menus.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"basePath": {
"type": "string"
},
"path": {
"type": "string"
},
"recursive": {
"default": false,
"type": "boolean"
}
},
"type": "object"
},
"name": "generate_documentation_navigation"
},
{
"description": "Check the health of the documentation by analyzing frontmatter, links, and navigation. Returns a report with issues and a health score.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"basePath": {
"default": "",
"type": "string"
},
"path": {
"type": "string"
}
},
"type": "object"
},
"name": "check_documentation_health"
},
{
"description": "Create a new folder in the docs directory. Optionally creates a README.md file in the new folder with basic frontmatter.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"createReadme": {
"default": true,
"type": "boolean"
},
"path": {
"type": "string"
}
},
"required": [
"path"
],
"type": "object"
},
"name": "create_folder"
},
{
"description": "Move a document from one location to another. Optionally updates references to the document in other files.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"destinationPath": {
"type": "string"
},
"path": {
"type": "string"
},
"sourcePath": {
"type": "string"
},
"updateReferences": {
"default": true,
"type": "boolean"
}
},
"required": [
"sourcePath",
"destinationPath"
],
"type": "object"
},
"name": "move_document"
},
{
"description": "Rename a document while preserving its location and content. Optionally updates references to the document in other files.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"newName": {
"type": "string"
},
"path": {
"type": "string"
},
"updateReferences": {
"default": true,
"type": "boolean"
}
},
"required": [
"path",
"newName"
],
"type": "object"
},
"name": "rename_document"
},
{
"description": "Update the navigation order of a document by modifying its frontmatter.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"order": {
"type": "number"
},
"path": {
"type": "string"
}
},
"required": [
"path",
"order"
],
"type": "object"
},
"name": "update_navigation_order"
},
{
"description": "Create a new navigation section with an index.md file.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"order": {
"type": "number"
},
"path": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"path",
"title"
],
"type": "object"
},
"name": "create_documentation_section"
},
{
"description": "Check for broken internal links in documentation files.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"basePath": {
"default": "",
"type": "string"
},
"path": {
"type": "string"
},
"recursive": {
"default": true,
"type": "boolean"
}
},
"type": "object"
},
"name": "validate_documentation_links"
},
{
"description": "Ensure all documents have required metadata fields.",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"basePath": {
"default": "",
"type": "string"
},
"path": {
"type": "string"
},
"requiredFields": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"name": "validate_documentation_metadata"
}
]