🎭 克劳德汽车文档
 ](https://nodejs.org) ](https://python.org) 
一个MCP(模型上下文协议)服务器,为克劳德代码提供自动文档生成。与您的开发工作流程集成,以捕获和记录项目实施。
🌟 特性
🎯 核心能力
- 🔮 自动文档生成:自动捕获项目实施
- 🎪 仿真能力:使用模拟工具触发测试文档
- 🌊 文件系统监视:文件更改的实时文档更新
- 🌍 多项目支持:同时管理多个项目的文档
- 🎨 智能上下文提取:自动检测项目类型和技术
- ⚖️ 队列管理:用于文件任务的强大排队系统
🚀 集成
- ⚡ Claude代码集成:用于无缝Claude Code工作流的原生MCP服务器
- 🔬 技术检测:支持Node.js、Python、Rust、Go和一般项目
- 💎 可配置存储:具有环境变量的灵活文档存储
- 🏆 开源:麻省理工学院获得社区使用和协作许可
📋 先决条件
- 🟢 Node.js: ≥18.0.0
- 🐍 python:≥3.8(用于监控脚本)
- 🎯 克劳德代码:支持MCP的最新版本
🛠️ 安装
🚀 选项1:快速安装(推荐)
# Clone the repository
git clone https://github.com/Puneet8800/claude-auto-documenter-v2.git
cd claude-auto-documenter-v2
# Run the installation script
chmod +x scripts/install.sh
./scripts/install.sh🔧 选项2:手动安装
# Install Node.js dependencies
npm install
# Install Python dependencies
pip install -r requirements.txt
# Make scripts executable
chmod +x scripts/*.sh⚙️ 配置
🌍 环境变量
创建一个 .env 项目根目录中的文件:
# Documentation storage path (default: ~/auto-docs)
AUTO_DOC_DOCS_PATH=/path/to/your/documentation
# Additional configuration options (optional)
# AUTO_DOC_MAX_RETRIES=3
# AUTO_DOC_RETRY_DELAY=1000
# Claude agents directory (default: ~/.claude/agents)
CLAUDE_AGENTS_PATH=/path/to/claude/agents
# Retry configuration
AUTO_DOC_MAX_RETRIES=3
AUTO_DOC_RETRY_DELAY=1000
# File watching patterns (comma-separated)
AUTO_DOC_WATCH_PATTERNS="**/*.js,**/*.ts,**/*.py,**/*.md,**/*.json"
AUTO_DOC_IGNORE_PATTERNS="node_modules/**,.git/**,dist/**,build/**"🎯 Claude代码集成
添加到您的Claude Code MCP配置中(claude_desktop_config.json):
{
"mcpServers": {
"auto-documenter": {
"command": "node",
"args": ["/path/to/auto-documenter/src/index.js"],
"env": {
"AUTO_DOC_DOCS_PATH": "/your/documentation/path"
}
}
}
}🎯 用法
🧰 MCP工具可用
配置后,这些工具在Claude Code中可用:
🎬 trigger-auto-documentation
手动触发项目的文档生成。
// Example usage in Claude Code
{
"projectName": "my-project",
"action": "document", // or "update", "init", "agent-completion", "command-completion"
"workingDir": "/path/to/project"
}📈 get-documentation-status
获取文档系统的当前状态。
{
"projectName": "my-project" // optional - get status for specific project
}👀 setup-file-watching
启用或禁用自动文档的文件系统监视。
{
"workingDir": "/path/to/project",
"enable": true
}🎭 simulate-agent-completion
使用模拟代理完成测试自动文档。
{
"agentName": "test-agent",
"taskDescription": "Implemented new feature",
"workingDir": "/path/to/project"
}⚡ simulate-command-completion
使用模拟命令完成测试自动文档。
{
"command": "npm test",
"output": "All tests passed",
"workingDir": "/path/to/project"
}🎣 文档触发器
该系统可以通过以下方式生成文档:
- 📂 文件更改:修改受监视的文件时(如果启用了文件监视)
- 🎤 手动触发器:使用MCP工具生成文档
- 🧪 仿真工具:测试代理和命令完成场景
💻 使用MCP工具
在Claude Code中配置后,您可以使用可用的MCP工具:
trigger-auto-documentation:手动触发文档生成get-documentation-status:检查当前状态setup-file-watching:启用/禁用文件监视simulate-agent-completion:测试代理完成场景simulate-command-completion:测试命令完成场景
🏗️ 建筑
graph TD
A[Claude Code] --> B[Auto-Documenter MCP Server]
B --> C[Task Completion Detector]
B --> D[File System Watcher]
B --> E[Documentation Pipeline]
C --> F[Queue Manager]
D --> F
E --> F
F --> G[Project Context Extractor]
G --> H[Documentation Generator]
H --> I[Storage Manager]
I --> J[Project Documentation Files]
subgraph "Triggers"
K[Agent Completion]
L[Command Execution]
M[File Changes]
end
K --> C
L --> C
M --> D🔧 关键组件
- 🎯 MCP服务器(
src/index.js):主服务器处理Claude Code集成 - 🕵️ 任务完成检测器(
src/task_completion_detector.py):任务完成事件监视器 - 📝 文档管道(
src/documentation_pipeline.py):处理和生成文档 - 👁️ 文件系统监视器:实时监控项目文件
- ⚖️ 队列管理器:用于文件任务的强大排队系统
🧪 测试
🏃♂️ 运行测试
# Run JavaScript tests
npm test
# Run Python end-to-end tests
npm run test:e2e
# Run all tests
npm run test && npm run test:e2e🔗 集成测试
# Test with Claude Code
# 1. Start the MCP server
npm start
# 2. In Claude Code, use any of the MCP tools to test integration
# 3. Check documentation output in your configured path📊 演出
该系统旨在通过以下方式高效运行:
- 📁 文件监视:监视项目文件的更改
- ⚖️ 队列处理:异步任务处理
- 💾 存储:有组织的降价文档文件
- 🔄 实时更新:响应文件系统事件
🛡️ 安全
🔒 安全功能
- 🛡️ 路径消毒:所有文件路径都经过验证和清理
- 🔐 进程隔离:以有限权限执行子进程
- ✅ 输入验证:所有用户输入都经过验证和转义
- ⚠️ 错误处理:全面的错误处理可防止崩溃
- 📏 资源限制:内存和CPU使用限制可防止滥用
🎯 最佳实践
- 以所需的最小权限运行
- 使用专用用户帐户进行生产部署
- 监控资源使用情况并设置适当的限制
- 定期更新安全补丁的依赖关系
🤝 贡献
我们欢迎捐款!请看 贡献.md 了解详情。
🛠️ 开发设置
# Clone and setup
git clone https://github.com/Puneet8800/claude-auto-documenter-v2.git
cd claude-auto-documenter-v2
npm install
pip install -r requirements.txt
# Start development server
npm run dev
# Run tests
npm test📏 代码规范
- 🟢 脚本:ES2022+,带Node.js模块
- 🐍 python:PEP 8符合类型提示
- 📚 文档:JSDoc和文档字符串(如适用)
- 🧪 测试:包括基本测试范围
📄 许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
🙏 致谢
- 🎯 Anthropic:克劳德和模型上下文协议
- ⚡ Claude代码团队:卓越的发展环境
- 🌐 MCP社区:标准和最佳做法
- 👥 贡献者:参见 贡献者.md 查看完整列表
📞 支持
______________________________________________________________________
由以下材料制成❤️ 克劳德力学大师
*通过人工智能辅助的文档自动化赋予开发人员权力*
