# pubmed-mcp-server

Search PubMed and Europe PMC, retrieve article details and available full text, and format references through an MCP-enabled coding agent.

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

## What it does

The server gives an agent tools to search biomedical papers, retrieve abstracts and metadata, find related articles, and convert DOI, PMID, and PMCID identifiers. It can also look up MeSH vocabulary, correct PubMed queries, and format references as APA, MLA, BibTeX, RIS, or Vancouver.

For full-text retrieval, provide a DOI, PMID, or PMCID. The server checks PMC, Europe PMC, then Unpaywall; access through Unpaywall requires the `UNPAYWALL_EMAIL` environment variable. Results can include sections, tables, and figures, and response size can be limited.

In Claude Code, connect to the hosted HTTP endpoint or run the package locally with `npx`. Local setup accepts environment variables. Without `UNPAYWALL_EMAIL`, the Unpaywall source cannot be used for full-text retrieval.

## Requirements
- Needs: Node.js (commands run via npx)
- Remote server: `https://pubmed.caseyjhand.com/mcp`
- Environment variables: `MCP_LOG_LEVEL`, `NCBI_API_KEY`, `NCBI_ADMIN_EMAIL`, `UNPAYWALL_EMAIL`, `MCP_TRANSPORT_TYPE`, `MCP_HTTP_HOST`, `MCP_HTTP_PORT`, `MCP_HTTP_ENDPOINT_PATH`, `MCP_PUBLIC_URL`, `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 pubmed-mcp-server https://pubmed.caseyjhand.com/mcp
```

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

### Codex

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

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

### Cursor

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

### GitHub Copilot

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

### Gemini CLI

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

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

## When to use it
- search PubMed with a topic and filters
- retrieve article details from a PMID
- look for full text using a DOI or PMCID
- format references as BibTeX or Vancouver
- convert a DOI to a PMID or PMCID

## Example prompts
- Search PubMed for studies on this topic and narrow the results by publication date.
- Get the abstract, authors, and MeSH terms for PMID 12345678.
- Format these papers as BibTeX and check for available full text.

## 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
