Labsco
cyanheads logo

PubChem MCP Server

โ˜… 9

from cyanheads

Provides comprehensive access to PubChem's chemical information database via the PubChem PUG REST API.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

@cyanheads/pubchem-mcp-server

Search the PubChem chemical database for compounds, properties, safety data, bioactivity, cross-references, and entity summaries via MCP. STDIO or Streamable HTTP.

10 Tools โ€ข 6 Resources

Install in Claude Desktop Install in Cursor Install in VS Code

Public Hosted Server: https://pubchem.caseyjhand.com/mcp


Tools

Ten tools for querying PubChem's chemical information database:

Tool NameDescription
pubchem_search_compoundsSearch for compounds by name, SMILES, InChIKey, formula, substructure, superstructure, or 2D similarity.
pubchem_get_compound_detailsGet physicochemical properties, descriptions, synonyms, drug-likeness, and classification for compounds by CID.
pubchem_get_compound_imageFetch a 2D structure diagram (PNG) for a compound by CID.
pubchem_get_compound_3d_structureFetch a 3D conformer (atomic coordinates and bonds) for a compound by CID, as parsed JSON or raw SDF.
pubchem_get_compound_xrefsGet external database cross-references (PubMed, patents, genes, proteins, etc.).
pubchem_get_compound_safetyGet GHS hazard classification and safety data for one or more compounds by CID (batch).
pubchem_get_bioactivityGet a compound's bioactivity profile: assay results, targets, and activity values; filter by outcome or molecular target.
pubchem_get_compound_interactionsGet drug-drug, drug-food, and chemical-target interactions for a compound by CID.
pubchem_search_assaysFind bioassays by biological target (gene symbol, protein, Gene ID, UniProt accession).
pubchem_get_summaryGet summaries for PubChem entities: assays, genes, proteins, taxonomy.

pubchem_search_compounds

Search PubChem for chemical compounds across five search modes.

  • Identifier lookup โ€” resolve compound names, SMILES, or InChIKeys to CIDs (batch up to 25)
  • Formula search โ€” find compounds by molecular formula in Hill notation
  • Substructure/superstructure โ€” find compounds containing or contained within a query structure
  • 2D similarity โ€” find structurally similar compounds by Tanimoto similarity (configurable threshold)
  • Optionally hydrate results with properties to avoid a follow-up details call

pubchem_get_compound_details

Get detailed compound information by CID.

  • Batches up to 100 CIDs in a single request
  • 27 available properties: molecular weight, SMILES, InChIKey, XLogP, TPSA, complexity, stereo counts, and more
  • Optionally includes textual descriptions (pharmacology, mechanism, therapeutic use) from PUG View
  • Optionally includes all known synonyms (trade names, systematic names, registry numbers)
  • Optionally computes drug-likeness assessment (Lipinski Rule of Five + Veber rules) from fetched properties
  • Optionally fetches pharmacological classification (FDA classes, mechanisms of action, MeSH classes, ATC codes)

pubchem_get_bioactivity

Get a compound's bioactivity profile from PubChem BioAssay.

  • Returns assay outcomes (Active/Inactive/Inconclusive), target info (protein accessions, NCBI Gene IDs), and quantitative values (IC50, EC50, Ki)
  • Filter by outcome and/or a specific molecular target (NCBI Gene ID or protein accession)
  • Caps at 100 results per request (well-studied compounds may have thousands)

pubchem_get_summary

Get descriptive summaries for four PubChem entity types.

  • Assays (AID), genes (Gene ID), proteins (UniProt accession), taxonomy (Tax ID)
  • Up to 10 entities per call
  • Type-specific field extraction for clean, structured output

pubchem_get_compound_interactions

Get a compound's interaction data by CID.

  • Drug-drug interactions (DrugBank), drug-food interactions, and chemical-target binding/activity (BindingDB, ChEMBL, and others)
  • Select which interaction kinds to fetch and cap entries per kind
  • Each entry carries its originating source โ€” coverage is richest for approved drugs

pubchem_get_compound_3d_structure

Get a compound's default 3D conformer by CID.

  • format="json" returns parsed atoms (element + x/y/z) and bonds for direct reasoning; format="sdf" returns raw V2000 SDF for passthrough to docking or rendering
  • maxAtoms/maxBonds bound the atom/bond preview and includeRawSdf opts into a large raw SDF past the safe line cap; atomCount/bondCount always report the totals and any capping is disclosed
  • Optionally lists alternate conformer IDs
  • Returns a typed not-found when PubChem has no computed 3D coordinates (large molecules, mixtures, some salts)

Resources

Compound and assay records are also exposed as URI-templated MCP resources, backed by the same client methods as the tools:

URI TemplateReturns
pubchem://compound/{cid}Core physicochemical properties (JSON).
pubchem://compound/{cid}/safetyGHS hazard classification (JSON).
pubchem://compound/{cid}/image2D structure diagram (PNG).
pubchem://compound/{cid}/xrefsExternal cross-references (JSON).
pubchem://compound/{cid}/bioactivityBioassay activity profile (JSON).
pubchem://assay/{aid}BioAssay summary (JSON).

Features

Built on @cyanheads/mcp-ts-core:

  • Declarative tool definitions โ€” single file per tool, framework handles registration and validation
  • Unified error handling across all tools
  • Pluggable auth (none, jwt, oauth)
  • Swappable storage backends: in-memory, filesystem, Supabase, Cloudflare KV/R2/D1
  • Structured logging with optional OpenTelemetry tracing
  • Runs locally (stdio/HTTP) or containerized via Docker

PubChem-specific:

  • Rate-limited client for PUG REST and PUG View APIs (5 req/s with automatic queuing)
  • Retry with exponential backoff on 5xx errors and network failures
  • All tools are read-only and idempotent โ€” no API keys required

Project Structure

DirectoryPurpose
src/mcp-server/tools/definitions/Tool definitions (*.tool.ts).
src/services/pubchem/PubChem API client with rate limiting and response parsing.
scripts/Build, clean, devcheck, and tree generation scripts.

Development Guide

See CLAUDE.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches โ€” no try/catch in tool logic
  • Use ctx.log for domain-specific logging
  • Register new tools in the index.ts barrel file