ESM MCP服务器
通过Docker使用Facebook的ESM模型进行蛋白质适应性预测
用于蛋白质适应度预测的MCP(模型上下文协议)服务器,具有5个核心工具:
- 提取嵌入(监督学习)
- 训练健身模型
- 预测新序列的适应度
- 计算基于序列的可能性得分(零样本)
- 计算基于结构的可能性得分(零样本)
Docker快速入门
方法1:从GitHub中提取预构建映像
最快的开始方式。每次发布时,预构建的Docker镜像都会自动发布到GitHub容器注册表。
# Pull the latest image
docker pull ghcr.io/macromnex/esm_mcp:latest
# Register with Claude Code (runs as current user to avoid permission issues)
claude mcp add esm -- docker run -i --rm --user `id -u`:`id -g` --gpus all --ipc=host -v `pwd`:`pwd` ghcr.io/macromnex/esm_mcp:latest注: 从项目目录运行。 ${pwd} 展开到当前工作目录。
要求:
- 支持GPU的Docker(
nvidia-docker或带有NVIDIA运行时的Docker) - 已安装克劳德代码
就是这样!ESM MCP服务器现在可以在Claude Code中使用。
______________________________________________________________________
方法2:在本地构建Docker镜像
自己构建映像并将其安装到Claude Code中。适用于自定义或离线环境。
# Clone the repository
git clone https://github.com/MacromNex/esm_mcp.git
cd esm_mcp
# Build the Docker image
docker build -t esm_mcp:latest .
# Register with Claude Code (runs as current user to avoid permission issues)
claude mcp add esm -- docker run -i --rm --user `id -u`:`id -g` --gpus all --ipc=host -v `pwd`:`pwd` esm_mcp:latest注: 从项目目录运行。 ${pwd} 展开到当前工作目录。
要求:
- 支持GPU的Docker
- 已安装克劳德代码
- Git(克隆存储库)
关于Docker标志:
-i--Claude Code的交互模式--rm--退出后自动移除容器--user ${id -u}:${id -g}--以当前用户身份运行容器,因此输出文件归您所有(不是root)--gpus all--授予对所有可用GPU的访问权限--ipc=host--使用主机IPC命名空间以获得更好的性能-v--装载您的项目目录,以便容器可以访问您的数据
______________________________________________________________________
验证安装
添加MCP服务器后,您可以验证它是否正常工作:
# List registered MCP servers
claude mcp list
# You should see 'esm' in the output在Claude Code中,您现在可以使用所有5个ESM工具:
esm_extract_embeddings_from_csvesm_calculate_llhesm_if_calculate_llhesm_train_fitness_modelesm_predict_fitness
______________________________________________________________________
后续步骤
- 详细文件:参见 detail.md 有关以下内容的全面指南:
- 可用的MCP工具和参数 - 本地Python环境设置(Docker的替代方案) - 示例工作流和用例 - ESM型号选项和设备选择
______________________________________________________________________
使用示例
注册后,您可以直接在Claude Code中使用ESM工具。以下是一些常见的工作流程:
示例1:提取嵌入
Can you extract ESM embeddings from my protein sequences at /path/to/data.csv using the esm_extract_embeddings_from_csv tool? Use the esm2_t33_650M_UR50D model and output to /path/to/embeddings/示例2:零样本适应度预测(基于序列)
I have protein variants in /path/to/variants.csv and the wild-type sequence in /path/to/wt.fasta. Can you calculate ESM likelihood scores using esm_calculate_llh to predict fitness without training data? Save results to /path/to/output.csv示例3:基于结构的健身预测
I have variants in /path/to/variants.csv, wild-type sequence in /path/to/wt.fasta, and structure in /path/to/structure.pdb. Can you calculate ESM-IF likelihood scores using esm_if_calculate_llh to predict fitness with structural information?示例4:训练健身模型
I have embeddings in /path/to/data/ directory with fitness values. Can you train an ESM fitness model using esm_train_fitness_model with SVR as the head model and 60 PCA components? Save to /path/to/models/示例5:使用训练模型进行预测
I have new sequences in /path/to/new_data.csv. Can you predict their fitness using esm_predict_fitness with the trained model from /path/to/models/final_model/?______________________________________________________________________
支持的ESM型号
所有工具都支持以下骨干模型:
esm2_t33_650M_UR50D(默认,650M参数)esm2_t36_3B_UR50D(3B参数)esm1v_t33_650M_UR90S_1通过esm1v_t33_650M_UR90S_5
GPU支持
这两种Docker方法都完全支持:
- 多GPU系统(通过指定设备
cuda:0,cuda:1等等) - 单GPU设置
- 仅CPU推理(使用
cpu设备)
______________________________________________________________________
故障排除
找不到Docker?
docker --version # Install Docker if missingGPU无法访问?
- 确保安装了NVIDIA Docker运行时
- 核对
docker run --gpus all ubuntu nvidia-smi
未找到克劳德代码?
# Install Claude Code
npm install -g @anthropic-ai/claude-code______________________________________________________________________
许可证
与ESM模型相同(元人工智能研究)
