pubchem
A Model Context Protocol (MCP) server providing comprehensive LLM tools for the PubChem PUG REST API.
claude mcp add --transport stdio cyanheads-pubchem-mcp-server node dist/server.js \ --env PORT="3000" \ --env NODE_ENV="production" \ --env LOG_LEVEL="info"
How to use
This MCP server exposes PubChem data and capabilities as MCP tools that you can invoke from an MCP client. It provides a suite of tools for searching PubChem compounds, fetching properties, retrieving images, performing structure and similarity searches, and accessing substance, assay, and cross-reference data. The primary entry points are the tools under src/mcp-server/tools, each mapped to a distinct MCP action such as pubchem_search_compound_by_identifier, pubchem_fetch_compound_properties, pubchem_get_compound_image, and more. You can call these tools from your MCP-enabled AI or client by constructing a request that specifies the tool name and the necessary input parameters, and the server will respond with structured MCP results or binary payloads (e.g., images) as appropriate.
To get started, search for a compound by a common identifier (name, SMILES, or InChIKey) using pubchem_search_compound_by_identifier. Once you have a CID, fetch detailed properties with pubchem_fetch_compound_properties, or retrieve a visual structure with pubchem_get_compound_image. If you need to explore related chemistry, use pubchem_search_compounds_by_structure or pubchem_search_compounds_by_similarity to find analogs or structurally related CID candidates. The suite also includes capabilities to query substances, bioassays, and cross-references, enabling comprehensive data gathering for chemical research workflows.
How to install
Prerequisites:
- Node.js (LTS version) and npm installed
- Git installed
- Basic familiarity with running Node.js applications
-
Clone the repository git clone https://github.com/cyanheads/pubchem-mcp-server.git cd pubchem-mcp-server
-
Install dependencies npm install
-
Build the TypeScript project npm run build
-
Configure environment variables (optional but recommended)
- Create a .env file or set env vars directly: PORT=3000 NODE_ENV=production LOG_LEVEL=info
-
Run the server npm start
-
(Optional) Run in development mode with hot-reload (if supported by template) npm run dev
Notes:
- The server exposes an MCP-compliant API over HTTP. Ensure the port is accessible to your MCP clients.
- If you customize environment variables, consult the project’s dotenv validation and security notes in the repository.
Additional notes
Tips and common considerations:
- The server uses the PubChem PUG REST API; be mindful of PubChem rate limits and implement request pacing if integrating into high-throughput workflows.
- Authentication: the template supports JWT/OAuth2.1; configure scopes if your deployment requires restricted access.
- Logging is structured and redacts sensitive data; adjust LOG_LEVEL to control verbosity in production.
- If you run into build issues, ensure TypeScript version (as indicated in the badge) aligns with package.json and that you’ve installed all dependencies exactly as specified (npm ci can help reproduce exact versions).
- For large results, pagination and streaming considerations may apply; consult the tool documentation for fetchSubstanceDetails, fetchAssaySummary, and fetchCompoundXrefs for result handling patterns.
Related MCP Servers
Matryoshka
MCP server for token-efficient large document analysis via the use of REPL state
MiniMax -JS
Official MiniMax Model Context Protocol (MCP) JavaScript implementation that provides seamless integration with MiniMax's powerful AI capabilities including image generation, video generation, text-to-speech, and voice cloning APIs.
rdkit
MCP server that enables language models to interact with RDKit through natural language
ToolRAG
Unlimited LLM tools, zero context penalties — ToolRAG serves exactly the LLM tools your user-query demands.
akyn-sdk
Turn any data source into an MCP server in 5 minutes. Build AI-agents-ready knowledge bases.
pubcrawl
A peer-reviewed pub crawl through the literature — MCP server for PubMed & biomedical literature search