Logo von pubchem-mcp-server

pubchem-mcp-server

Community
cyanheads

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

Herausgebercyanheads
Repositorypubchem-mcp-server
SpracheTypeScript
Forks
3
Sterne
9
Verfügbare Tools
8
Transporttypstdio
Kategorien
LizenzApache-2.0
Links
  • Tools mit KI-Workflows verbinden

    pubchem-mcp-server stellt MCP-Funktionen bereit, die kompatible KI-Clients und Agenten nutzen können.

  • 8 verfügbare Tools

    Sehen Sie sich unten die aufrufbaren Aktionen an, einschließlich Namen und Beschreibungen, sofern der Server diese bereitstellt.

  • Konfiguration zum Kopieren

    Nutzen Sie die Installationsbeispiele, um diesen Server in Ihrem bevorzugten MCP-Client zu konfigurieren.

  • Open-Source-Kennzahlen

    9 Sterne und 3 Forks im verlinkten Repository.

Version License Docker MCP SDK npm TypeScript Bun

Install in Claude Desktop Install in Cursor Install in VS Code

Framework

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


Overview

Chemical compound and bioassay data from PubChem's PUG REST and PUG View APIs. Search compounds by identifier, formula, or structure; fetch physicochemical properties, safety data, bioactivity, interactions, cross-references, and 3D structures; find bioassays by biological target. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.

Tools

ToolDescription
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.

Resources

Compound and assay records are also exposed as URI-templated resources, backed by the same client methods as the tools; many MCP clients are tool-only and never surface resources.

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

Capability reference

pubchem_search_compounds tool

  • Five search strategies: identifier (name/SMILES/InChIKey, batched 1-25), formula (Hill notation, optional allowOtherElements), substructure/superstructure containment, or 2D Tanimoto similarity (threshold 70-100, default 90)
  • Caps at 200 CIDs per page (default 20); offset pages to a ceiling of 10,000 — identifier lookups resolve every match up front so paging is free, while formula/structure/similarity searches cost more upstream per deep page
  • Optional properties hydration avoids a follow-up pubchem_get_compound_details call
  • Identifier mode reports unresolvedIdentifiers for inputs that resolved to no CID, plus notices when multiple inputs collide on one CID
  • Reports an exact totalFound when the full match set was observed, or a totalFoundAtLeast floor when a bounded upstream search saturated

pubchem_get_compound_details tool

  • Up to 100 CIDs per call; 27 available properties, defaulting to a core set of 14 (formula, weight, IUPAC name, SMILES forms, InChIKey, XLogP, TPSA, H-bond/rotatable-bond counts, heavy atom count, charge, complexity)
  • Optional textual descriptions, paged via descriptionOffset/maxDescriptions (default 3, up to 20) — fetched only for the first 10 CIDs in the batch, remaining CIDs listed in skippedCids
  • Optional synonyms for every found CID, paged via synonymOffset/maxSynonyms (default 20, up to 100)
  • Optional drug-likeness assessment (Lipinski Rule of Five + Veber rules), computed from the returned properties at no extra latency
  • Optional pharmacological classification (FDA classes/mechanisms, MeSH classes, ATC codes) — same 10-CID fan-out cap as descriptions
  • Per-CID found: false distinguishes a nonexistent CID from a real compound PubChem simply has no data for

pubchem_get_compound_image tool

  • Single CID; size is "small" (100x100) or "large" (300x300, default)
  • Returns base64-encoded PNG plus width/height
  • Typed cid_not_found error when PubChem has no record for the CID

pubchem_get_compound_3d_structure tool

  • Single CID; format="json" (default) returns parsed atoms (element + x/y/z) and bonds, format="sdf" returns the raw V2000 SDF text
  • maxAtoms/maxBonds cap the JSON preview (default 200 each); atomCount/bondCount always report the full totals, with any capping disclosed via enrichment
  • includeRawSdf bypasses the default 500-line cap on the raw SDF text
  • Optional includeAlternateConformerIds lists conformer IDs beyond the default
  • Typed no_3d_structure error when PubChem has no computed 3D coordinates (large molecules, mixtures, some salts)

pubchem_get_compound_xrefs tool

  • Single CID; one or more xrefTypes — string IDs (RegistryID, RN for CAS numbers, PatentID) and numeric IDs (PubMedID, GeneID, ProteinGI, TaxonomyID)
  • Paged per type: maxPerType up to 500 (default 50), with the same offset applied across every requested type
  • Each type reports its own totalAvailable and truncated flag
  • Empty-result notice distinguishes "this compound has none of the requested types" from a possibly-mistyped CID

