基因组资源联盟MCP服务器
🧬 基因组资源组织联盟MCP服务器实现
一个全面的模型上下文协议(MCP)服务器,提供对基因组资源联盟基因组数据、生物信息学工具和比较基因组学研究能力的编程访问。
📁 项目结构
agr-mcp-server/
├── 🚀 src/ # Core source code
│ ├── agr_server_enhanced.py # Enhanced MCP server (30+ tools)
│ ├── agr_server_basic.py # Basic MCP server (10 tools)
│ └── utils.py # Utilities and configuration
│
├── 📚 examples/ # Usage examples and tutorials
│ ├── basic_examples.py # Basic usage patterns
│ └── advanced_examples.py # Advanced genomics workflows
│
├── 🧪 tests/ # Test suite
│ └── test_agr_server.py # Comprehensive tests
│
├── ⚙️ config/ # Configuration files
│ ├── development.yaml # Development environment
│ ├── staging.yaml # Staging environment
│ ├── production.yaml # Production environment
│ └── mcp_client_config.json # MCP client configuration
│
├── 🛠️ scripts/ # Utility scripts
│ ├── agr_cli.py # Command line interface
│ ├── health_check.py # System health checker
│ ├── quick_start_demo.py # Interactive demonstration
│ └── deploy.sh # Deployment automation
│
├── 🐳 docker/ # Docker and deployment files
│ ├── Dockerfile # Container configuration
│ └── docker-compose.yml # Multi-service deployment
│
├── 📄 Documentation & Setup
│ ├── README.md # Comprehensive documentation
│ ├── PROJECT_OVERVIEW.md # Project summary
│ ├── requirements.txt # Production dependencies
│ ├── requirements-dev.txt # Development dependencies
│ ├── setup.py # Package configuration
│ ├── Makefile # Development automation
│ ├── .env.example # Environment template
│ ├── .gitignore # Git ignore patterns
│ └── LICENSE # MIT License
│
└── 🔧 .github/ # CI/CD and automation
└── workflows/
└── ci.yml # GitHub Actions pipeline🚀 快速开始
导航到项目
cd /Users/nuin/Projects/alliance/agr-mcp-server基本设置
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run interactive demo
python scripts/quick_start_demo.py尝试增强型服务器
# Start enhanced server (30+ tools)
python src/agr_server_enhanced.py
# Or use the CLI
python scripts/agr_cli.py search BRCA1
python scripts/agr_cli.py gene-info HGNC:1100健康检查
python scripts/health_check.py使用Makefile进行开发
# Show all available commands
make help
# Complete development setup
make dev-setup
# Run tests
make test
# Run examples
make examples
# Deploy to development
make deploy-dev⭐ 主要特点
🔬 核心基因组学功能(30+工具)
- 基因搜索与发现 跨越8+模式生物
- 跨物种矫形学 比较分析
- 疾病关联 和临床相关性数据
- 表情分析 具有可视化就绪数据
- 分子与遗传相互作用
- 等位基因和变异信息
- 功能注释 (GO术语,途径)
- 文献检索 与Textpresso集成
- BLAST序列分析
- JBrowse基因组浏览器 整合
🌍 支持的模式生物
- 智人 (人类)-HGNC标识符
- 家鼠 (鼠标)-MGI标识符
- 褐家鼠 (大鼠)-RGD标识符
- 斑马鱼 (斑马鱼)-ZFIN标识符
- 黑腹果蝇 (果蝇)-FlyBase标识符
- 秀丽隐杆线虫 (蛔虫)-WormBase标识符
- 酿酒酵母 (面包酵母)-SGD标识符
- 非洲爪蟾 (青蛙种类)-Xenbase标识符
🔧 高性能
- 联盟矿山 数据挖掘和复杂查询
- 表情带 用于可视化
- 转基因模型 并构建数据
- 实验条件 和治疗
- 通路分析 生物网络
- 文献挖掘 引文管理
💻 使用示例
命令行接口
# Search for genes
python scripts/agr_cli.py search BRCA1 --limit 10
# Get comprehensive gene information
python scripts/agr_cli.py gene-info HGNC:1100
# Find orthologs across species
python scripts/agr_cli.py orthologs HGNC:1100
# Get disease associations
python scripts/agr_cli.py diseases HGNC:1100
# Search literature
python scripts/agr_cli.py literature "BRCA1 mutations"
# BLAST sequence search
python scripts/agr_cli.py blast ATCGATCGATCG --program blastnPython API用法
from src.agr_server_enhanced import EnhancedAGRClient
client = EnhancedAGRClient()
# Search for genes
results = await client.search_genes("BRCA1")
# Get gene information
gene_info = await client.get_gene_info("HGNC:1100")
# Find orthologs
orthologs = await client.find_orthologs("HGNC:1100")🧪 测试与质量
# Run comprehensive tests
python -m pytest tests/test_agr_server.py -v
# Check code quality
make lint
# Run security scan
make security
# Performance test
make test-cov🐳 Docker部署
# Build and run with Docker
cd docker/
docker build -t agr-mcp-server .
docker run -p 8000:8000 agr-mcp-server
# Or use docker-compose
docker-compose up -d📊 监测与健康
# System health check
python scripts/health_check.py
# Monitor logs (if running with Docker)
docker logs agr-mcp-server
# Check system status
make health-check⚙️ 配置
环境变量
# Copy and edit environment template
cp .env.example .env
# Key settings
AGR_BASE_URL=https://www.alliancegenome.org/api
AGR_TIMEOUT=30
LOG_LEVEL=INFO环境特定配置
- 发展:
config/development.yaml - 暂存:
config/staging.yaml - 生产:
config/production.yaml
🤖 克劳德集成
Claude代码集成
通过更新配置文件将AGR MCP服务器添加到Claude Code中:
配置位置:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json - 视窗:
%APPDATA%\Claude\claude_desktop_config.json
配置:
{
"mcpServers": {
"agr-genomics-enhanced": {
"command": "python3",
"args": ["/Users/nuin/Projects/alliance/agr-mcp-server/src/agr_server_enhanced.py"],
"cwd": "/Users/nuin/Projects/alliance/agr-mcp-server",
"env": {
"VIRTUAL_ENV": "/Users/nuin/Projects/alliance/agr-mcp-server/venv"
}
}
}
}Claude代码的使用示例:
# Natural language queries Claude can now handle:
"Search for BRCA1 genes across all species"
"Find disease associations for TP53"
"Get orthology information for HGNC:1100"
"BLAST this DNA sequence: ATCGATCGATCG"
"Show me expression data for the CFTR gene"Claude桌面集成
使用与上述Claude Code相同的配置。更新配置文件后,重新启动Claude Desktop以加载MCP服务器。
可用工具: 30多种基因组学工具,包括基因搜索、疾病关联、正构分析、BLAST搜索和8种模式生物的表达数据。
🌐 联盟整合
此MCP服务器与整个联盟生态系统集成:
- 主门户: https://www.alliancegenome.org/
- API文档: https://www.alliancegenome.org/swagger-ui/
- JBrowse基因组浏览器: https://jbrowse.alliancegenome.org/
- AllianceMine数据挖掘: https://www.alliancegenome.org/alliancemine/
- BLAST序列搜索: https://blast.alliancegenome.org/
🎯 用例
研究应用
- 比较基因组学:跨物种基因功能分析
- 疾病研究:基因疾病关联研究
- 药物发现:目标识别和验证
- 系统生物学:路径和网络分析
AI/ML集成
- 培训数据:大规模基因组学数据集
- 特征工程:基因注释和功能数据
- 知识图谱:结构化生物学知识
- 预测模型:基因功能和疾病预测
📞 支持和资源
- 项目地点:
/Users/nuin/Projects/alliance/agr-mcp-server/ - 文档:参见
README.md获取全面指南 - 例子:检查
examples/使用模式目录 - CLI帮助:运行
python scripts/agr_cli.py --help - 健康检查:运行
python scripts/health_check.py - AGR支持:联系方式help@alliancegenome.org
🏗️ 发展
入门指南
# Clone/navigate to project
cd /Users/nuin/Projects/alliance/agr-mcp-server
# Setup development environment
make dev-setup
# Run examples
make examples
# Start development server
make server-enhanced开发命令
make help # Show all available commands
make test # Run tests
make lint # Code quality checks
make format # Format code
make docs # Build documentation
make clean # Clean build artifacts📈 生产特点
- 高性能异步/等待架构,连接池
- 可靠性:全面的错误处理、健康监测
- 安全:输入验证、速率限制、安全扫描
- 可扩展性:多实例部署,负载均衡
- 监控:健康检查、日志记录、指标
🎉 状态:准备使用!
✅ 全面实施和组织
- 配备30多种基因组学工具的完整MCP服务器
- 可维护性组织项目结构
- 生产就绪部署选项
- 全面的测试和质量保证
- 完整的文档和示例
- 多环境配置
- CI/CD流水线和自动化
可立即用于基因组学研究、AI/ML应用和临床生物信息学工作流程! 🧬
