专家注册表MCP服务器
最后更新日期:2025-06-30
使用FastMCP v2构建的用于专家发现、注册和上下文注入的高性能MCP服务器,具有矢量和图形数据库集成功能,可增强语义搜索和关系建模。
特性
- 🚀 高性能:用于亚毫秒级查询的带矢量索引的多层缓存
- 📁 基于文件的更新:注册表/上下文文件更改时的热重新加载
- 🔍 语义搜索:基于意义的专家发现的矢量数据库集成
- 🔗 关系建模:用于专家网络和团队组建的图形数据库
- 💉 上下文注入:利用专家知识进行人工智能驱动的即时增强
- 📊 分析:通过协同过滤进行绩效跟踪
- 🧠 混合动力探索:结合向量相似性和图连通性评分
- 🐍 Python优先:使用FastMCP v2构建,用于干净的Python代码
安装
Docker(推荐用于生产环境)
运行Expert Registry MCP服务器最简单的方法是使用Docker:
# Build and deploy locally
./scripts/build.sh
./scripts/deploy.sh
# Or use pre-built image from GitHub Container Registry
docker pull ghcr.io/agentience/expert-registry-mcp:latest特征:
- 🐳 为多个MCP客户端提供单容器服务
- 📦 专家上下文和注册表映射到主机,便于编辑
- 🔄 主机上文件更改时的热重新加载支持
- 🌐 客户端连接的SSE传输
- 🗄️ 包括Neo4j数据库设置
- 🚀 生产准备就绪,进行健康检查
看 医生.md 获取完整的部署指南。
地方发展
使用紫外线(推荐):
# Create virtual environment and install
uv venv
uv pip install -e .
# Or install directly
uv pip install expert-registry-mcp使用pip:
pip install expert-registry-mcp数据库设置
矢量数据库(ChromaDB-嵌入式)
# ChromaDB is embedded, no separate installation needed
# It will create a vector-db directory automatically图形数据库(Neo4j)
# Option 1: Docker (recommended)
docker run -d --name neo4j \
-p 7474:7474 -p 7687:7687 \
-e NEO4J_AUTH=neo4j/password \
neo4j:latest
# Option 2: Local installation
# Download from https://neo4j.com/download/快速开始
- 设置您的专家系统目录结构:
expert-system/
├── registry/
│ └── expert-registry.json
├── expert-contexts/
│ ├── aws-amplify-gen2.md
│ ├── aws-cloudscape.md
│ └── ...
└── performance/
└── metrics.json- 配置环境:
export EXPERT_SYSTEM_PATH=/path/to/expert-system
export NEO4J_URI=bolt://localhost:7687
export NEO4J_PASSWORD=password- 运行服务器:
# Using FastMCP CLI
fastmcp run expert-registry-mcp
# Or using Python
python -m expert_registry_mcp.serverClaude桌面配置
添加到您的Claude Desktop配置中:
{
"mcpServers": {
"expert-registry": {
"command": "uv",
"args": ["run", "expert-registry-mcp"],
"env": {
"EXPERT_SYSTEM_PATH": "/path/to/expert-system",
"NEO4J_URI": "bolt://localhost:7687",
"NEO4J_PASSWORD": "password"
}
}
}
}使用示例
基础专家发现
# Detect technologies in your project
technologies = await expert_detect_technologies(
scan_paths=["./src", "./package.json"]
)
# Select the best expert with hybrid search
result = await expert_smart_discover(
context={
"description": "Refactor authentication system using AWS Amplify",
"technologies": technologies.technologies,
"constraints": ["maintain backward compatibility"],
"preferred_strategy": "single"
}
)上下文注入
# Load expert context
context = await expert_load_context(
expert_id=result.expert.id
)
# Inject into prompt
enhanced_prompt = await expert_inject_context(
prompt="Refactor the authentication system",
expert_id=result.expert.id,
injection_points=["constraints", "patterns", "quality-criteria"]
)性能跟踪
# Track usage
await expert_track_usage(
expert_id=result.expert.id,
task_id="auth-refactor-001",
outcome={
"success": True,
"adherence_score": 9.5,
"task_type": "refactoring"
}
)
# Get analytics
analytics = await expert_get_analytics(
expert_id=result.expert.id
)可用工具
注册表管理
expert_registry_list-使用筛选功能列出专家expert_registry_get-获取专家详细信息expert_registry_search-按查询搜索专家
专家选拔
expert_detect_technologies-检测项目技术expert_select_optimal-为任务选择最佳专家expert_assess_capability-评估专家能力expert_smart_discover-人工智能驱动的混合搜索(矢量+图形)
语义搜索
expert_semantic_search-使用自然语言搜索expert_find_similar-寻找类似的专家
图的运算
expert_explore_network-探索专家关系expert_find_combinations-寻找互补的专家团队
上下文操作
expert_load_context-负载专家知识expert_inject_context-用专业知识增强提示
分析
expert_track_usage-记录专家表现expert_get_analytics-获取性能指标
专家注册表格式
{
"version": "1.0.0",
"last_updated": "2025-06-30T00:00:00Z",
"experts": [
{
"id": "aws-amplify-gen2",
"name": "AWS Amplify Gen 2 Expert",
"version": "1.0.0",
"description": "Expert in AWS Amplify Gen 2 development",
"domains": ["backend", "cloud", "serverless"],
"specializations": [
{
"technology": "AWS Amplify Gen 2",
"frameworks": ["AWS CDK", "TypeScript"],
"expertise_level": "expert"
}
],
"workflow_compatibility": {
"feature": 0.95,
"bug-fix": 0.85,
"refactoring": 0.80,
"investigation": 0.70,
"article": 0.60
},
"constraints": [
"Use TypeScript-first approach",
"Follow AWS Well-Architected Framework"
],
"patterns": [
"Infrastructure as Code",
"Serverless-first architecture"
],
"quality_standards": [
"100% type safety",
"Comprehensive error handling"
]
}
]
}专家上下文格式
专家上下文文件是 expert-contexts/:
# AWS Amplify Gen 2 Expert Context
## Constraints
- Use TypeScript for all backend code
- Follow AWS Well-Architected Framework principles
- Implement proper error handling and logging
## Patterns
- Infrastructure as Code using CDK
- Serverless-first architecture
- Event-driven communication
## Quality Standards
- 100% TypeScript type coverage
- Comprehensive error handling
- Unit test coverage > 80%发展
设置开发环境
# Clone repository
git clone https://github.com/agentience/expert-registry-mcp
cd expert-registry-mcp
# Create virtual environment with uv
uv venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
# Install in development mode
uv pip install -e ".[dev]"运行测试
# Run all tests
pytest
# Run with coverage
pytest --cov=expert_registry_mcp
# Run specific test file
pytest tests/test_registry.py代码质量
# Format code
black src tests
# Lint code
ruff check src tests
# Type checking
mypy src建筑
多层缓存
- 注册表缓存:专家定义的24小时TTL
- 向量缓存:缓存嵌入内容,直到专家更新
- 图形缓存:关系查询缓存10分钟
- 选择缓存:5分钟TTL用于技术检测
- 上下文缓存:专家上下文的LRU缓存(50个条目)
数据库集成
- ChromaDB:用于语义搜索的嵌入式矢量数据库
- 针对不同嵌入类型的多个集合 - 使用句子变换器自动生成嵌入
- Neo4j:用于关系建模的图形数据库
- 专家技术任务关系 - 团队协同计算 - 进化跟踪
性能特点
- 向量索引:用于超快速相似性搜索的烦人索引
- 预计算组合:缓存了常见的专家对
- 批量操作:高效的批量处理
- 智能失效:目标缓存更新
文件监视
- 用途
watchdog用于跨平台文件监控 - 自动注册表重新加载和数据库同步
- 更新不需要重新启动服务器
故障排除
常见问题
- 未找到专家
- 验证注册表中的专家ID - 检查文件路径是否正确 - 确保注册表JSON有效
- 上下文文件丢失
- 检查专家上下文目录 - 验证文件名是否与专家ID匹配 - 确保.md扩展名
- 缓存未更新
- 文件监视器可能需要重新启动 - 检查文件权限 - 验证EXPERT_SYSTEM_PATH
调试模式
启用调试日志记录:
export FASTMCP_DEBUG=1
expert-registry-mcp高级功能
语义搜索
系统使用ChromaDB启用自然语言查询:
# Find experts by meaning, not just keywords
results = await expert_semantic_search(
query="implement secure authentication with cloud integration",
search_mode="hybrid"
)关系探索
Neo4j支持复杂的关系查询:
# Explore expert networks
network = await expert_explore_network(
start_expert_id="aws-amplify-gen2",
depth=2,
relationship_types=["SPECIALIZES_IN", "COMPATIBLE_WITH"]
)团队组建
AI驱动的团队组成:
# Find complementary expert teams
teams = await expert_find_combinations(
requirements=["AWS Amplify", "React", "DynamoDB"],
team_size=3
)贡献
- 分叉存储库
- 创建功能分支(
git checkout -b feature/amazing-feature) - 运行测试和梳理
- 提交您的更改(
git commit -m 'Add amazing feature') - 推到分支(
git push origin feature/amazing-feature) - 打开拉取请求
许可证
MIT许可证-有关详细信息,请参阅许可证文件
支持
- 文档:https://github.com/agentience/expert-registry-mcp
- 问题:https://github.com/agentience/expert-registry-mcp/issues
- 讨论:https://github.com/agentience/expert-registry-mcp/discussions
