蛋白质溶胶MCP
通过模型上下文协议进行全面的蛋白质溶解度预测和序列分析
目录
概述
蛋白质溶胶MCP服务器基于曼彻斯特大学蛋白质溶胶管道提供全面的蛋白质溶解度预测和序列分析功能。它实现了Hebditch等人(2017)《生物信息学》33:3098-3100的研究,通过模型上下文协议提供了快速分析工具和可扩展的批处理。
特性
- 蛋白质溶解度预测 使用Hebditch等人(2017)算法从氨基酸序列中提取
- 灵活的输入支持:序列字符串、FASTA文件或CSV文件
- 自动输出生成:CSV结果、详细预测、成分分析
目录结构
./
├── README.md # This file
├── env/ # Conda environment (Python 3.10.19)
├── src/
│ ├── server.py # MCP server entry point
│ └── tools/ # Tool implementations
├── scripts/
│ ├── protein_sol_predict.py # Core prediction script
│ └── lib/ # Shared utilities
├── examples/
│ └── data/ # Demo FASTA files and results
└── repo/ # Original protein-sol Perl pipeline______________________________________________________________________
安装
快速设置(推荐)
运行自动安装脚本:
cd protein_sol_mcp
bash quick_setup.sh该脚本将创建conda环境,安装所有依赖项,并显示Claude Code配置。看 quick_setup.sh --help 对于以下选项 --skip-env.
先决条件
- Conda或Mamba(建议使用曼巴以加快安装速度)
- Python 3.10+
- Perl 5.x(系统提供,用于底层计算)
手动安装(替代)
如果您更喜欢手动安装或需要自定义设置,请按照以下步骤操作 reports/step3_environment.md:
# Navigate to the MCP directory
cd /home/xux/Desktop/ProteinMCP/ProteinMCP/tool-mcps/protein_sol_mcp
# Create conda environment with Python 3.10 and pandas
mamba create -p ./env python=3.10 pandas -y
# or: conda create -p ./env python=3.10 pandas -y
# Activate environment
mamba activate ./env
# or: conda activate ./env
# Install MCP dependencies
pip install fastmcp loguru
# Verify Perl is available
perl --version验证命令:
# Test Python environment
mamba run -p ./env python --version # Should show 3.10.19
# Test core imports
mamba run -p ./env python -c "import pandas, fastmcp; print('✅ Environment ready')"
# Test Perl pipeline
perl repo/protein-sol/server_prediction_seq_export.pl______________________________________________________________________
本地用法(脚本)
您可以直接使用预测脚本,而无需MCP进行本地处理。
蛋白质溶解度预测
# Activate environment
mamba activate ./env
# Run prediction on a FASTA file
python scripts/protein_sol_predict.py examples/data/example.fasta预期输出文件:
{input}-protein_sol.csv-主要预测结果{input}-protein_sol_prediction.txt-35个特征的详细预测{input}-protein_sol_composition.txt-氨基酸组成分析{input}-protein_sol.log-处理日志
______________________________________________________________________
MCP服务器安装
选项1:使用fastmcp(推荐)
# Install MCP server for Claude Code
fastmcp install src/server.py --name protein_sol_mcp选项2:Claude代码的手动安装
# Add MCP server to Claude Code
claude mcp add protein_sol_mcp -- $(pwd)/env/bin/python $(pwd)/src/server.py
# Verify installation
claude mcp list
# Should show: protein_sol_mcp: /path/to/env/bin/python /path/to/src/server.py - ✓ Connected选项3:在settings.json中配置
增添 ~/.claude/settings.json:
{
"mcpServers": {
"protein_sol_mcp": {
"command": "/home/xux/Desktop/ProteinMCP/ProteinMCP/tool-mcps/protein_sol_mcp/env/bin/python",
"args": ["/home/xux/Desktop/ProteinMCP/ProteinMCP/tool-mcps/protein_sol_mcp/src/server.py"]
}
}
}______________________________________________________________________
使用Claude代码
安装MCP服务器后,您可以直接在Claude Code中使用它。
快速开始
# Start Claude Code
claude示例提示
工具发现
What tools are available from protein_sol_mcp?使用序列字符串
Use protein_sol_solubility_predict with sequence "MKLLLLLLLLLLLLLLLLLLLLLLLLLLLL" and sequence_id "test_protein"使用FASTA文件
Use protein_sol_solubility_predict with fasta_file @examples/data/example.fasta使用CSV文件
Use protein_sol_solubility_predict with csv_file @data/proteins.csv and sequence_column "protein_seq"使用@引用
在克劳德代码中,使用 @ 引用文件和目录:
| 参考 | 说明 |
|---|---|
@examples/data/example.fasta | 参考特定的FASTA文件 |
@examples/data/small_test.fasta | 参考演示测试文件 |
______________________________________________________________________
与Gemini CLI一起使用
配置
增添 ~/.gemini/settings.json:
{
"mcpServers": {
"protein_sol_mcp": {
"command": "/home/xux/Desktop/ProteinMCP/ProteinMCP/tool-mcps/protein_sol_mcp/env/bin/python",
"args": ["/home/xux/Desktop/ProteinMCP/ProteinMCP/tool-mcps/protein_sol_mcp/src/server.py"]
}
}
}示例提示
# Start Gemini CLI
gemini
# Example prompts (same as Claude Code)
> What tools are available from protein_sol_mcp?
> Use protein_sol_solubility_predict with fasta_file examples/data/example.fasta______________________________________________________________________
可用工具
蛋白质可溶性指令
使用Hebditch等人(2017)的算法运行完整的自动化蛋白质溶解度预测管道。
参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
sequence | string | 三个中的一个 | 蛋白质序列串(氨基酸) |
fasta_file | string | 三个中的一个 | 输入FASTA文件的路径 |
csv_file | string | 三个中的一个 | 包含序列的CSV文件的路径 |
sequence_column | string | 否 | CSV中序列的列名(默认值:“sequence”) |
id_column | string | 否 | CSV中序列ID的列名 |
sequence_id | string | 否 | 使用时序列的ID sequence 参数(默认值:“蛋白质”) |
quiet | bool | 否 | 抑制详细控制台输出(默认值:False) |
输入选项 (互斥——只提供一个):
sequence:直接蛋白质序列串fasta_file:FASTA文件的路径csv_file:CSV文件的路径(将创建带有预测的增强输出)
退货:
| 字段 | 描述 |
|---|---|
success | 布尔值,指示预测是否成功 |
predictions | 带有ID、序列、percent_sol、scaled_sol、population \_sol、pI的预测结果列表 |
output_files | 生成的文件路径字典(csv、预测、组合、日志) |
error | 如果预测失败,则显示错误消息 |
______________________________________________________________________
例子
示例1:从序列字符串预测
目标: 从蛋白质序列预测溶解度
使用MCP(克劳德代码):
Use protein_sol_solubility_predict with sequence "MKLLLLLLLLLLLLLLLLLLLLLLLLLLLL" and sequence_id "test_protein"预期产量:
- 溶解度预测:百分比溶胶、标度溶胶、粒子数溶胶、等电点
- 输出文件:CSV结果、预测细节、成分分析
示例2:根据FASTA文件进行预测
目标: 预测FASTA文件中所有序列的溶解度
使用MCP(克劳德代码):
Use protein_sol_solubility_predict with fasta_file @examples/data/example.fasta预期产量:
- FASTA文件中每个序列的预测
- 输出文件与输入文件一起保存
示例3:使用序列处理CSV
目标: 将溶解度预测添加到现有CSV文件中
使用MCP(克劳德代码):
Use protein_sol_solubility_predict with csv_file @data/proteins.csv and sequence_column "protein_seq" and id_column "protein_id"预期产量:
- 原始CSV增加了预测列
- 输出另存为
{input}_protein_sol.csv
______________________________________________________________________
演示数据
这 examples/data/ 目录包含用于测试的示例数据:
| 文件 | 描述 | 使用 | 内容 |
|---|---|---|---|
example.fasta | 2种蛋白质的原始演示 | 所有预测工具 | P00547,LYSC_HUMAN序列 |
small_test.fasta | 2种短蛋白快速检测 | 快速检测 | 检测蛋白_1,检测蛋白_2 |
example.fasta-protein_sol.csv | CSV输出示例 | 了解输出格式 | 预测结果格式 |
example.fasta-protein_sol_prediction.txt | 详细预测示例 | 了解详细输出 | 35个特征、配置文件 |
seq_reference_data.txt | 参考溶解度数据 | 管道验证 | 实验数据 |
ss_propensities.txt | 二级结构数据 | 管道依赖关系 | 结构倾向 |
______________________________________________________________________
故障排除
环境问题
问题: 未找到环境
# Recreate environment
mamba create -p ./env python=3.10 pandas -y
mamba activate ./env
pip install fastmcp loguru问题: 导入错误
# Verify installation
python -c "import pandas, fastmcp; print('✅ All imports working')"
# Test server import
python -c "from src.server import mcp; print('✅ MCP server imports working')"问题: 权限错误
# Fix environment permissions
chmod -R u+rwx ./env
# Use mamba run as alternative
mamba run -p ./env python scripts/predict_solubility.py --helpMCP问题
问题: 在Claude代码中找不到服务器
# Check MCP registration
claude mcp list
# Re-add if needed
claude mcp remove protein_sol_mcp
claude mcp add protein_sol_mcp -- $(pwd)/env/bin/python $(pwd)/src/server.py问题: 工具不工作
# Test server directly
python -c "
from src.server import mcp
print(f'MCP Name: {mcp.name}')
"问题: 连接问题
# Check if server starts correctly
./env/bin/python src/server.py
# Test with FastMCP dev mode
fastmcp dev src/server.py管道问题
问题: Perl管道错误
# Test Perl availability
perl --version
# Test Perl pipeline directly
cd repo/protein-sol
perl server_prediction_seq_export.pl
# Check required data files
ls -la ss_propensities.txt seq_reference_data.txt问题: 缺少输出文件
# Check working directory
pwd # Should be in protein_sol_mcp root
# Verify input file exists
ls -la examples/data/example.fasta
# Test with absolute paths
python scripts/predict_solubility.py --input $(pwd)/examples/data/example.fasta______________________________________________________________________
发展
运行测试
# Activate environment
mamba activate ./env
# Run direct tool tests
python tests/test_tools_direct.py
# Run end-to-end scenarios
python tests/test_e2e_scenarios.py
# Run MCP integration tests
python tests/test_mcp_integration.py正在启动开发服务器
# Run MCP server in dev mode
fastmcp dev src/server.py
# Test server health
curl -X POST http://localhost:3000 -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'______________________________________________________________________
依赖关系摘要
| 组件 | Perl管道 | 外部文件 | 网络 |
|---|---|---|---|
protein_sol_solubility_predict | 是 | 是 | 否 |
备注:该工具需要Perl管道 scripts/protein-sol/ 包含数据文件的目录(ss_propensities.txt, seq_reference_data.txt).
______________________________________________________________________
许可证
基于曼彻斯特大学的蛋白质溶胶工具。
学分
基于 蛋白质溶胶 Hebditch等人。
引用:Hebditch等人(2017)“蛋白质溶胶:一种从序列预测蛋白质溶解度的网络工具”生物信息学33:3098-3100。
