pubchem
Enables large language models to correctly query molecular databases and generate structure files
claude mcp add --transport stdio phelanshao-pubchem-mcp-server python3 /path/to/pubchem-mcp-server/python_version/mcp_server.py \ --env PYTHONUNBUFFERED="1"
How to use
This PubChem MCP Server provides a Python-based implementation that exposes PubChem chemical data through the MCP interface. It supports querying compounds by name or PubChem CID and returns rich data including IUPAC name, molecular formula, molecular weight, SMILES, InChI and InChIKey, with optional 3D structure data. Two primary tools are available: get_pubchem_data for retrieving compound properties and optionally a 3D structure, and download_structure for downloading structural files in formats like sdf, mol, or smi. You can configure the server in your MCP setup and invoke these tools through the standard MCP workflow. The server also includes a built-in cache to speed up repeated queries and an automatic retry mechanism to improve API reliability. If PubChem 3D data is unavailable, the server can generate a fallback 3D structure for compatibility.
How to install
Prerequisites:
- Python 3.8+
- pip (Python package manager)
- Optional: RDKit for enhanced 3D structure handling
From Source Installation:
- Clone the repository: git clone https://github.com/yourusername/pubchem-mcp-server.git
- Change into the Python version directory: cd pubchem-mcp-server/python_version
- Install the package in editable mode: pip install -e .
- Optional: install RDKit-enabled extras for enhanced 3D support: pip install -e ".[rdkit]"
Notes:
- Ensure your environment has network access to reach PubChem API endpoints.
- If you plan to run multiple MCP servers, consider isolating environments (virtualenv/conda).
- Verify PYTHONUNBUFFERED is set when running for real-time logs.
Additional notes
Tips and common issues:
- If you encounter API rate limits, rely on the server's built-in caching to reduce repeated calls.
- Ensure the environment variable PYTHONUNBUFFERED is set to 1 for clean log streaming when used with MCP orchestrators.
- The server stores 3D structure caches under ~/.pubchem-mcp/cache/; ensure the home directory is writable by the running process.
- RDKit is optional but recommended for accurate and robust 3D structure handling; install via the extra [rdkit] when available.
- If you change the server path or configuration, update your MCP configuration accordingly to reflect the correct Python script location and arguments.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP