PU

PubMed MCP Server: AI Search, Access, Analysis

Enable AI assistants to search, access, and analyze PubMed articles with the MCP server for fast, simple AI-driven literature retrieval and analysis.

Quick Install
npx -y @JackKuo666/PubMed-MCP-Server

Overview

The PubMed MCP Server provides an MCP (Model Context Protocol)–compatible backend that enables AI assistants to search, retrieve, and analyze PubMed literature programmatically. It wraps PubMed/E-utilities (or other public biomedical indexes) into a small HTTP service that exposes a set of compact tools AI models can call to perform literature discovery tasks without the model needing to know PubMed APIs directly.

This server is useful when building assistants, chatbots, or pipelines that require fast access to biomedical abstracts, metadata, and simple analytic operations (summaries, citation extraction, evidence snippets). By exposing a consistent, tool-oriented API, the PubMed MCP Server makes it straightforward to integrate literature retrieval into MCP-compatible agents and to limit the information returned to the model for safer, more controlled context construction.

Features

  • Expose PubMed search and fetch operations as MCP-compatible tool endpoints
  • Return structured article metadata (PMID, title, authors, journal, DOI, abstract)
  • Simple summarization and excerpting utilities for abstracts and results
  • Support for pagination, filters (date, author, journal), and relevance sorting
  • Optional API key configuration for NCBI/E-utilities
  • Lightweight server intended for local or containerized deployment
  • Designed for easy integration with AI agents and pipelines

GitHub: https://github.com/JackKuo666/PubMed-MCP-Server

Installation / Configuration

Clone the repository and run the server. The example assumes a Node.js implementation; adjust commands if your environment uses a different runtime.

# clone
git clone https://github.com/JackKuo666/PubMed-MCP-Server.git
cd PubMed-MCP-Server

# install dependencies (Node.js example)
npm install

# configure environment variables
export PORT=8080
# Optional: get an NCBI API key to increase rate limits
export NCBI_API_KEY=your_ncbi_api_key_here

# start server
npm start

Alternatively, run with Docker:

docker build -t pubmed-mcp-server .
docker run -p 8080:8080 -e NCBI_API_KEY=your_key pubmed-mcp-server

Configuration options (typical environment variables):

  • PORT — HTTP port to listen on (default: 8080)
  • NCBI_API_KEY — optional NCBI E-utilities API key
  • MAX_RESULTS — max results per search page

Available Tools / Resources

The server exposes a small set of HTTP endpoints that map to discrete MCP tools. Below is a representative table; refer to the server’s /openapi or /tools endpoint for the live tool list.

EndpointMethodQuery / BodyPurpose
/searchGETq, page, size, sort, from, toSearch PubMed and return a list of matching PMIDs and brief metadata
/fetchGETpmidFetch detailed metadata and abstract for a given PMID
/summaryPOST{ pmids: [], max_sentences }Produce concise summaries for one or more articles
/extractPOST{ pmid, sections }Extract specific sections or evidence snippets (e.g., methods, results)
/toolsGETList available MCP-compatible tool descriptors (for agents)

Simple example: search for COVID-19 vaccine studies

curl "http://localhost:8080/search?q=COVID-19+vaccine&size=10"

Fetch a single article by PMID

curl "http://localhost:8080/fetch?pmid=34567890"

The /tools endpoint typically returns JSON tool manifests suitable for MCP clients.

Use Cases

  • AI Research Assistant: Let an MCP-compatible assistant call /search to find recent studies, then /fetch and /summary to present a concise, referenced answer with PMIDs and short evidence snippets.
  • Rapid Literature Triage: Use the server in screening pipelines to fetch abstracts for batches of PMIDs, apply minimal summarization, and prioritize articles for human review.
  • Systematic Review Support: Automate retrieval of metadata and abstracts for extracted PMIDs; feed summaries into human-in-the-loop selection.
  • Monitoring & Alerts: Periodically run targeted searches (author, keyword, date window) and send summarized digests when new relevant articles appear.
  • Evidence Extraction for Clinical QA: Extract results or methods snippets from fetched abstracts to surface supporting text for model-generated claims.

Integration tips

  • Rate limiting: If you expect many requests, obtain an NCBI API key and add server-side caching to avoid repeated calls for the same PMIDs.
  • Privacy & provenance: Always attach PMIDs, titles, and source links to AI outputs so users can verify the original literature.
  • MCP compatibility: Use the /tools manifest to let agents discover tool signatures dynamically; wrap each endpoint as an atomic tool (search, fetch, summarize). Provide clear schemas for inputs and outputs to reduce hallucination risk.

Troubleshooting

  • No results: Verify your query encoding, date filters, and that the NCBI service is reachable.
  • Rate limit errors: Add NCBI_API_KEY or implement retry/backoff.
  • Missing full text: PubMed may not host full text; fetch returns abstracts and links to publishers or PubMed Central when available.

For the latest documentation, examples, and source code, see the project repository: https://github.com/JackKuo666/PubMed-MCP-Server.

Tags:search