pubchem_get_compound_safety tool

  • Batch of 1-25 CIDs
  • Returns GHS signal word, pictograms, hazard statements (H-codes), and precautionary statements (P-codes), with source attribution
  • Per-CID status: ok, no_ghs_data (compound exists, no deposited classification), or cid_not_found (no PubChem record at all) — kept distinct so a bad CID never reads as "no hazards on file"
  • Precautionary statements carry a decoded flag — false for codes needing label-specific fill text or outside the decoder table; the code itself is still authoritative

pubchem_get_bioactivity tool

  • Single CID; filter by outcomeFilter (active/inactive/all, default all) and/or targetGeneId/targetAccession
  • Caps at 100 results per page (default 20); offset reaches the rest
  • Reports totalAssays/activeCount/inactiveCount for the whole compound, plus filteredCount/returnedCount for the current page
  • Notices distinguish "no bioactivity data at all" from "the filter excluded everything" from "offset past the end"

pubchem_get_compound_interactions tool

  • Single CID; one or more kinds — drug-drug (DrugBank), drug-food, target (binding/activity from BindingDB, ChEMBL, and others); default ["drug-drug"]
  • maxEntries per kind per page (1-50, default 10); offset counts source records rather than returned entries, capped at 2,147,483,646
  • Each kind pages independently — paging[] reports per-kind totalRecords/nextOffset/truncated; the top-level nextOffset is populated only when exactly one requested kind still has records left
  • A kind that fails to retrieve is named in failedKinds without failing the kinds that succeeded

pubchem_search_assays tool

  • Search by targetType: genesymbol/proteinname (text), geneid (NCBI Gene ID), proteinaccession (UniProt)
  • Caps at 200 AIDs per page (default 50); offset pages to the total found
  • Rejects a blank targetQuery and a non-numeric geneid query before the upstream call
  • Reports totalFound across all pages and distinguishes "no match" from "offset past the end"

pubchem_get_summary tool

  • entityType: assay (AID), gene (NCBI Gene ID), protein (UniProt accession), or taxonomy (Tax ID); up to 10 identifiers per call
  • Per-identifier found flag; populated fields depend on entityType (taxonomy includes an ordered lineage, gene includes symbol/taxonomy)
  • Notice reports how many identifiers were not found and which ID type entityType expects

pubchem://compound/{cid} resource

  • Core physicochemical properties (the same default 14-property set as pubchem_get_compound_details), as application/json
  • Throws a typed not-found when the CID doesn't exist in PubChem
  • Use pubchem_get_compound_details to select specific properties or add descriptions, synonyms, drug-likeness, and classification

pubchem://compound/{cid}/safety resource

  • GHS hazard classification as application/json
  • status (ok/no_ghs_data/cid_not_found) is the only signal distinguishing a bad CID from a compound with no deposited classification — a resource read has no notice surface

pubchem://compound/{cid}/image resource

  • 2D structure diagram, 300x300 PNG, returned as a base64 blob
  • Use pubchem_get_compound_image for the 100x100 size option

pubchem://compound/{cid}/xrefs resource

  • Focused default set — RN (CAS), RegistryID, PubMedID — up to 25 IDs per type, as application/json
  • Use pubchem_get_compound_xrefs for the full set of xref types, a higher per-type cap, and offset paging

pubchem://compound/{cid}/bioactivity resource

  • Up to 25 assays as application/json, plus totalAssays/activeCount for the whole compound
  • Use pubchem_get_bioactivity to filter by outcome or target, raise the cap, or page with offset

pubchem://assay/{aid} resource

  • BioAssay summary as application/json — name, description, source, protocol, substance counts
  • Throws a typed not-found when the AID doesn't exist

Features

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

PubChem-specific:

  • Covers both PUG REST (search, properties, cross-references, safety, bioactivity, interactions) and PUG View (textual descriptions, pharmacological classification) endpoints
  • Rate-limited client (5 req/s) with automatic request queuing, and retry with exponential backoff on 5xx errors and network failures
  • Hand-rolled V2000 SDF parser for 3D conformer atoms and bonds; drug-likeness (Lipinski/Veber) computed from already-fetched properties, adding no extra latency
  • All tools are read-only and idempotent — no API keys required, PubChem's API is freely accessible

Agent-friendly output:

  • Discriminated output contracts — per-CID status (ok / no_ghs_data / cid_not_found) and found flags let callers branch on data instead of matching an error string
  • Graceful partial failure — batch tools return per-item results alongside unresolvedIdentifiers, skippedCids, and failedKinds rather than failing the whole call
  • Response shaping — truncation disclosure (truncated, shown/cap, nextOffset) on every capped list, plus a totalFoundAtLeast floor in place of a count when an upstream search saturates
  • Typed error reasons — validation and not-found failures declare a reason (e.g. cid_not_found, missing_identifier_args, invalid_cid_query) with actionable recovery text, not generic messages

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-mcp-server": {
      "type": "streamable-http",
      "url": "https://pubchem.caseyjhand.com/mcp"
    }
  }
}

