- Home
- MCP servers
- PubChem
PubChem
- typescript
5
GitHub Stars
typescript
Language
5 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": {
"cyanheads-pubchem-mcp-server": {
"command": "npx",
"args": [
"@cyanheads/pubchem-mcp-server"
],
"env": {
"LOGS_DIR": "logs/",
"MCP_AUTH_MODE": "jwt",
"MCP_HTTP_HOST": "127.0.0.1",
"MCP_HTTP_PORT": "3010",
"MCP_LOG_LEVEL": "info",
"LOG_OUTPUT_MODE": "file",
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_ALLOWED_ORIGINS": "<MCP_ALLOWED_ORIGINS>",
"MCP_AUTH_SECRET_KEY": "YOUR_SECRET_KEY"
}
}
}
}You can access PubChem data through a dedicated MCP server that exposes PubChem capabilities via the Model Context Protocol. This server lets your AI agents and tools search for compounds, fetch properties, retrieve images, explore bioassays, and cross-reference data without leaving your application.
How to use
Use this server from your MCP client to perform common chemical research workflows. You can search for PubChem CIDs by name, SMILES, or InChIKey, fetch physicochemical properties for one or more CIDs, obtain 2D structure images, and explore substances and bioassays. You can also find related data such as PubMed, patents, and cross-references from PubChem. The MCP client will treat PubChem as a data source and call the server’s tools to run queries and return structured results for your AI agents or research tools.
How to install
# Prerequisites
node.js (>=20.0.0)
npm (comes with Node.js)
Docker (optional, for containerized deployment)
# Install the MCP server package
npm install @cyanheads/pubchem-mcp-server
# If you prefer to run directly from the package without installing locally, you can use npx (see next step)
Additional setup and configuration
Configure the server with environment variables to control transport, authentication, logging, and other runtime aspects. The following variables are commonly set in your MCP client settings or host environment.
{
"MCP_TRANSPORT_TYPE": "stdio|http",
"MCP_HTTP_PORT": "3010",
"MCP_HTTP_HOST": "127.0.0.1",
"MCP_ALLOWED_ORIGINS": "",
"MCP_LOG_LEVEL": "info",
"LOG_OUTPUT_MODE": "file|stdout",
"MCP_AUTH_MODE": "jwt|oauth",
"MCP_AUTH_SECRET_KEY": "YOUR_32+_CHAR_SECRET_HERE",
"LOGS_DIR": "logs/"
}
Starting the server using MCP client settings
You can run the server via an MCP client configuration that uses npx to fetch and run the package. This approach keeps you aligned with MCP workflows and avoids manual build steps.
{
"mcpServers": {
"pubchem_mcp": {
"command": "npx",
"args": ["@cyanheads/pubchem-mcp-server"],
"env": {}
}
}
}
Notes on usage
The server integrates with PubChem’s PUG REST API and respects rate limits. It focuses on practical MCP workflows, so you can drive searches, property fetches, image generation, structure and similarity queries, and cross-database references from your MCP client.
Troubleshooting and best practices
- Ensure your environment variables are set correctly for transport and authentication. - Use the JSON configuration snippet above as a reference when wiring your MCP client. - If you encounter connectivity issues, verify the host and port you configure for the MCP transport type you are using (stdio does not require a network endpoint). - Check logs in the configured LOGS_DIR if you enable file-based logging.
Available tools
pubchem_search_compound_by_identifier
Searches for PubChem Compound IDs (CIDs) using a common chemical identifier such as name, SMILES, or InChIKey.
pubchem_fetch_compound_properties
Fetches specified physicochemical properties for one or more CIDs, including MolecularWeight, XLogP, and IUPACName.
pubchem_get_compound_image
Fetches a 2D image of a compound's structure for a given CID, with size options small or large.
pubchem_search_compounds_by_structure
Performs a structural search using a SMILES string or CID as the query with substructure, superstructure, or identity types.
pubchem_search_compounds_by_similarity
Finds compounds with similar 2D structures based on a Tanimoto score, configurable by threshold and max records.
pubchem_search_compounds_by_formula
Finds CIDs that match a given molecular formula, with options for exact or extended element sets.
pubchem_fetch_substance_details
Retrieves details for a PubChem Substance ID (SID), including synonyms and related CIDs.
pubchem_fetch_assay_summary
Fetches a detailed summary for a PubChem BioAssay (AID), including name, description, and statistics.
pubchem_search_assays_by_target
Finds PubChem BioAssay IDs related to a biological target by symbol or name.
pubchem_fetch_compound_xrefs
Fetches external cross-references for a CID, including PubMed, Patent IDs, and Registry IDs.