BIOVIA Draw MCP Server
# BIOVIA Draw MCP Server (`biovia-draw-mcp`)
[](https://github.com/jakecharisma-prog/biovia-draw-mcp/actions/workflows/ci.yml)
[](./LICENSE)
[](https://www.python.org/)
[](#platform-support-matrix)
> **Disclaimer:** This is an **unofficial, independent community project** licensed under the MIT License. It is **not affiliated with, endorsed by, or sponsored by Dassault Systèmes or BIOVIA**. No proprietary BIOVIA binaries or libraries are distributed in this repository — the helper engine compiles locally against your own legally installed copy of BIOVIA Draw on Windows.
[Русская версия документации (README.ru.md)](./README.ru.md)
A **Model Context Protocol (MCP)** server that gives AI assistants (**Antigravity**, **OpenAI Codex CLI**, **Claude Desktop**, **Cursor**, **VS Code**, etc.) native control over **BIOVIA Draw** (`.skc`, `.mol`, `.rxn`, `.sdf`, `.cdx`, HELM, InChI, offline IUPAC, Journal Settings presets, clipboard) and **Microsoft Office** (genuine double-clickable **BIOVIA Draw OLE objects** inside Word `.docx` and PowerPoint `.pptx` documents — not static images!).
---
## Key Features
- **Native BIOVIA Draw `.NET` & OLE Integration** — builds real `.skc` sketches, MDL `.mol` (V2000 & V3000), `.rxn` reactions, and genuine OLE Compound Binary objects (`MDLDrawOLE.MDLDrawObject.1`) via your locally installed BIOVIA Draw assemblies (auto-discovered via Windows Registry & GAC across versions).
- **Chemical Reactions & Biopolymers** — construct reaction schemes (`CleanUpReaction()` layout from Reaction SMILES or structured reactants/reagents/products) and **HELM** peptides / oligonucleotides.
- **Bidirectional GUI & Format Conversion** — read `.skc`, `.mol`, `.rxn`, **ChemDraw `.cdx`**, and structures copied (`Ctrl+C`) directly from BIOVIA Draw; convert offline between `SMILES ↔ IUPAC ↔ InChI ↔ InChIKey ↔ HELM ↔ Molfile V2000/V3000 ↔ SKC ↔ PNG`.
- **Journal Publication Presets** — supports BIOVIA Draw's built-in `Journal Settings` (`ACS Document`, `RSC Document`, `Wiley Document`, `Presentations`, etc.), black-and-white or element coloring, implicit hydrogen modes, and CIP `R/S` + `E/Z` stereo labels.
- **Structure Validation & SDF Libraries** — stereochemistry validation via `PPChemAPI` (`GetBadStereos`, axial stereo, allenes, atropisomers) plus `.sdf` inspect / split / merge tools.
- **Authoritative Scientific Databases** — built-in non-Wikipedia lookups via **PubChem (NIH)** and **ChEMBL (EMBL-EBI)** including Lipinski Rule-of-5 descriptors.
- **Microsoft Office Native OLE Objects (Word & PowerPoint)**:
- **Insert into any existing `.docx`** via placeholders (`{{biovia:aspirin}}`), table cell coordinates, or appending — preserving all existing styles and formatting.
- **Generate formatted Word chemistry/pharmacology reports** with auto-subscripted formulas, embedded BIOVIA Draw OLE objects, optional Wikipedia URL blocker, and automatic PDF export + Word OLE verification.
- **Create 16:9 PowerPoint `.pptx` decks** with genuine double-clickable BIOVIA Draw OLE structures on every slide.
- **Zero External Python Dependencies** — runs on standard Python 3.9+ stdlib.
---
## Platform Support Matrix
Because **BIOVIA Draw** and **Windows COM/OLE** are Windows-only technologies, `biovia-draw-mcp` automatically selects the best backend for your OS (override anytime with `BIOVIA_BACKEND=biovia|rdkit`):
| Capability | Windows + BIOVIA Draw (`biovia` backend) | Linux / macOS (`rdkit` backend) |
| :--- | :---: | :---: |
| Structures (`.mol` V2000/V3000, 300-DPI `.png`, formula, MW, InChI/InChIKey) | ✅ Native BIOVIA Draw | ✅ RDKit |
| Native BIOVIA `.skc` & ChemDraw `.cdx` read/write | ✅ | ❌ (Windows only) |
| Chemical reactions (`.rxn`, reaction SMILES) | ✅ `CleanUpReaction()` | ✅ RDKit `rdChemReactions` |
| Peptides / Biopolymers (HELM, 1-letter, 3-letter) | ✅ | ✅ |
| Journal Settings presets (ACS, RSC, Wiley, etc.) | ✅ All 9 BIOVIA XML presets | ✅ BW / Color styles |
| Structure validation & stereochemistry checks | ✅ PPChemAPI | ✅ RDKit sanitization & stereo |
| `.sdf` library inspect / split / merge | ✅ | ✅ |
| PubChem (NIH) & ChEMBL (EMBL-EBI) lookups | ✅ | ✅ |
| Word (`.docx`) & PowerPoint (`.pptx`) embedding | ✅ **Editable BIOVIA Draw OLE objects** (`MDLDrawOLE.MDLDrawObject.1`) | ✅ Crisp 300-DPI inline images |
| PDF export | ✅ Microsoft Word / PowerPoint COM | ✅ LibreOffice (`soffice --headless`) |
| BIOVIA Draw GUI clipboard (`Ctrl+C`/`Ctrl+V`) | ✅ | ❌ (Windows only) |
---
## Requirements
- **Windows (Full Native BIOVIA Draw + Office OLE):**
- Windows 10/11 (64-bit), locally installed **BIOVIA Draw** (2020–2026+), Python 3.9+ (zero pip dependencies), .NET Framework 4.x, *(optional)* Microsoft Word/PowerPoint.
- **Linux & macOS (Cross-Platform RDKit Backend):**
- Python 3.9+, `rdkit` (`pip install rdkit` — installed automatically by `./install.sh`), *(optional)* **LibreOffice** (`soffice`) for PDF export.
---
## Quick Start
### Windows
```powershell
git clone https://github.com/jakecharisma-prog/biovia-draw-mcp.git
cd biovia-draw-mcp
powershell -ExecutionPolicy Bypass -File .\install.ps1
# Or auto-register in OpenAI Codex CLI too:
powershell -ExecutionPolicy Bypass -File .\install.ps1 -ConfigureCodex
```
### Linux & macOS
```bash
git clone https://github.com/jakecharisma-prog/biovia-draw-mcp.git
cd biovia-draw-mcp
chmod +x install.sh
./install.sh
# Or auto-register in OpenAI Codex CLI too:
./install.sh --configure-codex
```
`install.ps1` automatically:
1. Discovers your installed BIOVIA Draw `.NET` assemblies in the Windows GAC and compiles `bin\BioviaEngine.exe` locally.
2. Runs a full health check (`BIOVIADraw.exe`, OLE ProgID, offline OpenEye IUPAC, PPChemAPI InChI/HELM, Word/PowerPoint COM, Journal presets).
3. Prints the ready-to-paste JSON snippet for your MCP client.
### Client Configuration
#### OpenAI Codex CLI (`%USERPROFILE%\.codex\config.toml`)
You can register automatically with `install.ps1 -ConfigureCodex`, via CLI:
```powershell
codex mcp add biovia-draw -- "C:/path/to/python.exe" -u "C:/path/to/biovia-draw-mcp/server.py"
```
or manually in `%USERPROFILE%\.codex\config.toml` (see [examples/codex_config.toml](./examples/codex_config.toml)):
```toml
[mcp_servers.biovia-draw]
command = "C:/path/to/python.exe"
args = [
"-u",
"C:/path/to/biovia-draw-mcp/server.py"
]
startup_timeout_sec = 30
tool_timeout_sec = 180
```
Then start `codex` and run `/mcp` to verify all 17 `biovia_*` tools are connected.
#### Antigravity / Claude Desktop / Cursor (JSON)
Add the server to your MCP client config (see `examples/`):
```json
{
"mcpServers": {
"biovia-draw": {
"command": "python",
"args": [
"-u",
"C:/path/to/biovia-draw-mcp/server.py"
]
}
}
}
```
- **Antigravity:** `~/.gemini/config/mcp_config.json`
- **Claude Desktop:** `%APPDATA%\Claude\claude_desktop_config.json`
- **Cursor:** `.cursor/mcp.json` or global MCP settings
---
## Available MCP Tools (17)
| Category | Tool | Description |
| :--- | :--- | :--- |
| **System** | `biovia_health` | Verify BIOVIA Draw, OLE handler, OpenEye IUPAC, PPChemAPI, Office COM, presets |
| | `biovia_list_presets` | List installed BIOVIA Draw `Journal Settings` style presets |
| **Drawing** | `biovia_create_structure` | Build `.skc`, `.mol` (V2000/V3000), OLE `.bin`, 300-DPI `.png` + metadata |
| | `biovia_create_reaction` | Build reaction schemes from Reaction SMILES, `$RXN`, or reactants/reagents/products |
| | `biovia_create_sequence` | Build peptides/nucleotides/ADCs from **HELM** notation |
| | `biovia_open_structure` | Open `.skc`/`.mol`/`.rxn` (or SMILES/IUPAC/HELM) directly in BIOVIA Draw GUI |
| | `biovia_copy_structure_to_clipboard` | Put `MDLCT`/`MDLSK`/`EMF` structure formats on the Windows clipboard |
| **Reading & QA** | `biovia_read_structure` | Read `.skc`, `.mol`, `.rxn`, **ChemDraw `.cdx`**, `.xml` → SMILES/IUPAC/InChI/formula/MW |
| | `biovia_read_clipboard` | Read structure copied from BIOVIA Draw (`Ctrl+C`) directly from clipboard |
| | `biovia_convert_format` | Offline conversion between SMILES, IUPAC, InChI, InChIKey, HELM, V2000/V3000, SKC, PNG |
| | `biovia_validate_structure` | Stereo & structure quality checks via PPChemAPI (bad stereos, axial, allenes, atropisomers) |
| **Data** | `biovia_sdf_tools` | `inspect`, `split` (to `.skc`/`.mol`/`.png`/OLE), or `merge` `.sdf` libraries |
| | `biovia_lookup_compound` | Query **PubChem (NIH)** and/or **ChEMBL (EMBL-EBI)** (non-Wikipedia) + Lipinski Ro5 |
| **Office OLE** | `biovia_insert_ole_into_docx` | Inject editable BIOVIA Draw OLE objects into **any existing `.docx`** (placeholder / table cell / append) |
| | `biovia_create_drug_report` | Generate formatted Word report with BIOVIA Draw OLE objects, subscripts, non-Wiki links & PDF |
| | `biovia_create_pptx_slides` | Create 16:9 PowerPoint `.pptx` slides with embedded BIOVIA Draw OLE objects |
| | `biovia_export_pdf` | Export `.docx` or `.pptx` to `.pdf` via Microsoft Office COM and verify all embedded OLE objects |
---
## Architecture
```text
MCP Client (Antigravity / Claude / Cursor)
│ JSON-RPC 2.0 (stdio)
▼
server.py ──► src/biovia_draw_mcp/
├── server.py (17 MCP tools)
├── chem_utils.py (V2000/V3000 formula/MW, SDF parser/writer)
├── databases.py (PubChem NIH + ChEMBL EMBL-EBI)
├── docx_builder.py (OOXML report & existing-DOCX OLE injector)
├── pptx_builder.py (OOXML PowerPoint OLE deck builder)
└── engine_bridge.py (JSON IPC + auto-build)
│
▼
bin/BioviaEngine.exe (.NET 4.x x64, compiled locally)
├── MDL.Draw.Foundation / Renderer / Clipboard (GAC)
├── SymyxDrawOLE.dll (MDLDrawOLE.MDLDrawObject)
└── Microsoft Word / PowerPoint COM (PDF export & OLE verify)
```
---
## Running Tests
```powershell
# Fast cross-platform unit tests (no BIOVIA Draw required — also runs in GitHub Actions CI)
python -m unittest discover -s tests -p "test_*.py" -v
# or with pytest:
pytest -v -m "not integration"
# Full live integration tests (Windows + BIOVIA Draw + Microsoft Office)
python tests/test_integration_live.py
```
---
## License
[MIT License](./LICENSE).
BIOVIA and BIOVIA Draw are trademarks of Dassault Systèmes. Microsoft Word and PowerPoint are trademarks of Microsoft Corporation.
TDQS
Scored across 17 tools
Most tools have clearly distinct verbs and resources (create_reaction vs create_sequence vs validate_structure vs lookup_compound are unambiguous). There is some blur between the creation/reading family: create_structure, open_structure, and convert_format all accept the same inputs (SMILES/InChI/HELM) and can all emit mol/skc, so an agent may hesitate over which to pick when it just wants a converted file. read_structure vs read_clipboard is well-differentiated by source.
All 17 tools share a consistent 'biovia_' prefix with snake_case verb_noun bodies (create_structure, read_structure, insert_ole_into_docx, export_pdf). Two deviations: 'biovia_health' has no verb/object structure and 'biovia_sdf_tools' is a noun bucket rather than an action. These are minor and still readable.
17 tools sit just above the comfortable 3-15 band, but the surface splits into coherent functional groups (format conversion, structure/reaction/sequence creation, clipboard I/O, SDF handling, database lookup, Office embedding and export) with essentially no redundant filler. Slightly heavy, yet each tool maps to a distinct workflow an agent would actually invoke.
The lifecycle is well covered: ingest (open/read/clipboard), create (structure/reaction/sequence), convert, validate, look up, batch SDF operations, and publish into Word/PowerPoint/PDF. Gaps are minor but real — there is no tool to edit/modify an existing structure file in place, no delete/cleanup, and no way to close or save a GUI document session. Agents can work around these by re-creating structures from read output.