Self-Hosted / Local

Add the following to your MCP client configuration file.

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

Or with npx (no Bun required):

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

Or with Docker:

json
{
  "mcpServers": {
    "pubchem-mcp-server": {
      "type": "stdio",
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/pubchem-mcp-server:latest"]
    }
  }
}

For Streamable HTTP, set the transport and start the server:

sh
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcp

Prerequisites

  • Bun v1.4.0 or higher (or Node.js v24+).
  • No API keys required — PubChem's API is freely accessible.

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
  1. Configure environment (optional):
sh
cp .env.example .env
# edit .env to override transport, session mode, storage, or logging defaults

Configuration

VariableDescriptionDefault
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_HTTP_PORTPort for HTTP server.3010
MCP_HTTP_HOSTHost for HTTP server.127.0.0.1
MCP_SESSION_MODEstateless, stateful, or auto. PubChem needs no multi-round-trip input, so the server declares stateless; the example and Docker set it to match.stateless
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

See .env.example for the full list of optional overrides.

Running the server

Local development

  • Build and run:

    sh
    # One-time build
    bun run rebuild
    
    # Run the built server
    bun run start:stdio
    # or
    bun run start:http
  • Run checks and tests:

    sh
    bun run devcheck   # Lint, format, typecheck, security
    bun run test       # Vitest test suite
    bun run lint:mcp   # Validate MCP definitions against spec

Docker

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

The Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/pubchem-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.

Project structure

DirectoryPurpose
src/index.tscreateApp() entry point — registers tools/resources and inits the PubChem client.
src/mcp-server/tools/definitions/Tool definitions (*.tool.ts).
src/mcp-server/resources/definitions/Resource definitions (*.resource.ts).
src/services/pubchem/PubChem API client — rate limiting, retry, and response/SDF parsing.
scripts/Build, clean, devcheck, and tree generation scripts.
tests/Unit and integration tests.

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 request-scoped logging
  • Wrap external API calls: validate the raw PubChem response → normalize to a domain type → return the output schema; never fabricate missing fields
  • Register new tools and resources in the index.ts barrel files

Contributing

Issues are welcome. Run checks before submitting:

sh
bun run devcheck
bun run test

License

Apache-2.0 — see LICENSE for details.

Installation

TypingMind
Voraussetzungen:

Node.js 18+

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

Verfügbare 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

pubchem-mcp-server MCP mit mehreren KI-Modellen nutzen

TypingMind bindet MCP-Tools auf Arbeitsbereichsebene ein. Sobald pubchem-mcp-server verbunden ist, können Sie die Integration mit verschiedenen KI-Modellen in TypingMind verwenden, statt sie für jedes Modell separat einzurichten. Diese MCP-Integration läuft lokal über den TypingMind-MCP-Konnektor auf Ihrem Gerät.

Einrichtungsanleitung für den lokalen Konnektor

Nutzen Sie diese Option, wenn der MCP-Server Zugriff auf lokale Dateien, Apps oder private Ressourcen auf Ihrem Computer benötigt.

1

MCP-Einstellungen öffnen

Gehen Sie in TypingMind zu „Einstellungen“, „Erweiterte Einstellungen“ und dann „Model Context Protocol“ und wählen Sie „Konnektor-Setup“.

  1. Öffnen Sie TypingMind in Ihrem Browser.
  2. Klicken Sie auf das Symbol „Optionen“.
  3. Gehen Sie zu „Erweiterte Einstellungen“.
  4. Öffnen Sie den Abschnitt „Model Context Protocol“.
  5. Klicken Sie auf „Konnektor-Setup“ und wählen Sie „Dieses Gerät“.
Einrichtungsbildschirm des TypingMind-MCP-Konnektors mit ausgewählter Option „Dieses Gerät“
2

Konnektor-Befehl ausführen

Wählen Sie „Dieses Gerät“, kopieren Sie den Befehl aus TypingMind und führen Sie ihn im Terminal aus. Lassen Sie den Prozess laufen, solange Sie MCP verwenden.

  1. Kopieren Sie den in TypingMind angezeigten Einrichtungsbefehl.
  2. Öffnen Sie unter macOS Terminal bzw. unter Windows Windows Terminal.
  3. Fügen Sie den Befehl ein und führen Sie ihn aus.
  4. Bestätigen Sie die Paketinstallation, wenn Sie im Terminal zum Fortfahren aufgefordert werden.
  5. Lassen Sie das Terminalfenster geöffnet und den Prozess darin laufen, solange Sie MCP-Tools verwenden.
