# pubchem-mcp-server

Pulls PubChem data into your coding agent: compound search, properties, hazard data, bioactivity and 3D structures, all as tool calls.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 10
- Author: cyanheads
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/cyanheads/pubchem-mcp-server
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/pubchem-mcp-server

## What it does

This MCP server puts PubChem behind ten tools. `pubchem_search_compounds` takes a name, SMILES, InChI, InChIKey, Hill formula, substructure, superstructure or a 2D similarity query. From a CID the agent can then grab physicochemical properties and classification, a PNG diagram, 3D conformer coordinates as parsed JSON or raw SDF, cross-references to PubMed, patents, genes and CAS/EC numbers, GHS hazard data for a batch of compounds, and full bioactivity profiles with targets and activity values. Assays are searchable by biological target, and a summary tool covers assays, genes, proteins and taxonomy.

Six URI resources mirror much of this (`pubchem://compound/{cid}/safety` and so on), but plenty of MCP clients ignore resources entirely. If yours does, the tools carry everything. Caps are worth knowing up front: search returns at most 200 CIDs per page, details accept 100 CIDs, descriptions and classification only cover the first 10 CIDs, and paging through formula or structure searches stops at 10 000 with an `offset_ceiling_exceeded` error.

You can use the hosted endpoint at `https://pubchem.caseyjhand.com/mcp` or run it yourself with `npx -y @cyanheads/pubchem-mcp-server`, which needs Node.js. The install commands with `MCP_TRANSPORT_TYPE`, `MCP_SESSION_MODE` and `MCP_HTTP_PORT` carry placeholders. Fill them in before running, otherwise the literal `<...>` values land in your config and the stdio server won't come up.

## Requirements
- Needs: Node.js (commands run via npx)
- Remote server: `https://pubchem.caseyjhand.com/mcp`
- Environment variables: `MCP_LOG_LEVEL`, `MCP_TRANSPORT_TYPE`, `MCP_SESSION_MODE`, `MCP_HTTP_HOST`, `MCP_HTTP_PORT`, `MCP_HTTP_ENDPOINT_PATH`, `MCP_AUTH_MODE` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

1. **Platform CLI: remote server**
```bash
claude mcp add --transport http pubchem-mcp-server https://pubchem.caseyjhand.com/mcp
```

2. **Platform CLI**
```bash
claude mcp add --env MCP_LOG_LEVEL=<MCP_LOG_LEVEL> --env MCP_TRANSPORT_TYPE=<MCP_TRANSPORT_TYPE> --env MCP_SESSION_MODE=<MCP_SESSION_MODE> --env MCP_HTTP_HOST=<MCP_HTTP_HOST> --env MCP_HTTP_PORT=<MCP_HTTP_PORT> --transport stdio pubchem-mcp-server -- npx -y @cyanheads/pubchem-mcp-server
```
Replace <…> with your own values. 2 more environment variables are in the server README

### Codex

1. **Platform CLI: remote server**
```bash
codex mcp add pubchem-mcp-server --url https://pubchem.caseyjhand.com/mcp
```

2. **Platform CLI**
```bash
codex mcp add pubchem-mcp-server --env MCP_LOG_LEVEL=<MCP_LOG_LEVEL> --env MCP_TRANSPORT_TYPE=<MCP_TRANSPORT_TYPE> --env MCP_SESSION_MODE=<MCP_SESSION_MODE> --env MCP_HTTP_HOST=<MCP_HTTP_HOST> --env MCP_HTTP_PORT=<MCP_HTTP_PORT> -- npx -y @cyanheads/pubchem-mcp-server
```
Replace <…> with your own values. 2 more environment variables are in the server README

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "pubchem-mcp-server": {
            "url": "https://pubchem.caseyjhand.com/mcp"
        }
    }
}
```
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "pubchem-mcp-server": {
            "command": "npx",
            "args": [
                "-y",
                "@cyanheads/pubchem-mcp-server"
            ],
            "env": {
                "MCP_LOG_LEVEL": "<MCP_LOG_LEVEL>",
                "MCP_TRANSPORT_TYPE": "<MCP_TRANSPORT_TYPE>",
                "MCP_SESSION_MODE": "<MCP_SESSION_MODE>",
                "MCP_HTTP_HOST": "<MCP_HTTP_HOST>",
                "MCP_HTTP_PORT": "<MCP_HTTP_PORT>"
            }
        }
    }
}
```
Replace <…> with your own values. 2 more environment variables are in the server README

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "pubchem-mcp-server": {
            "type": "http",
            "url": "https://pubchem.caseyjhand.com/mcp"
        }
    }
}
```
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "pubchem-mcp-server": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@cyanheads/pubchem-mcp-server"
            ],
            "env": {
                "MCP_LOG_LEVEL": "<MCP_LOG_LEVEL>",
                "MCP_TRANSPORT_TYPE": "<MCP_TRANSPORT_TYPE>",
                "MCP_SESSION_MODE": "<MCP_SESSION_MODE>",
                "MCP_HTTP_HOST": "<MCP_HTTP_HOST>",
                "MCP_HTTP_PORT": "<MCP_HTTP_PORT>"
            }
        }
    }
}
```
Replace <…> with your own values. 2 more environment variables are in the server README

### Gemini CLI

1. **Platform CLI: remote server**
```bash
gemini mcp add -t http pubchem-mcp-server https://pubchem.caseyjhand.com/mcp
```

2. **Platform CLI**
```bash
gemini mcp add -e MCP_LOG_LEVEL=<MCP_LOG_LEVEL> -e MCP_TRANSPORT_TYPE=<MCP_TRANSPORT_TYPE> -e MCP_SESSION_MODE=<MCP_SESSION_MODE> -e MCP_HTTP_HOST=<MCP_HTTP_HOST> -e MCP_HTTP_PORT=<MCP_HTTP_PORT> pubchem-mcp-server npx -y @cyanheads/pubchem-mcp-server
```
Replace <…> with your own values. 2 more environment variables are in the server README

## When to use it
- find a compound from a SMILES string or InChIKey
- pull every CID matching a molecular formula in Hill notation
- check GHS hazard classes across several compounds at once
- get atom coordinates and bonds for a 3D conformer
- locate bioassays tied to a gene or UniProt accession

## Example prompts
- Search PubChem for compounds with formula C9H8O4 and list their CIDs
- Fetch GHS safety data and synonyms for CID 2244
- Which PubChem assays target the EGFR gene?

## Similar
- [Zotero MCP](https://affpapa.org/en/nevibecode/mcp/zotero-mcp.md) — MCP server · ★ 5548
- [arxiv-mcp-server](https://affpapa.org/en/nevibecode/mcp/arxiv-mcp-server.md) — MCP server · ★ 3231
- [PaperBanana](https://affpapa.org/en/nevibecode/mcp/paperbanana.md) — MCP server · ★ 2417
- [MATLAB MCP Server](https://affpapa.org/en/nevibecode/mcp/matlab-mcp-server.md) — MCP server · ★ 1716
- [Hex Research](https://affpapa.org/en/nevibecode/mcp/hex-research.md) — MCP server · ★ 583
- [DocsAgent — Zotero, Obsidian & Apple Notes MCP Server](https://affpapa.org/en/nevibecode/mcp/docsagent-zotero-obsidian-apple-notes-mcp-server.md) — MCP server · ★ 578

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
