环肽MCP
用于环肽计算分析和虚拟筛选的综合MCP工具
目录
概述
该MCP服务器为环肽计算分析提供了全面的工具,包括结构预测、性质计算、序列分析和数据预处理。它基于环肽库构建,通过快速同步操作和后台批处理实现药物发现工作流程。
特性
- 序列结构相互转换 -在氨基酸序列和SMILES表示之间进行转换
- 分子性质计算 -计算57+分子描述符、指纹和药物相似性规则
- 结构分析 -生成具有分子属性和可视化的全面HTML报告
- 数据预处理 -清洁、验证和标准化环肽数据集
- 批处理 -处理大规模虚拟筛选和图书馆枚举
- 作业管理 -通过状态监控跟踪长时间运行的计算
目录结构
./
├── README.md # This file
├── env/ # Conda environment
├── src/
│ └── server.py # MCP server with 13 tools
├── scripts/
│ ├── sequence_to_structure.py # Sequence to SMILES conversion
│ ├── structure_to_sequence.py # SMILES to sequence conversion
│ ├── calculate_properties.py # Molecular property calculation
│ ├── preprocess_data.py # Data preprocessing and standardization
│ ├── analyze_structure.py # Comprehensive structure analysis
│ └── lib/ # Shared utilities
├── examples/
│ └── data/ # Demo data
│ ├── sequences.txt # Sample cyclic peptide sequences (APG, GFPVFP, etc.)
│ ├── smiles.txt # Sample SMILES structures
│ ├── monomer.tsv # 546 monomer database
│ └── models/ # Pre-trained models for graph alignment
├── configs/ # Configuration files
│ ├── sequence_to_structure_config.json
│ ├── calculate_properties_config.json
│ └── preprocess_data_config.json
└── repo/ # Original repository______________________________________________________________________
安装
快速设置
运行自动安装脚本:
./quick_setup.sh这将创建环境并自动安装所有依赖项。
手动设置(高级)
对于手动安装或自定义,请执行以下步骤。
先决条件
- Conda或Mamba(建议使用曼巴以加快安装速度)
- Python 3.10+
- RDKit(自动安装)
创建环境
按照以下程序 reports/step3_environment.md:
# Navigate to the MCP directory
cd /home/xux/Desktop/CycPepMCP/CycPepMCP/tool-mcps/cyclicpeptide_mcp
# Create conda environment (use mamba if available)
mamba create -p ./env python=3.12 -y
# or: conda create -p ./env python=3.12 -y
# Activate environment
mamba activate ./env
# or: conda activate ./env
# Install Dependencies
mamba install -c conda-forge rdkit=2025.09.3 matplotlib=3.10.8 networkx=3.6.1 pandas=2.3.3 numpy=2.4.0 scipy=1.16.3 loguru=0.7.3 click=8.3.1 tqdm=4.67.1 -y
# Install Python packages
pip install fastmcp==2.14.1 ipython==9.8.0 --force-reinstall
# Install cyclicpeptide package (manual installation)
cp -r repo/cyclicpeptide/cyclicpeptide env/lib/python3.12/site-packages/
cp -r repo/cyclicpeptide/states env/lib/python3.12/site-packages/cyclicpeptide/______________________________________________________________________
本地使用(脚本)
您可以在没有MCP的情况下直接使用脚本进行本地处理。
可用脚本
| 脚本 | 描述 | 示例 |
|---|---|---|
scripts/sequence_to_structure.py | 将氨基酸序列转换为环肽SMILES | 见下文 |
scripts/structure_to_sequence.py | 将SMILES结构转换回氨基酸序列 | 见下文 |
scripts/calculate_properties.py | 计算综合分子性质 | 见下文 |
scripts/preprocess_data.py | 预处理和标准化肽数据集 | 见下文 |
scripts/analyze_structure.py | 生成全面的HTML分析报告 | 见下文 |
脚本示例
将序列转换为结构
# Activate environment
mamba activate ./env
# Convert single sequence to SMILES
python scripts/sequence_to_structure.py \
--sequence "GRGDSP" \
--output results/grgdsp.smi \
--visualize
# Batch conversion from file
python scripts/sequence_to_structure.py \
--input examples/data/sequences.txt \
--output results/structures.smi参数:
--sequence, -s:氨基酸序列(1个字母代码)(单个需要)--input, -i:具有多个序列的输入文件(用于批处理)--output, -o:输出文件路径(默认值:results/)--visualize, -v:生成SVG结构可视化--linear:创建线性肽而不是环状肽
计算属性
python scripts/calculate_properties.py \
--smiles "C[C@@H]1NC(=O)CNC(=O)[C@@H]2CCCN2C1=O" \
--format csv \
--output properties.csv \
--include-fingerprints参数:
--smiles, -s:SMILES字符串(单曲需要)--input, -i:具有多个SMILES的输入文件(用于批处理)--format, -f:输出格式(json/csv/txt)--include-fingerprints:包括分子指纹--output, -o:输出文件路径
预处理数据
python scripts/preprocess_data.py \
--input examples/data/example_peptides.csv \
--output cleaned_data.csv \
--min-quality-score 60 \
--remove-duplicates______________________________________________________________________
MCP服务器安装
选项1:使用fastmcp(推荐)
# Install MCP server for Claude Code
fastmcp install src/server.py --name cycpep-tools选项2:Claude代码的手动安装
# Add MCP server to Claude Code
claude mcp add cycpep-tools -- $(pwd)/env/bin/python $(pwd)/src/server.py
# Verify installation
claude mcp list选项3:在settings.json中配置
增添 ~/.claude/settings.json:
{
"mcpServers": {
"cycpep-tools": {
"command": "/home/xux/Desktop/CycPepMCP/CycPepMCP/tool-mcps/cyclicpeptide_mcp/env/bin/python",
"args": ["/home/xux/Desktop/CycPepMCP/CycPepMCP/tool-mcps/cyclicpeptide_mcp/src/server.py"]
}
}
}______________________________________________________________________
使用Claude代码
安装MCP服务器后,您可以直接在Claude Code中使用它。
快速开始
# Start Claude Code
claude示例提示
工具发现
What tools are available from cycpep-tools?属性计算(快速)
Calculate molecular properties for this cyclic peptide: C[C@@H]1NC(=O)CNC(=O)[C@@H]2CCCN2C1=O序列转换
Convert the peptide sequence GRGDSP to a cyclic peptide SMILES structure结构分析(提交API)
Submit a comprehensive structure analysis job for the cyclic peptide with SMILES: C[C@@H]1NC(=O)CNC(=O)[C@@H]2CCCN2C1=O检查作业状态
Check the status of job abc12345批处理
Calculate properties for these cyclic peptides in batch using the file @examples/data/smiles.txt使用@引用
在克劳德代码中,使用 @ 引用文件和目录:
| 参考 | 说明 |
|---|---|
@examples/data/sequences.txt | 参考样品肽序列 |
@examples/data/smiles.txt | 参考样本SMILES结构 |
@configs/calculate_properties_config.json | 参考属性计算配置 |
@results/ | 参考输出目录 |
______________________________________________________________________
与Gemini CLI一起使用
配置
增添 ~/.gemini/settings.json:
{
"mcpServers": {
"cycpep-tools": {
"command": "/home/xux/Desktop/CycPepMCP/CycPepMCP/tool-mcps/cyclicpeptide_mcp/env/bin/python",
"args": ["/home/xux/Desktop/CycPepMCP/CycPepMCP/tool-mcps/cyclicpeptide_mcp/src/server.py"]
}
}
}示例提示
# Start Gemini CLI
gemini
# Example prompts (same as Claude Code)
> What tools are available?
> Calculate properties for cyclic peptide C[C@@H]1NC(=O)CNC(=O)[C@@H]2CCCN2C1=O______________________________________________________________________
可用工具
快速操作(同步API)
这些工具会立即返回结果(\10分钟):
| 工具 | 说明 | 参数 |
|---|---|---|
submit_comprehensive_structure_analysis | 生成详细的HTML分析报告 | smiles, include_visualization |
submit_batch_property_calculation | 计算大型数据集的属性 | input_file, properties, include_fingerprints |
submit_batch_sequence_conversion | 将多个序列转换为结构 | input_file, cyclic, visualize |
submit_batch_data_preprocessing | 通过质量评估处理大型数据集 | input_file, min_quality_score, standardize_format |
作业管理工具
| 工具 | 说明 |
|---|---|
get_job_status | 检查作业进度和状态 |
get_job_result | 作业完成后获取结果 |
get_job_log | 使用tail选项查看执行日志 |
cancel_job | 取消正在运行的作业 |
list_jobs | 列出所有具有可选状态筛选器的作业 |
______________________________________________________________________
例子
示例1:快速属性计算
目标: 计算环肽的类药物性质
使用脚本:
python scripts/calculate_properties.py \
--smiles "C[C@@H]1NC(=O)CNC(=O)[C@@H]2CCCN2C1=O" \
--format json \
--output apg_properties.json使用MCP(克劳德代码):
Calculate molecular properties for the cyclic peptide C[C@@H]1NC(=O)CNC(=O)[C@@H]2CCCN2C1=O including molecular weight, logP, and TPSA预期产量:
- 分子量:~225 Da
- LogP:~-1.5(亲水性)
- TPSA:~87°
- 药物相似性规则(Lipinski,Veber)
- 分子指纹图谱(Morgan、RDKit、MACCS)
示例2:序列到结构的转换
目标: 将氨基酸序列转化为环肽SMILES
使用脚本:
python scripts/sequence_to_structure.py \
--sequence "GRGDSP" \
--visualize \
--output grgdsp_structure.smi使用MCP(克劳德代码):
Convert the peptide sequence GRGDSP to a cyclic peptide SMILES structure with visualization预期产量:
- SMILES:生成的环肽结构
- SVG可视化
- 质量评估得分
- 分子元数据
示例3:虚拟筛选流程
目标: 筛选环肽库以寻找药物相似性
使用MCP(克劳德代码):
I want to screen cyclic peptides for oral bioavailability using the file @examples/data/smiles.txt
Calculate properties for all structures and identify which ones have:
- Molecular weight ', tail=0))"问题: 任务失败
Use get_job_log tool with job_id and tail=100 to see detailed error information问题: 属性计算警告
RDKit deprecation warnings are expected and do not affect functionality.
Results are still accurate despite fingerprint calculation warnings.性能问题
问题: 性能计算缓慢
# Skip fingerprints for faster processing
python scripts/calculate_properties.py --smiles "SMILES" --no-fingerprints问题: 大文件的内存问题
# Process in smaller batches
split -l 100 large_file.txt batch_
for file in batch_*; do python scripts/calculate_properties.py --input $file; done______________________________________________________________________
发展
运行测试
# Activate environment
mamba activate ./env
# Test scripts individually
python scripts/sequence_to_structure.py --sequence APG --output test_output/
python scripts/calculate_properties.py --smiles "C[C@@H]1NC(=O)CNC(=O)[C@@H]2CCCN2C1=O" --format json
# Test MCP server
./env/bin/python src/server.py &正在启动开发服务器
# Run MCP server in dev mode
fastmcp dev src/server.py验证命令
# Test core functionality
./env/bin/python -c "from cyclicpeptide import PropertyAnalysis, Sequence2Structure, Structure2Sequence; print('All modules imported successfully')"
# Test RDKit
./env/bin/python -c "import rdkit; from rdkit import Chem; print('RDKit working')"
# Test basic functionality
./env/bin/python -c "from cyclicpeptide import Sequence2Structure; smiles, peptide = Sequence2Structure.seq2stru_essentialAA(sequence='APG', cyclic=True); print('SMILES:', smiles)"______________________________________________________________________
许可证
基于 环肽 仓库
积分
- 原始存储库: dfwlab/环肽
- MCP框架:FastMCP 2.0+
- 化学计算:RDKit 2025.09.3
- 集成测试:具有全面验证的Claude Code
