
ChemGlyph
io.github.random-orbit由 GitHub 帳號 random-orbit 發布v0.2.0更新於 Oct 29, 2026
Publication-quality chemical structure and reaction rendering for AI agents.
概覽
本機 MCP 伺服器,可從 SMILES、InChI 或 molblock 繪製出版級化學結構式與反應式,並驗證結構或解析化合物名稱。
- 可以做什麼
- 依 SMILES、InChI 或 molblock 將單一分子繪製為 PNG,並回傳分子式、分子量與警告
- 將反應或合成路徑繪製為反應式圖片
- 驗證 SMILES 字串並回傳含修正建議的報告
- 把阿司匹林之類的化合物名稱解析為標準 SMILES
- 圖形可對照指定名稱自我檢查,並內嵌結構資訊
- 適用情境
- 適合助理處理化學內容時使用:為論文、教學或對話繪製結構式與反應式,或在圖形進入稿件前找出錯誤的 SMILES。也適合修復格式錯誤的 SMILES,或把化合物名稱轉成結構。
- 執行需求
- 以本機 Python 套件執行(Python 3.11+、RDKit 2024.9+),透過 chemglyph-mcp 命令列腳本以 stdio 啟動。不需帳號、API 金鑰或網路;英文名稱經 OPSIN 解析需安裝選用套件與 Java 執行環境。繪製的 PNG 會寫入使用者下載資料夾中的子資料夾。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 ChemGlyph,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
ChemGlyph
Publication-quality chemical structure and reaction rendering for AI agents. ChemGlyph is the KaTeX of chemistry: a rendering layer, a validation layer, and an MCP interface on top of RDKit.
Install
Render a molecule
render_molecule takes SMILES, InChI, or molblock and returns SVG (or PNG)
plus canonical_smiles, mol_formula, mol_weight, and warnings.
Styles
Three styles, same molecules (benzoic acid, caffeine, (S)-ibuprofen):
Every style draws at one physical scale. acs1996 follows the ACS Document
1996 settings: 14.4 pt bonds, 0.6 pt lines, 10 pt labels, and bond ends that
stop 1.6 pt from each label. Two structures drawn with the same style have
the same bond length and label size, so they line up in a paper. screen
keeps that geometry and colours O, N, S, and Cl (classic CPK); textbook
uses 0.8 pt lines and 12 pt labels.
The SVG size is given in points and the background is transparent unless
transparent=False. fmt="png" takes a dpi, fmt="pdf" gives a vector
PDF for LaTeX, and fmt="mol" a molfile with the drawn coordinates for a
structure editor.
The style names from 0.1 (acs, modern, textbook-cn) still work, map to
acs1996, screen, and textbook, and give a deprecation warning; they go
in 1.0.
These numbers are measured in the rendered output by the test suite
(tests/test_profiles.py).
Compound numbers
The number is set in bold at the label size, centred half a bond length under the structure, as in ACS journals. It is also stored with the embedded structure (the molfile title line), so a figure still says which compound it shows when it is read back.
Abbreviations
abbreviate=True draws protecting and activating groups as labels, with
the spellings of the J. Org. Chem. list of standard abbreviations. Acyl,
carbamate, and benzyl groups are abbreviated only on heteroatoms, so a
benzyl side chain stays a CH2 and a ring; silyl and sulfonyl groups also on
carbon. A group on a terminal O or NH joins its label (OTs, BocHN). A label
that would run into another label or a bond is drawn in full instead.
Only the drawing changes. The embedded structure, the identity, and the
name check use every atom, and fmt="mol" keeps the abbreviations as SUP
groups, which structure editors show as labels and can expand.
Checked figures
Figures from these profiles check themselves and carry their structure:
A name that belongs to another structure produces a warning, which catches a wrong SMILES from an AI model before the figure reaches a manuscript. Names resolve offline through the built-in Chinese dictionary or OPSIN.
Reactions
Reaction schemes are not yet drawn at a fixed scale; that comes with the reaction phase of the roadmap.
Conditions are pre-formatted Unicode text, so pass H₂SO₄, not H2SO4.
ChemGlyph does not parse formulas out of text. The full schema
(multi-step chains, equilibrium and retro arrows, line wrapping) is in
docs/reaction_schema.md.
The aspirin demo writes a two-step route:
Validation
validate_structure reports parse errors and applies four quick fixes:
unmatched brackets and ring closures (reported, not guessed), kekulization
failures of lowercase aromatic atoms, and nitrogen valence errors via a
formal [N+]. Anything else passes RDKit's message through unchanged.
Naming
English IUPAC and common names resolve offline through OPSIN
(pip install 'chemglyph[opsin]', plus a Java runtime). Chinese names use
the built-in dictionary, and the library API accepts a translator callable
for names that are not in it:
ChemGlyph itself never calls an online service, including for translation.
MCP server
Run the bundled console script (stdio transport):
Claude Desktop registration (macOS:
~/Library/Application Support/Claude/claude_desktop_config.json):
One thing to know about clients. Some MCP clients, LM Studio included, only
pass the text part of a tool result to the model and never display the
attached image. The render tools write their PNG to ~/Downloads/chemglyph/
and return that path in the text, so you can always open the file yourself.
If a model claims it rendered a figure but nothing shows up, ask it for the
saved path rather than having it redraw the structure by hand.
Benchmarks
benchmarks/ holds the fixed 20-molecule blind test and a generator that
writes shuffled, numbered PNG/SVG figures plus answer_key.json:
The protocol, the A/B deck generator, the runbook, and the scorer are all in benchmarks/; the pass threshold and procedure are in benchmarks/RUNBOOK.md. Anyone can run it and contribute results.
No blind test against ChemDraw has been run yet, so no comparison is
claimed. Every render is instead checked as it is made (see "Checked
figures"), and tests/test_corpus.py renders a 416-structure corpus
on every commit.
Known limitations
- 14 of the 416 corpus structures have a layout problem that is reported
with a warning: helicene and fullerene (no planar drawing); BINAP,
morphine, codeine, paclitaxel, vinblastine, tetrodotoxin (crowded
polycycles); and cyclodextrins, amphotericin B, forskolin, rifampicin,
sitagliptin (labels in crowded places). Passing a molfile with your own
coordinates avoids them. The list is in
tests/test_corpus.py. - Reaction schemes still use the 0.1 renderer, not the fixed scale.
- Full automatic Chinese name-to-structure parsing is not implemented; Chinese names resolve through a small built-in dictionary plus an optional translator hook. English names resolve through OPSIN.
Roadmap
Work proceeds in phases, and each phase ships as a minor version once its exit criteria pass. The plan, the standards ChemGlyph follows, and the quality gates are in docs/SPEC.md; release notes are in CHANGELOG.md.
- 0.1.3: fixes and release hygiene.
- 0.2 (released): molecules done right. One fixed physical scale for every drawing, style profiles measured against published standards (ACS Document 1996 settings first), a verification report with every render, automated layout checks, abbreviations, compound numbers, PDF and MOL output.
- 0.3: formulas and equations in mhchem syntax, with atom and charge balance checks.
- 0.4: reaction schemes on the shared scale, with an object API for compounds and figures.
- 0.5: mechanism (curved) arrows anchored to atoms and bonds.
Non-goals
No structure editor GUI (Ketcher/ChemDraw competition), no 3D visualization, no retrosynthesis or property prediction, no online database queries, and no automatic mechanism generation. The full list is in the project specification.
Development
Python 3.11+, RDKit 2024.9+, MIT license. All errors derive from
chemglyph.errors.ChemGlyphError.
來源:README.md,提交 2430321
工具
0版本歷史
2- v0.2.0最新Oct 29, 2026
- v0.1.2Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分