document-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@document-mcpscan all components in my project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Document MCP Server
A Model Context Protocol (MCP) server designed to efficiently manage component documentation with AI-powered updates and token optimization.
Features
🚀 Component Scanning: Automatically scan project
componentsfolder and generate structured information🔐 MD5 Hashing: Generate MD5 hashes for files to track changes
📋 Component Queries: Quickly retrieve specific component details
✏️ Precision Updates: Update only description or props sections, saving significant tokens
🤖 AI-Friendly: Structured updates prevent AI hallucinations and unnecessary modifications
📊 Token Optimization: Save ~75% tokens compared to traditional full-file regeneration
Related MCP server: project-graph-mcp
Installation
NPM Package
# Install globally
npm install -g @tianyi-li/document-mcp
# Install as project dependency
npm install @tianyi-li/document-mcpDevelopment Setup
# Clone and setup
git clone https://github.com/TianyiLi/document-mcp.git
cd document-mcp
pnpm install
pnpm run buildQuick Start
1. Basic Usage
# Run the MCP server
document-mcp
# Or use npx/pnpx
npx @tianyi-li/document-mcp2. IDE Integration
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"document-mcp": {
"command": "npx",
"args": ["@tianyi-li/document-mcp"]
}
}
}Claude Code
Option 1: Through Claude Desktop (Automatic)
Claude Code automatically detects MCP servers configured in Claude Desktop - no additional setup required.
Option 2: Direct CLI Configuration
Configure directly via Claude Code CLI:
# Using npx (recommended)
claude mcp add document-mcp -- npx @tianyi-li/document-mcp
# Using global installation
claude mcp add document-mcp -- document-mcp
# List configured servers
claude mcp list
# Remove if needed
claude mcp remove document-mcpProject Documentation (CLAUDE.md)
Add to your project's CLAUDE.md for team reference:
# Document MCP Server
This project uses Document MCP Server for efficient component documentation management.
## Setup
```bash
# Quick setup
npm install -g @tianyi-li/document-mcp
claude mcp add document-mcp -- document-mcpAvailable Tools
init_components- Scan all project componentsget_component_info- Get specific component detailsupdate_component_description- Update description only (saves ~75% tokens)update_component_props- Update props only (saves ~75% tokens)update_component_content- Batch update multiple sectionscompare_md5- Verify file changes
Workflow
init_components→ Understand project structureupdate_component_*→ Make targeted updatescompare_md5→ Verify changes
## API Reference
### Reading Tools
#### `init_components`
Scan components folder and generate structured JSON data.
**Parameters:**
- `projectRoot` (optional): Project root path, defaults to current directory
**Returns:**
```json
[
{
"name": "Button",
"path": "components/Button",
"description": "A reusable button component",
"props": "Props information",
"md5": "a1b2c3d4e5f6..."
}
]get_component_info
Get detailed information for a specific component.
Parameters:
componentName(required): Component nameprojectRoot(optional): Project root path
Returns: Single component JSON object
Update Tools ⭐ Core Value
update_component_description
Precisely update component description section - best choice for token saving.
Parameters:
componentName(required): Component namedescription(required): New component descriptionprojectRoot(optional): Project root path
Usage: AI agents can update only the description section without regenerating entire files
update_component_props
Precisely update component Props section with Markdown table support.
Parameters:
componentName(required): Component nameprops(required): New Props content (supports Markdown format)projectRoot(optional): Project root path
Example Props Format:
| Property | Type | Required | Default | Description |
|----------|------|----------|---------|-------------|
| variant | "primary" \| "secondary" | No | "primary" | Button style |
| size | "small" \| "medium" \| "large" | No | "medium" | Button size |
| disabled | boolean | No | false | Whether disabled |update_component_content
Batch update component description and/or Props with partial update support.
Parameters:
componentName(required): Component namedescription(optional): New component descriptionprops(optional): New Props contentprojectRoot(optional): Project root path
Usage: Can update multiple sections simultaneously or individually
Validation Tools
calculate_md5
Calculate MD5 hash for specified file.
Parameters:
filePath(required): File path for MD5 calculation
Returns: MD5 hash string
compare_md5
Compare current file MD5 with expected value.
Parameters:
filePath(required): File path to checkexpectedMd5(required): Expected MD5 hash value
Returns:
{
"currentMd5": "current file MD5",
"expectedMd5": "expected MD5",
"isMatch": true/false,
"hasChanged": true/false
}Use Cases
Reading Phase
Automated Documentation Management: AI agents quickly understand project component structure
Component Information Queries: Avoid scanning entire project structure, saving tokens
File Change Tracking: Ensure document content consistency through MD5 comparison
Update Phase ⭐ Core Value
Precision Document Updates: Update only necessary parts (description or Props), dramatically saving tokens
Prevent AI Hallucinations: Structured updates avoid AI adding/removing unnecessary items
Incremental Maintenance: Modify based on existing content rather than complete rewrites
Consistency Guarantee: Use standard templates and formats for unified document style
Workflow Example
1. init_components → Understand all components
2. get_component_info → Get specific component current state
3. update_component_description → Update only description section
4. compare_md5 → Verify update successToken Savings
Traditional Method: AI reads full file + regenerates complete file = ~2000 tokens
Using This Tool: Get existing info + precise partial updates = ~500 tokens
Savings Rate: ~75% token reduction
Project Structure
This tool assumes your project has the following structure:
project-root/
├── components/
│ ├── Button/
│ │ └── README.md
│ ├── Input/
│ │ └── README.md
│ └── ...
└── ...Each component folder should contain a README.md file with component description and props information.
Configuration Examples
Using pnpx/npx (Recommended)
{
"mcpServers": {
"document-mcp": {
"command": "pnpx",
"args": ["@tianyi-li/document-mcp"],
"cwd": "/path/to/your/project"
}
}
}Direct Binary Execution
{
"mcpServers": {
"document-mcp": {
"command": "/path/to/node_modules/.bin/document-mcp"
}
}
}Global Installation
# Install globally
npm install -g @tianyi-li/document-mcp
# Use in Claude Desktop config
{
"mcpServers": {
"document-mcp": {
"command": "document-mcp"
}
}
}Development
Build from Source
git clone https://github.com/TianyiLi/document-mcp.git
cd document-mcp
pnpm install
pnpm run buildAvailable Scripts
pnpm run build # Compile TypeScript
pnpm run dev # Watch mode compilation
pnpm start # Run the serverBest Practices
First Use: Run
init_componentsto scan project componentsChange Tracking: Use
compare_md5to check for file modificationsSpecific Queries: Use
get_component_infofor individual component detailsRegular Sync: Periodically run
init_componentsto keep data currentToken Optimization: Use precise update tools instead of full rewrites
Requirements
Node.js >= 18.0.0
Components organized in
/componentsfolder structureEach component should have a
README.mdfile
License
ISC License
Contributing
Issues and pull requests are welcome on GitHub.
Repository
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/TianyiLi/document-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server