pubchem-mcp-server logo

pubchem-mcp-server

Community
cyanheads

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

Publishercyanheads
Repositorypubchem-mcp-server
LanguageTypeScript
Forks
3
Stars
8
Available tools
8
Transport typestdio
Categories
LicenseApache-2.0
Links
  • Connect tools to AI workflows

    pubchem-mcp-server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 8 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    8 stars and 3 forks from the linked repository.

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:

json
{
  "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):

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

Prerequisites

Installation

  1. Clone the repository:
sh
git clone https://github.com/cyanheads/pubchem-mcp-server.git
  1. Navigate into the directory:
sh
cd pubchem-mcp-server
  1. Install dependencies:
sh
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:

    sh
    bun run rebuild
    bun run start:stdio   # or start:http
  • Run checks and tests:

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

Docker

sh
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:

sh
bun run devcheck
bun run test

License

Apache-2.0 — see LICENSE for details.

Installation

TypingMind
Prerequisites:

Node.js 18+

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

Available Tools

  • 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.)

  • pubchem_get_bioactivity

    Get a compound's bioactivity profile: assay results, targets, and activity values

  • pubchem_search_assays

    Find bioassays by biological target (gene symbol, protein, Gene ID, UniProt accession)

  • pubchem_get_summary

    Get summaries for PubChem entities: assays, genes, proteins, taxonomy

Use pubchem-mcp-server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once pubchem-mcp-server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add pubchem-mcp-server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the pubchem-mcp-server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "pubchem-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@cyanheads/pubchem-mcp-server"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the pubchem-mcp-server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the pubchem-mcp-server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use pubchem-mcp-server to help me with this task?
pubchem-mcp-server
Sure. I read it.
Here is what I found using pubchem-mcp-server.

Frequently asked questions

What is the pubchem-mcp-server MCP server used for?

pubchem-mcp-server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use pubchem-mcp-server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use pubchem-mcp-server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use pubchem-mcp-server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With pubchem-mcp-server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect pubchem-mcp-server MCP to TypingMind?

pubchem-mcp-server runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does pubchem-mcp-server MCP provide in TypingMind?

pubchem-mcp-server exposes 8 MCP tools that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use pubchem-mcp-server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If pubchem-mcp-server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