DevDocs MCP 实现
用于文档管理和集成的模型上下文协议 (MCP) 实现。
项目结构
src/
├── resources/
│ ├── templates/ # Resource template system
│ └── managers/ # Resource management
├── documentation/
│ ├── processors/ # Documentation processing
│ └── integrators/ # Integration handlers
├── tasks/
│ ├── issues/ # Issue tracking
│ └── reviews/ # Review management
└── tests/
├── property/ # Property-based tests
└── integration/ # Integration tests
核心组件
资源模板系统
资源模板系统提供基于 URI 的文档资源访问:
- 通过 Pydantic 进行类型安全的参数处理
- 灵活的 URI 模板匹配
- 全面的错误处理
- 资源生命周期的状态管理
使用示例:
from src.resources.templates.base import ResourceTemplate
# Create a template with parameter typing
template = ResourceTemplate(
uri_template='docs://api/{version}/endpoint',
parameter_types={'version': str}
)
# Extract and validate parameters
params = template.extract_parameters('docs://api/v1/endpoint')
template.validate_parameters(params)
测试策略
该项目使用基于属性的假设测试来确保:
- URI 模板验证
- 参数提取正确性
- 错误处理稳健性
- 类型安全执行
运行测试:
pytest tests/property/test_templates.py
实施进度
完全的
- [x] 基本项目结构
- [x] 资源模板系统
- [x] 基于属性的测试基础设施
- [x] URI 验证和参数提取
- [x] 错误处理基础
进行中
- [ ] 文档处理器集成
- [ ] 缓存层实现
- [ ] 任务管理系统
- [ ] 性能优化
计划
- [ ] 搜索实现
- [ ] 分支映射系统
- [ ] 状态追踪
- [ ] 监控系统
开发指南
- 遵循 TDD 方法:
- 首先编写基于属性的测试
- 实现最少传递代码
- 重构以提高清晰度和效率
- 错误处理:
- 文档:
分支机构管理
该项目采用基于分支的开发方法:
贡献
- 创建功能分支
- 添加属性测试
- 实现功能
- 更新文档
- 提交拉取请求
后续步骤
- 实施文档处理器集成
- 添加具有适当生命周期管理的缓存层
- 开发任务管理系统
- 创建监控和性能指标
支持资源
- MCP 概念:
mcp-docs/docs/concepts/
- Python SDK:
python-sdk/src/mcp/
- 示例服务器:
python-sdk/examples/servers/