- Home
- MCP servers
- PubChem
PubChem
- python
4
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"phelanshao-pubchem-mcp-server": {
"command": "python3",
"args": [
"/path/to/pubchem-mcp-server/python_version/mcp_server.py"
],
"env": {
"PYTHONUNBUFFERED": "1"
}
}
}
}You can query PubChem for chemical compound data using an MCP server that exposes a standard interface for AI models. This server provides compound properties, 2D structures, and 3D coordinates with reliable caching and retry behavior to ensure fast, repeatable responses.
How to use
To work with an MCP-enabled client, you run the PubChem MCP Server locally and point your client at the server to request data. You can query by compound name or PubChem CID and choose the output format you want. The server can return rich data including IUPAC name, molecular formula, molecular weight, SMILES, InChI/InChIKey, and optionally a 3D structure in XYZ format. Use the client’s approved tool for getting PubChem data and, if needed, a separate tool to fetch or download structure files.
How to install
Prerequisites you need before installation include Python 3.8 or newer and the Requests library. You may also install RDKit later if you want enhanced 3D handling.
Step 1: Install Python and dependencies on your system.
Step 2: Clone the PubChem MCP Server repository and install in editable mode.
git clone https://github.com/phelanshao/pubchem-mcp-server.git
cd pubchem-mcp-server/python_version
pip install -e .
# For enhanced 3D structure handling, install with RDKit
pip install -e ".[rdkit]"
Additional configuration and notes
The server includes a built-in caching system to speed up repeated requests. In-memory API responses are cached, and 3D structure data is cached under ~/.pubchem-mcp/cache/. If PubChem 3D data cannot be retrieved, the server can fall back to generating a 3D structure.
To run the MCP server, you will configure an MCP client with a stdio (local) server using Python to start the server process.
Configuration and usage notes
The following MCP configuration snippet shows how to wire the PubChem MCP Server as a stdio MCP server. This configuration enables two actions: getting PubChem data and downloading structures when needed.
{
"mcpServers": {
"pubchem": {
"command": "python3",
"args": ["/path/to/pubchem-mcp-server/python_version/mcp_server.py"],
"env": {
"PYTHONUNBUFFERED": "1"
},
"disabled": false,
"autoApprove": [
"get_pubchem_data",
"download_structure"
]
}
}
}
Project details and capabilities
Features include querying by compound name or PubChem CID and retrieving data such as IUPAC name, molecular formula, molecular weight, SMILES, InChI, and InChIKey. Output formats available are JSON (default), CSV, and XYZ for 3D structures. The server includes automatic retries for API reliability and caching to improve performance.
Available tools in this server include get_pubchem_data for retrieving compound data and download_structure for fetching structure files. These tools accept parameters like query or cid and format to control the output.
Security and maintenance notes
Run the server in a controlled environment and manage access to the MCP configuration file. Keep dependencies up to date and monitor the retry behavior to avoid excessive API calls during outages.
Available tools
get_pubchem_data
Retrieves chemical compound data and optional 3D structure data for a given query (name or PubChem CID) in a specified format.
download_structure
Downloads the structure file for a compound in the requested format (e.g., sdf, mol, or smi) using the provided CID.