The PubMed MCP Server integrates with PubMed's biomedical literature database, enabling AI agents and research tools to search, retrieve, analyze, and visualize scientific publications:
Search PubMed Articles: Query articles using keywords, filters, date ranges, and sorting options
Fetch PubMed Content: Retrieve article information by PMID or search history, with customizable detail levels (abstract, full XML, MEDLINE text) and pagination
Find Related Articles: Identify similar articles, citations, or references to a given PMID
Generate Citations: Create formatted citations in RIS, BibTeX, APA, or MLA styles
Generate Research Plans: Create structured JSON research plans with detailed inputs
Visualize Data: Generate customizable charts (bar, line, scatter) from publication metadata as PNG images
Automate Research Workflows: Programmatically access PubMed data for AI-driven research and evidence-based decision-making
Integrate with NCBI APIs: Leverage NCBI E-utilities with built-in error handling and rate limit compliance
Connects AI agents to NCBI's PubMed and E-utilities, enabling search, retrieval, and analysis of biomedical literature. Provides tools for searching articles, fetching detailed content, finding related articles, generating citations, creating research plans, and visualizing data through charts.
Generates SVG chart visualizations from PubMed data, supporting bar, line, and scatter chart types for data representation.
Built with TypeScript for type safety and robust input validation, ensuring secure and reliable interactions with PubMed's biomedical data.
Utilizes Vega-Lite specifications to render SVG charts from PubMed data, enabling visualization of biomedical research trends and statistics.
Processes PubMed article data in XML format, providing JSON representation of the PubMedArticle XML structure through the fetch_pubmed_content tool.
Uses Zod for schema validation of inputs and outputs when interacting with PubMed, ensuring type safety and proper data formatting.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PubMed MCP Serversearch for recent articles about CRISPR gene editing in cancer therapy"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Tools
Seven tools for working with PubMed and NCBI data:
Tool | Description |
| Search PubMed with full query syntax, field-specific filters, date ranges, pagination, and optional brief summaries |
| Fetch full article metadata by PMIDs — abstract, authors, journal, MeSH terms, grants |
| Fetch full-text articles from PubMed Central — body sections, references, and metadata for open-access articles |
| Generate formatted citations in APA 7th, MLA 9th, BibTeX, or RIS |
| Find similar articles, citing articles, or references for a given PMID |
| Spell-check biomedical queries using NCBI's ESpell service |
| Search and explore MeSH vocabulary — tree numbers, scope notes, entry terms |
pubmed_search
Search PubMed with full NCBI query syntax and filters.
Free-text queries with PubMed's full boolean and field-tag syntax
Field-specific filters: author, journal, MeSH terms, language, species
Common filters: has abstract, free full text
Date range filtering by publication, modification, or Entrez date
Publication type filtering (Review, Clinical Trial, Meta-Analysis, etc.)
Sort by relevance, publication date, author, or journal
Pagination via offset for paging through large result sets
Optional brief summaries for top N results via ESummary
pubmed_fetch
Fetch full article metadata by PubMed IDs.
Batch fetch up to 200 articles at once (auto-switches to POST for large batches)
Returns structured data: title, abstract, authors with deduplicated affiliations, journal info, DOI
Direct links to PubMed and PubMed Central (when available)
Optional MeSH terms, grant information, and publication types
Handles PubMed's inconsistent XML (structured abstracts, missing fields, varying date formats)
pubmed_pmc_fetch
Fetch full-text articles from PubMed Central (PMC).
Accepts PMC IDs directly or PubMed IDs (auto-resolved to PMCIDs via ELink)
Returns complete article body text organized by sections and subsections
Optional reference list from back matter
Section filtering by title (case-insensitive match, e.g.
["methods", "results"])Configurable max sections to limit response size
Up to 10 articles per request
Only open-access articles available in PMC will return full text
pubmed_cite
Generate formatted citations for articles.
Four citation styles: APA 7th, MLA 9th, BibTeX, RIS
Request multiple styles per article in a single call
Hand-rolled formatters — zero external dependencies, fully Workers-compatible
Up to 50 articles per request
pubmed_related
Find articles related to a source article via ELink.
Three relationship types:
similar(content similarity),cited_by,referencesResults enriched with title, authors, publication date, and source via ESummary
Similarity scores included for
similarrelationship type
pubmed_spell
Spell-check a biomedical query using NCBI's ESpell.
Returns the original query, corrected query, and whether a suggestion was found
Useful for query refinement before searching
pubmed_mesh_lookup
Search and explore the MeSH (Medical Subject Headings) vocabulary.
Search MeSH terms by name with exact-heading matching
Detailed records with tree numbers, scope notes, and entry terms by default
Useful for building precise PubMed queries with controlled vocabulary
Related MCP server: MedAdapt Content Server
Resource and prompt
Type | Name | Description |
Resource |
| PubMed database metadata via EInfo (field list, record count, last update) |
Prompt |
| Generate a structured 4-phase biomedical research plan outline |
Features
Built on mcp-ts-template 3.0:
Declarative tool definitions — single file per tool, framework handles registration and validation
Unified
McpErrorerror handling across all toolsPluggable auth (
none,jwt,oauth)Swappable storage backends:
in-memory,filesystem,Supabase,Cloudflare KV/R2/D1Structured logging (Pino) with optional OpenTelemetry tracing
Typed DI container with
Token<T>phantom brandingRuns locally (stdio/HTTP) or on Cloudflare Workers from the same codebase
PubMed-specific:
Complete NCBI E-utilities integration (ESearch, EFetch, ESummary, ELink, ESpell, EInfo)
Sequential request queue with configurable delay for NCBI rate limit compliance
NCBI-specific XML parser with
isArrayhints for PubMed's inconsistent XML structureHand-rolled citation formatters (APA, MLA, BibTeX, RIS) — zero deps, Workers-compatible
Getting started
Public Hosted Instance
A public instance is available at https://pubmed.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"pubmed": {
"type": "streamable-http",
"url": "https://pubmed.caseyjhand.com/mcp"
}
}
}Self-Hosted / Local
Add the following to your MCP client configuration file.
{
"mcpServers": {
"pubmed": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/pubmed-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"NCBI_API_KEY": "your-key-here"
}
}
}
}Or with npx (no Bun required):
{
"mcpServers": {
"pubmed": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/pubmed-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"NCBI_API_KEY": "your-key-here"
}
}
}
}Or with Docker:
{
"mcpServers": {
"pubmed": {
"type": "stdio",
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/pubmed-mcp-server:latest"]
}
}
}For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3017 bun run start:http
# Server listens at http://localhost:3017/mcpPrerequisites
Bun v1.3.2 or higher.
Optional: NCBI API key for higher rate limits (10 req/s vs 3 req/s).
Installation
Clone the repository:
git clone https://github.com/cyanheads/pubmed-mcp-server.gitNavigate into the directory:
cd pubmed-mcp-serverInstall dependencies:
bun installConfiguration
All configuration is centralized and validated at startup in src/config/index.ts. Key environment variables:
Variable | Description | Default |
| Transport: |
|
| HTTP server port |
|
| Authentication: |
|
| Log level ( |
|
| Storage backend: |
|
| NCBI API key for higher rate limits (10 req/s vs 3 req/s) | none |
| Contact email sent with NCBI requests (recommended by NCBI) | none |
| Delay between NCBI requests in ms | 334 (100 with key) |
| Retry attempts for failed NCBI requests | 3 |
| NCBI request timeout in ms | 30000 |
| Enable OpenTelemetry |
|
Running the server
Local development
Build and run the production version:
# One-time build bun run rebuild # Run the built server bun run start:http # or bun run start:stdioRun checks and tests:
bun run devcheck # Lints, formats, type-checks, and more bun run test # Runs the test suite
Cloudflare Workers
Build the Worker bundle:
bun run build:workerRun locally with Wrangler:
bun run deploy:devDeploy to Cloudflare:
bun run deploy:prod
Project structure
Directory | Purpose |
| Tool definitions ( |
| Resource definitions. Database info resource. |
| Prompt definitions. Research plan prompt. |
| HTTP and stdio transports, including auth middleware. |
| NCBI E-utilities service layer — API client, queue, parser, formatter. |
|
|
| DI container registrations and tokens. |
| Logging, error handling, security, parsing, formatting, telemetry. |
| Environment variable parsing and validation with Zod. |
| NCBI E-utilities DTD files — XML schema definitions for ESearch, EFetch, ESummary, ELink, ESpell, EInfo, and PubMed article XML. |
| NCBI reference material (E-utilities help manual). |
| Unit and integration tests, mirroring the |
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
Logic throws
McpError, handlers catch — notry/catchin tool logicPass
RequestContextthrough the call stack for logging and tracingRegister new tools and resources in the
index.tsbarrel files
Contributing
Issues and pull requests are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.