pubchem-mcp-server

pubchem-mcp-server

cyanheads

Access PubChem chemical database via MCP: search compounds, get properties, safety data, bioactivity, and cross-referenc

MCP server providing access to the PubChem chemical database for searching compounds, fetching properties, safety data, bioactivity, and cross-references.

8427 views2Local (stdio)

About pubchem-mcp-server

pubchem-mcp-server is a community-built MCP server published by cyanheads that provides AI assistants with tools and capabilities via the Model Context Protocol. Access PubChem chemical database via MCP: search compounds, get properties, safety data, bioactivity, and cross-referenc It is categorized under browser automation. This server exposes 8 tools that AI clients can invoke during conversations and coding sessions.

How to install

You can install pubchem-mcp-server in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

License

pubchem-mcp-server is released under the Apache-2.0 license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.

Tools (8)

pubchem_search_compounds

Search for compounds by name, SMILES, InChIKey, formula, substructure, superstructure, or 2D similarity

pubchem_get_compound_details

Get physicochemical properties, descriptions, synonyms, drug-likeness, and classification for compounds by CID

pubchem_get_compound_image

Fetch a 2D structure diagram (PNG) for a compound by CID

pubchem_get_compound_safety

Get GHS hazard classification and safety data for a compound

pubchem_get_compound_xrefs

Get external database cross-references (PubMed, patents, genes, proteins, etc.)

@cyanheads/pubchem-mcp-server

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

8 Tools

Version Framework MCP SDK License TypeScript Bun

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


Tools

Eight 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_safetyGet GHS hazard classification and safety data for a compound.
pubchem_get_compound_xrefsGet external database cross-references (PubMed, patents, genes, proteins, etc.).
pubchem_get_bioactivityGet a compound's bioactivity profile: assay results, targets, and activity values.
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 to focus on active results
  • 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

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

Getting Started

Public Hosted Instance

A public instance is available at https://pubchem.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:

{
  "mcpServers": {
    "pubchem": {
      "type": "streamable-http",
      "url": "https://pubchem.caseyjhand.com/mcp"
    }
  }
}

Self-Hosted / Local

Add to your MCP client config (e.g., claude_desktop_config.json):

{
  "mcpServers": {
    "pubchem": {
      "type": "stdio",
      "command": "bunx",
      "args": ["@cyanheads/pubchem-mcp-server@latest"],
      "env": {
        "MCP_TRANSPORT_TYPE": "stdio"
      }
    }
  }
}

Prerequisites

Installation

  1. Clone the repository:
git clone https://github.com/cyanheads/pubchem-mcp-server.git
  1. Navigate into the directory:
cd pubchem-mcp-server
  1. Install dependencies:
bun install

Configuration

No API keys are required — PubChem's API is freely accessible.

VariableDescriptionDefault
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_HTTP_PORTPort for HTTP server.3010
MCP_HTTP_HOSTHost for HTTP server.localhost
MCP_AUTH_MODEAuth mode: none, jwt, or oauth.none
MCP_LOG_LEVELLog level (RFC 5424).info
STORAGE_PROVIDER_TYPEStorage backend.in-memory
OTEL_ENABLEDEnable OpenTelemetry.false

Running the Server

Local Development

  • Build and run the production version:

    bun run build
    bun run start:http   # or start:stdio
    
  • Run in dev mode (auto-reload):

    bun run dev:stdio    # or dev:http
    
  • Run checks and tests:

    bun run devcheck     # Lints, formats, type-checks
    bun run test         # Runs test suite
    

Docker

docker build -t pubchem-mcp-server .
docker run -p 3010:3010 pubchem-mcp-server

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

Contributing

Issues and pull requests are welcome. Run checks before submitting:

bun run devcheck
bun run test

License

Apache-2.0 — see LICENSE for details.

Alternatives

Related Skills

Browse all skills
notebooklm

Query Google NotebookLM for source-grounded, citation-backed answers from uploaded documents. Reduces hallucinations through Gemini's document-only responses. Browser automation with library management and persistent authentication.

142
dev-browser

Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.

38
chrome-devtools

Browser automation, debugging, and performance analysis using Puppeteer CLI scripts. Use for automating browsers, taking screenshots, analyzing performance, monitoring network traffic, web scraping, form automation, and JavaScript debugging.

29
qa-tester

"Browser automation QA testing skill. Systematically tests web applications for functionality, security, and usability issues. Reports findings by severity (CRITICAL/HIGH/MEDIUM/LOW) with immediate alerts for critical failures."

23
browser-automation

Automate web browser interactions using natural language via CLI commands. Use when the user asks to browse websites, navigate web pages, extract data from websites, take screenshots, fill forms, click buttons, or interact with web applications. Triggers include "browse", "navigate to", "go to website", "extract data from webpage", "screenshot", "web scraping", "fill out form", "click on", "search for on the web". When taking actions be as specific as possible.

21
playwright-browser-automation

Complete browser automation with Playwright. Auto-detects dev servers, writes clean test scripts to /tmp. Test pages, fill forms, take screenshots, check responsive design, validate UX, test login flows, check links, automate any browser task. Use when user wants to test websites, automate browser interactions, validate web functionality, or perform any browser-based testing.

13