Skip to content

bdeva1975/chemmcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChemMCP

Give your AI agent real chemistry hands. ChemMCP is a Model Context Protocol server that lets Claude — or any MCP client — validate chemical structures, compute drug-likeness, look up authoritative compound data from PubChem and ChEMBL, and draw molecules, all from natural language.

Caffeine structure rendered by ChemMCP

License: MIT Python 3.10+ Model Context Protocol Built with FastMCP


Why

Ask a bare language model for a molecule's exact formula, its polar surface area, or whether a compound is an approved drug, and it will often answer — confidently, and sometimes wrong. ChemMCP removes the guessing. Structural calculations run deterministically through RDKit; identity and bioactivity come from PubChem and ChEMBL. The agent reasons over computed and sourced facts instead of inventing them.

It is client-agnostic: one server works with Claude Code, Claude Desktop, Cursor, and any other MCP-compatible host.

Tools

Tool What it does Source
validate_smiles Checks a SMILES string and returns its canonical form RDKit (local)
describe_molecule Physicochemical descriptors + Lipinski Rule of Five drug-likeness RDKit (local)
draw_molecule Renders a 2D structure as a PNG (inline + saved to disk) RDKit (local)
lookup_compound Resolves a name to CID, formula, weight, SMILES, InChIKey PubChem
lookup_bioactivity Clinical phase / approval status + mechanism of action ChEMBL

The tools compose. Give the agent a name, and it can resolve the structure, compute its properties, render it, and report what it does — chaining the tools on its own.

Requirements

  • Python 3.10 or newer

Install

git clone https://github.com/bdeva1975/chemmcp.git
cd chemmcp
python -m venv .venv

# Windows (PowerShell)
.\.venv\Scripts\Activate.ps1
# macOS / Linux
source .venv/bin/activate

pip install -r requirements.txt

Connect to Claude Code

From the project directory, register the server with the venv's Python and the full path to server.py:

# macOS / Linux
claude mcp add chemmcp -- /full/path/to/chemmcp/.venv/bin/python /full/path/to/chemmcp/server.py

# Windows
claude mcp add chemmcp -- "C:\path\to\chemmcp\.venv\Scripts\python.exe" "C:\path\to\chemmcp\server.py"

Verify inside Claude Code with /mcp — you should see chemmcp connected with five tools.

Connect to Claude Desktop

Add this to claude_desktop_config.json (Settings → Developer → Edit Config), adjusting the paths:

{
  "mcpServers": {
    "chemmcp": {
      "command": "/full/path/to/chemmcp/.venv/bin/python",
      "args": ["/full/path/to/chemmcp/server.py"]
    }
  }
}

Restart Claude Desktop and the tools appear under the connectors menu.

Example

You: Look up caffeine, check its bioactivity, and draw it.

ChemMCP resolves caffeine in PubChem (CID 2519), retrieves its ChEMBL record — CHEMBL113, an approved small-molecule drug whose mechanism is adenosine receptor antagonist — computes its Lipinski profile locally (drug-like, zero violations), and renders the structure to a PNG.

Notes

Corporate networks. ChemMCP verifies TLS against the operating system's trust store (via truststore), so HTTPS calls to PubChem and ChEMBL succeed behind a TLS-intercepting corporate proxy — without disabling certificate verification.

Structure images. Image-capable clients such as Claude Desktop render draw_molecule output inline. Terminal clients such as Claude Code cannot display images, so draw_molecule also writes the PNG to ./chemmcp_output/ and returns the file path. Override the location with the CHEMMCP_OUTPUT_DIR environment variable.

Data sources & attribution

ChemMCP retrieves data from public scientific resources. Please review and respect each provider's terms when using their data:

  • PubChem — National Center for Biotechnology Information (NCBI)
  • ChEMBL — European Bioinformatics Institute (EMBL-EBI); ChEMBL data is released under CC BY-SA 3.0
  • RDKit — open-source cheminformatics toolkit (BSD license)

License

MIT — see LICENSE.

About

Chemistry tools for AI agents via the Model Context Protocol — validate, describe, draw, and look up compounds from PubChem and ChEMBL.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages