Get the FREE Ultimate OpenClaw Setup Guide →

pubchem

A Model Context Protocol (MCP) server providing comprehensive LLM tools for the PubChem PUG REST API.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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
  1. Clone the repository git clone https://github.com/cyanheads/pubchem-mcp-server.git cd pubchem-mcp-server

  2. Install dependencies npm install

  3. Build the TypeScript project npm run build

  4. Configure environment variables (optional but recommended)

    • Create a .env file or set env vars directly: PORT=3000 NODE_ENV=production LOG_LEVEL=info
  5. Run the server npm start

  6. (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

Sponsor this space

Reach thousands of developers