PubMed Advanced MCP Server
Click on "Deploy 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 Advanced MCP Server Search PubMed for clinical trials on Alzheimer's disease"
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.
๐งฌ PubMed Advanced MCP Server
A comprehensive Model Context Protocol (MCP) server that exposes PubMed and PubMed Central research literature APIs as intelligent tools for LLM applications.
Built with โค๏ธ by Suyash Ekhande
Features โข Quick Start โข Tools โข Examples โข Architecture
https://github.com/user-attachments/assets/892978f7-88d8-4b26-992e-41ba87c1b1cf
๐ Features
16 Intelligent Tools organized into 5 categories for comprehensive biomedical literature access
34M+ PubMed Articles - Search across the world's largest biomedical abstract database
7M+ PMC Full-Text Articles - Access complete article content from PubMed Central
Smart Rate Limiting - Automatic compliance with NCBI rate limits (3-10 req/sec)
Cross-Database Linking - Connect articles to genes, proteins, clinical variants, and more
ID Conversion - Seamlessly convert between PMID, PMCID, DOI, and Manuscript IDs
BioC Format Support - Pre-parsed text for NLP and text mining applications
Pipeline Operations - Build complex multi-step queries using Entrez History Server
Batch Processing - Efficiently handle 10K+ articles with chunked operations
Related MCP server: mcp-pubmed
๐ฆ Installation
Prerequisites
Python 3.10 or higher
pip or uv package manager
Install from source
# Clone the repository
git clone https://github.com/yourusername/pubmed-advanced-mcp.git
cd pubmed-advanced-mcp
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Or install as package
pip install -e .Configure API Key (Recommended)
# Copy example environment file
cp .env.example .env
# Edit .env and add your NCBI API key
# Get one at: https://www.ncbi.nlm.nih.gov/account/Note: Without an API key, you're limited to 3 requests/second. With an API key, you get 10 requests/second.
๐ Quick Start
Run the MCP Server
# Using Python directly (Streamable HTTP on port 8000)
python -m src.server
# With custom host/port
MCP_HOST=127.0.0.1 MCP_PORT=9000 python -m src.serverTransport: This server uses Streamable HTTP as the only transport protocol. It runs on
http://0.0.0.0:8000/mcpby default.
Run with Docker
# Build the image
docker build -t pubmed-mcp .
# Run the container
docker run -d -p 8000:8000 --name pubmed-mcp pubmed-mcp
# Run with NCBI API key for higher rate limits
docker run -d -p 8000:8000 -e NCBI_API_KEY=your-api-key pubmed-mcp๐ Available Tools
Category 1: Search & Discovery (5 tools)
Tool | Description | Example Use Case |
| Search 34M+ PubMed abstracts | Find reviews on CAR-T therapy |
| Full-text search in PMC | Search methods sections for protocols |
| MeSH controlled vocabulary search | Find all cancer therapy articles |
| Multi-field Boolean queries | Complex author + topic + date searches |
| Cross-database hit counts | Discover data across NCBI |
Category 2: Document Retrieval (4 tools)
Tool | Description | Example Use Case |
| Get article metadata | Retrieve author and abstract info |
| Get complete article content | Download full PMC articles |
| BioC format for NLP | Text mining and NER tasks |
| Bulk article retrieval | Download 1000+ articles efficiently |
Category 3: Cross-Reference & Linking (3 tools)
Tool | Description | Example Use Case |
| Citation/similarity links | Build citation networks |
| Cross-link to Gene, Protein, etc. | Find genes mentioned in articles |
| Author publication history | Track researcher output |
Category 4: ID Conversion (2 tools)
Tool | Description | Example Use Case |
| Batch ID conversion | Convert DOIs to PMIDs |
| Single ID resolution | Look up article by any ID type |
Category 5: Advanced Operations (2 tools)
Tool | Description | Example Use Case |
| Multi-step query pipelines | Complex research workflows |
| Large-scale processing | Process 10K+ articles |
๐ Usage Examples
Basic Search
User: Find recent reviews about CRISPR gene editing in cancer
AI uses: pubmed_search(
query="CRISPR gene editing cancer",
filters={"publication_types": ["Review"], "publication_date_start": "2023"},
max_results=10
)MeSH-Based Search
User: Find all articles about breast cancer treatment using MeSH terms
AI uses: mesh_term_search(
mesh_term="Breast Neoplasms",
qualifiers=["therapy", "drug therapy"],
explode=True,
max_results=50
)Find Related Articles
User: What articles are similar to PMID 37000000?
AI uses: find_related_articles(
pmid="37000000",
relationship_type="similar",
max_results=20
)Convert Article IDs
User: Convert these DOIs to PMIDs: 10.1038/nature12373, 10.1126/science.1225829
AI uses: convert_article_ids(
ids=["10.1038/nature12373", "10.1126/science.1225829"],
from_type="auto"
)Build a Research Pipeline
User: Find diabetes review articles that are linked to HLA genes
AI uses: build_search_pipeline(
steps=[
{"operation": "search", "database": "pubmed",
"parameters": {"query": "diabetes[mh] AND review[pt]"}},
{"operation": "link", "database": "gene",
"parameters": {"from_db": "pubmed"}}
]
)Batch Processing
User: Get metadata for these 500 PMIDs for my literature review
AI uses: batch_fetch_articles(
pmids=["12345678", "23456789", ...], # 500 IDs
include_metadata=True,
include_abstract=True,
batch_size=100
)๐ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ LLM / AI Agent Client โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
MCP Protocol (Streamable HTTP)
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FastMCP Server (Python) โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ 16 MCP Tools โ โ
โ โ Search โ Retrieval โ Linking โ ID Conversion โ Advanced Ops โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ API Clients (with Rate Limiting) โ โ
โ โ E-Utilities โ BioC API โ ID Converter โ Session Manager โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
HTTP/REST API Calls
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ NCBI E-Utilitiesโ โ BioC APIs โ โ ID Converter โ
โ (34M+ articles) โ โ (29M+ articles) โ โ (200 IDs/batch) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ๐ Project Structure
pubmed-advanced-mcp/
โโโ src/
โ โโโ __init__.py
โ โโโ server.py # FastMCP server with all 16 tools
โ โโโ config.py # Configuration management
โ โ
โ โโโ clients/ # API client modules
โ โ โโโ base.py # Base HTTP client with rate limiting
โ โ โโโ eutilities.py # NCBI E-Utilities client
โ โ โโโ bioc_api.py # BioC text mining API
โ โ โโโ id_converter.py # PMC ID Converter
โ โ โโโ session_manager.py # Entrez History management
โ โ
โ โโโ tools/ # MCP Tool implementations
โ โ โโโ search_tools.py # 5 search tools
โ โ โโโ retrieval_tools.py # 4 retrieval tools
โ โ โโโ linking_tools.py # 3 linking tools
โ โ โโโ id_conversion_tools.py # 2 ID tools
โ โ โโโ advanced_tools.py # 2 advanced tools
โ โ
โ โโโ schemas/ # Pydantic models
โ โ โโโ tool_schemas.py # Input/output schemas
โ โ
โ โโโ utils/ # Utilities
โ โโโ rate_limiter.py # Token bucket rate limiter
โ โโโ query_builder.py # E-utilities query builder
โ โโโ error_handler.py # Custom exceptions
โ
โโโ docs/
โ โโโ implementation/ # Implementation documentation
โ โโโ *.md # Original requirements
โ
โโโ requirements.txt
โโโ pyproject.toml
โโโ .env.example
โโโ README.mdโ๏ธ Configuration
Environment Variables
Variable | Description | Default |
| NCBI API key for higher rate limits | None (3 req/sec) |
| Tool identifier for NCBI |
|
| Contact email (required by NCBI) |
|
Rate Limits
Scenario | Rate Limit |
Without API Key | 3 requests/second |
With API Key | 10 requests/second |
Violation | IP blocked for 24+ hours |
๐ฌ Sample Prompts for LLMs
Here are example prompts you can use with Claude or other LLM clients:
Literature Review
"Find all systematic reviews about COVID-19 vaccine efficacy published in 2023-2024.
Include the abstracts and MeSH terms."Gene-Disease Research
"Search for articles about TP53 mutations in breast cancer. Then link these articles
to related gene records in NCBI Gene database."Author Analysis
"Find all publications by Jennifer Doudna in the last 5 years and summarize
her research focus areas."ID Conversion
"I have these DOIs from my reference manager. Convert them to PMIDs so I can
search for related articles: 10.1038/nature12373, 10.1126/science.1225829"Text Mining Pipeline
"Get the full text of PMC7611378 in BioC format. I need it for named entity
recognition to extract drug names and disease mentions."๐งช Testing
Run Tests
# Install dev dependencies
pip install -e ".[dev]"
# Run all tests
pytest
# Run with verbose output
pytest -v
# Run specific test file
pytest tests/test_search_tools.py๐ API Documentation
E-Utilities Query Syntax
The server supports full E-utilities query syntax:
# Basic search
cancer
# Field-specific search
cancer[ti] # Title
CRISPR[ab] # Abstract
"Zhang F"[au] # Author
Nature[ta] # Journal
# Boolean operators (MUST be uppercase)
cancer AND therapy
cancer OR tumor
cancer NOT lung
# Date ranges
cancer AND 2023[dp] # Year
cancer AND 2020:2024[dp] # Range
# MeSH terms
"Breast Neoplasms"[mh] # MeSH heading
"Neoplasms/therapy"[mh] # With qualifier
# Publication types
review[pt]
clinical trial[pt]๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/AmazingFeature)Commit your changes (
git commit -m 'Add some AmazingFeature')Push to the branch (
git push origin feature/AmazingFeature)Open a Pull Request
Acknowledgments
NCBI for providing the E-utilities and related APIs
FastMCP for the excellent MCP framework
The biomedical research community for their contributions to PubMed
Made with โค๏ธ for the biomedical research community
Built by Suyash Ekhande
Available Tools
16 toolsadvanced_searchA
Build complex Boolean queries with field-specific search.
Provides precise control over search logic with multiple terms, fields, and Boolean operators.
Inputs: query_builder (required), date_field, max_results, date_range_end, +1 more. Returns: object
batch_fetch_articlesA
Efficiently fetch multiple articles with rate limiting.
Handles large batches by chunking requests and respecting NCBI rate limits. Returns both successful and failed retrievals.
Inputs: pmids (required), batch_size, include_abstract, include_metadata. Returns: object
batch_process_articlesB
Process large sets of articles with batch operations.
Handles datasets of 10K+ articles efficiently with chunked processing and rate limiting.
Inputs: input_source (required), operation, batch_config, output_format. Returns: object
build_search_pipelineA
Build and execute a multi-step search pipeline.
Uses Entrez History Server to chain operations efficiently. Ideal for complex queries like: "Find diabetes reviews, then limit to articles linked to HLA genes"
Inputs: steps (required), output_step. Returns: object
convert_article_idsA
Convert article IDs between different formats.
Supports batch conversion (up to 200 IDs) between:
PMID (PubMed ID): e.g., "37000000"
PMCID (PubMed Central ID): e.g., "PMC7611378"
DOI: e.g., "10.1093/nar/gks1195"
Manuscript ID: e.g., "NIHMS1677310"
Inputs: ids (required), from_type, include_versions. Returns: object
fetch_article_summaryA
Fetch detailed article summary and metadata.
Returns comprehensive information including title, authors, abstract, MeSH terms, journal details, DOI, and more.
Inputs: pmid (required), database, include_full_metadata. Returns: object
fetch_bioc_articleA
Fetch article in BioC format for text mining.
BioC provides pre-parsed text ideal for NLP tasks:
Passage-level segmentation (title, abstract, sections)
Sentence-level boundaries
Ready for named entity recognition, relation extraction
Inputs: pmid, pmcid, format. Returns: object
fetch_full_articleA
Fetch complete article content.
For PubMed: Returns abstract and metadata (full text not available). For PMC: Returns full text if article is in PMC Open Access.
Inputs: pmid, pmcid, format. Returns: object
find_citations_by_authorsB
Find all publications by a specific author.
Inputs: author_name (required), max_results, date_range_end, date_range_start. Returns: object
global_searchA
Search across all NCBI databases to find data availability.
Returns hit counts for 38+ NCBI databases, helping identify which databases have relevant data for your query.
Inputs: query (required), databases. Returns: object
link_to_databasesA
Find records in other NCBI databases linked to an article.
Maps from literature to biological knowledge bases.
Inputs: pmid (required), target_databases (required). Returns: object
mesh_term_searchB
Search using MeSH controlled vocabulary terms.
MeSH (Medical Subject Headings) provides standardized, hierarchical indexing. Using MeSH ensures consistent retrieval across different terminologies.
Inputs: mesh_term (required), explode, qualifiers, max_results, +3 more. Returns: object
pmc_searchA
Search PMC for full-text articles.
Searches 7M+ full-text articles in PubMed Central. Unlike PubMed (abstracts only), PMC searches the complete article text.
Inputs: query (required), filters, max_results, use_history, +1 more. Returns: object
pubmed_searchA
Search PubMed for biomedical literature.
Searches 34M+ PubMed abstracts using natural language or E-utilities syntax. Returns publication metadata including titles, abstracts, authors, and MeSH terms.
Inputs: query (required), filters, sort_by, max_results, +2 more. Returns: object
resolve_article_identifierA
Resolve a single identifier to all available ID formats.
Automatically detects the ID type and returns all available identifiers for the article.
Inputs: identifier (required), auto_detect_type. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 16 tools
Multiple tools have overlapping purposes: resolve_article_identifier and convert_article_ids both handle ID conversion; fetch_article_summary and fetch_full_article return similar data for PubMed; batch_fetch_articles and batch_process_articles are vaguely differentiated. Descriptions help but boundaries remain unclear, increasing the risk of misselection.
Naming patterns are inconsistent. Some tools use verb-first names (fetch_, find_, convert_), while search tools use noun-based names (pubmed_search, advanced_search). The mix of conventions makes the tool set feel unpredictable.
16 tools is on the heavier side for a PubMed-focused server. Several tools appear redundant (e.g., two ID converters, multiple search variants), making the count feel inflated. However, it is not extreme and still within a workable range.
The tool set covers the core PubMed/NCBI workflows: searching across databases, fetching summaries and full text, ID conversion, related articles, database links, and batch processing. Minor gaps exist (e.g., no direct author search, but find_citations_by_authors addresses this), but overall the domain is well-covered.
Maintenance
Related MCP Connectors
Auditable MCP server for PubMed, Europe PMC, ClinicalTrials.gov, and bioRxiv/medRxiv queries
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
PubMed MCP โ wraps the NCBI E-utilities API (biomedical literature, free, no auth)
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA specialized MCP server that provides a structured interface to the Europe PMC database for biological and clinical evidence retrieval. It enables LLMs to gather, rank, and synthesize published research focusing on therapeutic targets and disease associations.1MIT
- AlicenseAqualityDmaintenanceAn MCP server that provides direct access to PubMed and PubMed Central via the NCBI E-utilities API. It enables AI models to search biomedical literature, retrieve detailed article metadata, and download open-access full texts.5MIT
- AlicenseCqualityDmaintenanceA PubMed MCP server that enables LLMs to search, retrieve details, and download full-text articles from PubMed, with support for batch queries, cross-referencing, and EndNote export.1347 npm6Apache 2.0
- AlicenseAqualityBmaintenanceA high-performance MCP server that gives LLMs access to 25 biomedical tools federated across 50+ upstream APIs for genes, variants, drugs, diseases, literature, clinical trials, and structural biology.43179 npm12Apache 2.0