ChemDraw Compound Smart Drawing Tool
БесплатноНе проверенEnables intelligent identification and validation of compound data from documents and images, then automatically draws compound structures using local ChemDraw
Описание
Enables intelligent identification and validation of compound data from documents and images, then automatically draws compound structures using local ChemDraw software with academic formatting.
README
一个集成化的 MCP (Model Context Protocol) 工具,能够从文档中智能识别化合物信息,通过 PubChem 等公开数据库验证和补充化合物数据,利用视觉识别技术解析化合物结构,最终调用本地 ChemDraw 软件绘制化合物结构并输出 ChemDraw 专用格式文件。
✨ 功能特性
- 文档化合物信息提取 - 支持 Word/PDF/Markdown/TXT 文档,中英文混合识别
- PubChem 化合物数据查询 - 获取 SMILES、CAS 号、分子量、分子式等完整数据
- 视觉结构识别 - 从文档图片中识别化合物结构(基于 Imago 引擎)
- ChemDraw COM 接口调用 - 自动化绘制化合物结构,支持 Clean Up 操作
- 多格式输出 - CDXML、CDX、PNG (300dpi)、SVG
- 学术规范设置 - Kekulé 苯环格式、20pt 字体、手性中心标记、统一键长角度
📋 系统要求
- 操作系统: Windows 10/11
- Python: 3.8+
- ChemDraw: 2020/2021/2022(需已注册 COM 对象)
- 网络: 可访问 PubChem API
🚀 安装
# 克隆仓库
git clone https://github.com/king12q/Chemdraw-draw-mcp.git
cd Chemdraw-draw-mcp
# 安装依赖
pip install -r requirements.txt
依赖库
| 库名 | 用途 |
|---|---|
| python-docx | Word 文档解析 |
| pdfplumber | PDF 文档解析 |
| pubchempy | PubChem API 调用 |
| pywin32 | ChemDraw COM 接口 |
| requests | HTTP 请求 |
| pillow | 图片处理 |
| opencv-python | 视觉识别图片预处理 |
| mcp | MCP 协议 SDK (FastMCP) |
| pytest | 测试框架 |
📖 使用方法
MCP 工具调用
工具名称: draw_compound
参数说明:
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
input_type |
string | 是 | - | 输入类型: document/name/smiles/image |
input_value |
string | 是 | - | 输入值(文档路径/化合物名称/SMILES/图片路径) |
formats |
array | 否 | ["cdxml", "png"] |
输出格式列表 |
benzene_format |
string | 否 | "kekule" |
苯环格式: kekule/circle |
font_size |
number | 否 | 20 |
字体大小 (pt) |
show_stereo |
boolean | 否 | true |
是否显示手性标记 |
调用示例:
{
"input_type": "name",
"input_value": "Aspirin",
"formats": ["cdxml", "png", "svg"],
"benzene_format": "kekule",
"font_size": 20,
"show_stereo": true
}
Python API 调用
from src.mcp_server import draw_compound_handler
# 从化合物名称绘制
result = draw_compound_handler({
"input_type": "name",
"input_value": "Aspirin",
"formats": ["cdxml", "png"]
})
# 从SMILES绘制
result = draw_compound_handler({
"input_type": "smiles",
"input_value": "CC(=O)OC1=CC=CC=C1C(=O)O"
})
# 从文档批量提取并绘制
result = draw_compound_handler({
"input_type": "document",
"input_value": "path/to/compounds.docx"
})
📁 项目结构
Chemdraw-draw-mcp/
├── src/
│ ├── parsers/ # 文档化合物信息提取模块
│ │ ├── word_parser.py
│ │ ├── pdf_parser.py
│ │ ├── markdown_parser.py
│ │ └── compound_identifier.py
│ ├── query/ # PubChem 化合物查询模块
│ │ └── pubchem_client.py
│ ├── visual/ # 视觉结构识别模块
│ │ ├── image_preprocessor.py
│ │ ├── structure_recognizer.py
│ │ ├── imago_recognizer.py
│ │ └── fallback_recognizer.py
│ ├── draw/ # ChemDraw COM 接口模块
│ │ └── chemdraw_com.py
│ ├── output/ # 格式输出模块
│ │ └── format_exporter.py
│ ├── specs/ # 学术规范设置模块
│ │ └── academic_specs.py
│ └── mcp_server.py # MCP 服务核心
├── tools/
│ └── draw_compound.json # MCP 工具定义
├── tests/ # 测试文件
├── requirements.txt
└── setup.py
🧪 测试
# 运行所有测试
pytest
# 运行特定模块测试
pytest tests/test_parsers.py
pytest tests/test_pubchem.py
pytest tests/test_chemdraw.py
# 运行集成测试
pytest tests/test_integration.py
# 运行性能测试
pytest tests/test_performance.py
📊 处理流程
输入 → 解析/查询 → 获取SMILES → ChemDraw绘制 → 学术规范应用 → 格式导出
- 文档输入: 解析 Word/PDF/Markdown → 识别化合物名称
- 名称输入: 查询 PubChem → 获取 SMILES
- SMILES输入: 直接使用
- 图片输入: 视觉识别 → 获取 SMILES
- 绘制: 调用 ChemDraw COM → 绘制结构 → Clean Up
- 规范: Kekulé 格式 → 20pt 字体 → 手性标记
- 输出: CDXML/CDX/PNG/SVG
🔧 MCP 配置
在 TRAE IDE 中配置 MCP 服务(将路径替换为你的实际安装路径):
{
"mcpServers": {
"chemdraw-draw": {
"command": "python",
"args": [
"C:\\Users\\Administrator\\Desktop\\Review-Work\\Chemdraw-draw-mcp\\src\\mcp_server.py"
],
"env": {}
}
}
}
注意:
src/mcp_server.py已配置sys.path动态注入和绝对导入,可直接以脚本方式运行,无需额外设置PYTHONPATH。
📝 返回数据格式
{
"success": true,
"compounds": [
{
"name": "Aspirin",
"chinese_name": "阿司匹林",
"smiles": "CC(=O)OC1=CC=CC=C1C(=O)O",
"cas": "50-78-2",
"molecular_weight": 180.16,
"formula": "C9H8O4"
}
],
"files": [
"output/compound_1_Aspirin.cdxml",
"output/compound_1_Aspirin.png"
],
"message": "成功绘制 1 个化合物"
}
⚠️ 注意事项
- 确保 ChemDraw 已正确安装并注册 COM 对象
- 首次使用时 ChemDraw 可能会弹出安全提示,请允许程序访问
- PubChem 查询需要网络连接
- 输出文件默认保存在
output/目录
📄 许可证
MIT License
🤝 贡献
欢迎提交 Issue 和 Pull Request!
Установка ChemDraw Compound Smart Drawing Tool
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/king12q/Chemdraw-draw-mcpFAQ
ChemDraw Compound Smart Drawing Tool MCP бесплатный?
Да, ChemDraw Compound Smart Drawing Tool MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для ChemDraw Compound Smart Drawing Tool?
Нет, ChemDraw Compound Smart Drawing Tool работает без API-ключей и переменных окружения.
ChemDraw Compound Smart Drawing Tool — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить ChemDraw Compound Smart Drawing Tool в Claude Desktop, Claude Code или Cursor?
Открой ChemDraw Compound Smart Drawing Tool на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
GitHub
PRs, issues, code search, CI status
автор: GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
автор: mcpdotdirectCompare ChemDraw Compound Smart Drawing Tool with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development