3

pubchem-mcp-server als Server hinzufügen

Wenn der Konnektorstatus „Bereit“ anzeigt, klicken Sie auf „Server ändern“ und fügen Sie die MCP-Server-Konfiguration ein.

  1. Warten Sie, bis der Konnektorstatus „Bereit“ anzeigt.
  2. Klicken Sie auf „Server ändern“.
  3. Fügen Sie die MCP-Server-Konfiguration für pubchem-mcp-server ein.
  4. Speichern Sie die Serverliste.
  5. Aktualisieren Sie die Ansicht, um bei Bedarf zu prüfen, ob der Konnektor weiterhin bereit ist.
MCP-Einstellungen in TypingMind mit aktivem Server und der Schaltfläche „Server ändern“
{
  "mcpServers": {
    "pubchem-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@cyanheads/pubchem-mcp-server"
      ]
    }
  }
}
4

Verbindung modellübergreifend nutzen

Speichern Sie die Serverliste, öffnen Sie „Plugins“ und aktivieren Sie die MCP-Tools von pubchem-mcp-server. Wählen Sie dann ein beliebiges unterstütztes KI-Modell in TypingMind und verwenden Sie die Tools im Chat oder weisen Sie sie einem KI-Agenten zu.

  1. Öffnen Sie die Seite „Plugins“ in TypingMind.
  2. Aktivieren Sie die MCP-Tools von pubchem-mcp-server.
  3. Starten Sie einen Chat und wählen Sie das KI-Modell, das Sie verwenden möchten.
  4. Nutzen Sie die MCP-Tools im Chat oder weisen Sie sie einem KI-Agenten zu.
  5. Wechseln Sie bei Bedarf zu einem anderen KI-Modell, ohne die MCP-Verbindung erneut herzustellen.
TypingMind-Chat mit aktivierten MCP-Tools und einem ausgewählten KI-Modell
Können Sie mir mit pubchem-mcp-server bei dieser Aufgabe helfen?
pubchem-mcp-server
Gerne. Ich habe es gelesen.
Das habe ich mit pubchem-mcp-server gefunden.

Häufig gestellte Fragen

Wofür wird der MCP-Server pubchem-mcp-server verwendet?

pubchem-mcp-server ist ein MCP-Server, über den kompatible KI-Clients auf externe Tools und Kontext zugreifen können. In TypingMind können Sie diesen MCP-Server einmal hinzufügen und seine Tools in Ihrem KI-Arbeitsbereich verfügbar machen.

Kann ich pubchem-mcp-server MCP mit mehreren KI-Modellen in TypingMind verwenden?

Ja. TypingMind bindet MCP-Tools auf Arbeitsbereichsebene ein. So können Sie pubchem-mcp-server mit verschiedenen KI-Modellen wie Claude, ChatGPT, Gemini oder anderen in TypingMind konfigurierten Modellen verwenden, ohne den MCP-Server für jedes Modell separat einzurichten.

Warum pubchem-mcp-server MCP mit TypingMind nutzen?

TypingMind ist eine der besten Oberflächen für LLM-Chats, da es mehrere KI-Modelle, Prompts, Plugins, KI-Agenten, API-Schlüssel und MCP-Tools in einem Arbeitsbereich vereint. Sobald pubchem-mcp-server verbunden ist, können Sie die zugehörigen MCP-Tools mit Ihren bevorzugten Modellen nutzen und Ihre Chat-Abläufe in TypingMind übersichtlich organisieren.

Wie verbinde ich pubchem-mcp-server MCP mit TypingMind?

pubchem-mcp-server wird über den lokalen MCP-Konnektor von TypingMind angebunden. Das ist die beste Wahl, wenn der MCP-Server auf lokale Dateien, Desktop-Apps, Befehlszeilentools oder private Ressourcen auf Ihrem Computer zugreifen muss.

Welche Tools stellt pubchem-mcp-server MCP in TypingMind bereit?

pubchem-mcp-server stellt 8 MCP-Tools bereit, die Sie auf der Plugins-Seite in TypingMind aktivieren und im Chat verwenden oder KI-Agenten zuweisen können.

Muss ich meine API-Schlüssel mit TypingMind teilen, um pubchem-mcp-server MCP zu verwenden?

Nein. TypingMind arbeitet vorrangig lokal, sodass Sie die Kontrolle über Ihre Modellanbieter, API-Schlüssel, Prompts und MCP-Konfiguration behalten. Falls pubchem-mcp-server eine Authentifizierung erfordert, fügen Sie beim Erstellen der Verbindung die erforderlichen Header, OAuth-Einstellungen oder die lokale Konfiguration für diesen MCP-Server hinzu.

Ähnliche MCP-Server

Alle

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