ChemMCP
A chemistry computation platform providing 19 professional tools for molecular structure processing, including SMILES conversions, molecular calculations, functional group identification, visualization, and AI-powered molecule generation and description.
README
ChemMCP - 化学分子计算平台
ChemMCP是一个基于模型上下文协议(MCP)的化学分子计算工具集合,提供19个专业的化学分子处理工具。
🚀 快速开始
环境要求
- Python 3.11+ (推荐Python 3.11或3.12)
- Conda 环境管理器
安装步骤
- 创建conda环境:
conda create -n chemmcp python=3.11
conda activate chemmcp
- 安装依赖:
pip install -r requirements.txt
- 安装ChemMCP:
pip install -e .
安装选项
ChemMCP提供灵活的安装选项,您可以根据需要选择:
选项1: 基础安装(推荐)
# 安装核心依赖,支持17个工具
pip install -r requirements.txt
支持的工具: 除MoleculeCaptioner和MoleculeGenerator外的所有工具
选项2: 完整安装(包含AI工具)
# 方式A: 使用可选依赖组
pip install -e ".[ai]"
# 方式B: 手动安装AI依赖
pip install -r requirements.txt
pip install transformers>=4.20.0 torch>=1.9.0
支持的工具: 全部19个工具,包括AI驱动的分子描述和生成功能
选项3: 开发环境
# 安装所有依赖和开发工具
pip install -e ".[all,dev]"
配置环境变量
根据使用的工具设置相应的API密钥:
# 网络搜索工具所需(必需)
export TAVILY_API_KEY="your_tavily_api_key"
# LLM工具所需(必需)
export LLM_MODEL_NAME="openai/gpt-4o"
export OPENAI_API_KEY="your_openai_api_key"
# ChemSpace工具所需(可选,仅在PubChem查找失败时作为后备)
export CHEMSPACE_API_KEY="your_chemspace_api_key"
🔧 工具列表
1. WebSearch - 网络搜索
功能: 执行网络搜索以获取化学相关信息 输入: 搜索查询字符串 输出: 搜索结果和相关链接
2. MoleculeWeight - 分子量计算
功能: 计算分子的分子量 输入: SMILES分子结构字符串 输出: 分子量数值
3. MoleculeAtomCount - 原子计数
功能: 统计分子中各种原子的数量 输入: SMILES分子结构字符串 输出: 各原子类型的数量统计
4. MoleculeSimilarity - 分子相似性
功能: 计算两个分子的Tanimoto相似度 输入: 两个SMILES分子结构字符串 输出: 相似度分数(0-1)
5. FunctionalGroups - 官能团识别
功能: 识别分子中存在的官能团 输入: SMILES分子结构字符串 输出: 检测到的官能团列表
6. SmilesCanonicalization - SMILES标准化
功能: 将SMILES字符串转换为标准化形式 输入: SMILES分子结构字符串 输出: 标准化的SMILES字符串
7. Iupac2Smiles - IUPAC名称转SMILES
功能: 将IUPAC化学名称转换为SMILES格式 输入: IUPAC化学名称 输出: 对应的SMILES字符串
8. Smiles2Iupac - SMILES转IUPAC名称
功能: 将SMILES格式转换为IUPAC化学名称 输入: SMILES分子结构字符串 输出: 对应的IUPAC化学名称
9. Smiles2Formula - SMILES转分子式
功能: 将SMILES格式转换为分子式 输入: SMILES分子结构字符串 输出: 分子式(如C2H6O)
10. Name2Smiles - 通用名称转SMILES
功能: 将化学物质的通用名称转换为SMILES格式 输入: 化学物质名称 输出: 对应的SMILES字符串
11. Selfies2Smiles - SELFIES转SMILES
功能: 将SELFIES格式转换为SMILES格式 输入: SELFIES字符串 输出: 对应的SMILES字符串
12. Smiles2Selfies - SMILES转SELFIES
功能: 将SMILES格式转换为SELFIES格式 输入: SMILES分子结构字符串 输出: 对应的SELFIES字符串
13. Smiles2Cas - SMILES转CAS号
功能: 将SMILES格式转换为CAS登记号 输入: SMILES分子结构字符串 输出: 对应的CAS登记号
14. MoleculeSmilesCheck - SMILES验证
功能: 验证SMILES字符串的语法正确性 输入: SMILES分子结构字符串 输出: 验证结果(有效/无效)
15. ReactionSmilesCheck - 反应SMILES验证
功能: 验证反应SMILES字符串的语法正确性 输入: 反应SMILES字符串 输出: 验证结果(有效/无效)
16. MoleculeVisualizer - 分子可视化
功能: 生成分子的2D结构图 输入: SMILES分子结构字符串 输出: 分子结构图像
17. MoleculeCaptioner - 分子描述生成
功能: 使用AI生成分子的文字描述 输入: SMILES分子结构字符串 输出: 分子的详细文字描述
18. MoleculeGenerator - 分子生成
功能: 使用AI根据描述生成分子结构 输入: 分子描述文本 输出: 对应的SMILES分子结构
19. MoleculeModifier - 分子修饰
功能: 对分子进行化学修饰和衍生化 输入: SMILES分子结构字符串 输出: 修饰后的分子结构选项
📖 使用示例
# 启动MCP服务器,使用特定工具
python -m chemmcp --tools WebSearch MoleculeWeight MoleculeAtomCount
# 或使用所有工具
python -m chemmcp --tools WebSearch MoleculeWeight MoleculeAtomCount MoleculeSimilarity FunctionalGroups SmilesCanonicalization Iupac2Smiles Smiles2Iupac Smiles2Formula Name2Smiles Selfies2Smiles Smiles2Selfies Smiles2Cas MoleculeSmilesCheck ReactionSmilesCheck MoleculeVisualizer MoleculeCaptioner MoleculeGenerator MoleculeModifier
🔧 MCP配置
在您的MCP客户端配置文件中添加以下配置:
{
"mcpServers": {
"ChemMCP": {
"command": "/opt/miniconda3/envs/chemmcp/bin/python", // 如何找到路径: conda activate chemmcp && which python
"args": [
"-m", "chemmcp",
"--tools",
"WebSearch",
"MoleculeWeight",
"MoleculeAtomCount",
"MoleculeSimilarity",
"FunctionalGroups",
"SmilesCanonicalization",
"Iupac2Smiles",
"Smiles2Iupac",
"Smiles2Formula",
"Name2Smiles",
"Selfies2Smiles",
"Smiles2Selfies",
"Smiles2Cas",
"MoleculeSmilesCheck",
"ReactionSmilesCheck",
"MoleculeVisualizer",
"MoleculeCaptioner",
"MoleculeGenerator",
"MoleculeModifier"
],
"toolCallTimeoutMillis": 300000,
"env": {
"TAVILY_API_KEY": "your_tavily_api_key_here",
"LLM_MODEL_NAME": "openai/gpt-4o",
"OPENAI_API_KEY": "your_openai_api_key_here",
"CHEMSPACE_API_KEY": "your_chemspace_api_key_here", // 可选:仅在需要额外数据库查找时使用
"PATH": "/opt/miniconda3/envs/chemmcp/bin:/usr/local/bin:/usr/bin:/bin" // 如何找到路径: conda activate chemmcp && echo $PATH
}
}
}
}
注意:
- 如何找到正确的Python路径:
# 激活您的conda环境 conda activate chemmcp # 查看Python路径 which python # 复制输出的路径并替换上面配置中的路径 - 请将API密钥替换为您的实际密钥
- CHEMSPACE_API_KEY是可选的:只有
Iupac2Smiles工具在PubChem查找失败时才会使用ChemSpace作为后备数据库 - 确保您的Python环境版本为3.11或更高版本
🛠️ 依赖项
- RDKit: 分子处理和计算的核心库
- PubChemPy: PubChem数据库接口
- SELFIES: 分子的自引用嵌入式字符串表示
- rdchiral: 手性分子处理
- synspace: 分子空间探索和修饰
- tavily-python: 网络搜索API
- litellm: 统一的LLM API接口
- requests: HTTP请求库
📄 许可证
本项目采用MIT许可证。详见LICENSE文件。
注意: 使用某些工具需要相应的API密钥。请确保在使用前正确设置环境变量。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.