Comprehensive NCBI/PubMed literature search server with advanced analytics, caching, MeSH integration, related articles discovery, and batch processing for all life sciences and biomedical research.
A Model Context Protocol (MCP) server for searching NCBI databases, designed for researchers across all life sciences and biomedical fields. This server provides seamless access to PubMed's vast collection of 35+ million scientific articles through natural language queries, enabling AI assistants to help with literature reviews, research discovery, and scientific analysis.
π¬ Comprehensive Search: Search PubMed's 35+ million articles across all biological disciplines
π Advanced Queries: Support for complex searches with boolean operators, field tags, and filters
𧬠Life Sciences Research: Covers all biological and biomedical fields including genetics, ecology, medicine, and biotechnology
π» Computational Biology: Perfect for finding bioinformatics methods, algorithms, and computational tools
π¬ Research Applications: Literature reviews, hypothesis generation, method discovery, and staying current with scientific advances
π Full Article Details: Get abstracts, author lists, MeSH terms, DOIs, and publication information
π Related Articles: Discover relevant research through NCBI's relationship algorithms
π MeSH Integration: Search and utilize Medical Subject Headings for precise terminology
Create and initialize project
mkdir ncbi-mcp-server && cd ncbi-mcp-server
poetry init
During init, add dependencies: mcp
, httpx
, typing-extensions
Create project structure
mkdir -p src/ncbi_mcp_server
# Save server.py code as src/ncbi_mcp_server/server.py
Install dependencies
poetry install
Test the server
poetry run python src/ncbi_mcp_server/server.py
Configure Claude Desktop
Edit your Claude Desktop config file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
~/.config/claude/claude_desktop_config.json
Add this configuration:
{
"mcpServers": {
"ncbi-literature": {
"command": "poetry",
"args": ["run", "python", "src/ncbi_mcp_server/server.py"],
"cwd": "/FULL/PATH/TO/YOUR/ncbi-mcp-server"
}
}
}
Restart Claude Desktop and start searching!
conda env create -f environment.yml
conda activate ncbi-mcp
python server.py
python -m venv venv
source venv/bin/activate # Linux/macOS
pip install -r requirements.txt
python server.py
Search for phylogenetic studies:
"Search for recent phylogenetic analysis papers on mammalian evolution"
β Uses: search_pubmed with query "phylogenetic analysis[ti] AND mammalian[ti] AND evolution"
Find computational phylogenetics methods:
"Find papers about maximum likelihood methods for phylogenetic reconstruction"
β Uses: search_pubmed with query "maximum likelihood[ti] AND phylogenetic reconstruction"
Search by specific organism:
"Find recent papers on Drosophila comparative genomics"
β Uses: search_pubmed with query "Drosophila[ti] AND comparative genomics[ti]"
Algorithm and method papers:
"Search for machine learning applications in genomics from the last 2 years"
β Uses: search_pubmed with date_range="730" and query "machine learning AND genomics"
Software and database papers:
"Find papers about new bioinformatics tools for sequence analysis"
β Uses: search_pubmed with query "bioinformatics[ti] AND software[ti] AND sequence analysis"
Multi-criteria search:
"Find review articles about CRISPR applications in evolutionary studies published in Nature or Science"
β Uses: advanced_search with terms=["CRISPR", "evolution"], publication_types=["Review"], journals=["Nature", "Science"]
Author-specific searches:
"Find recent papers by researchers working on ancient DNA and phylogenomics"
β Uses: search_pubmed with query "ancient DNA[ti] AND phylogenomics[ti]"
search_pubmed
Primary search tool for PubMed database
[ti]
for title, [au]
for author, [mh]
for MeSH terms)Examples:
"CRISPR[ti] AND evolution"
- CRISPR in title AND evolution anywhere"phylogenetic analysis[mh]"
- Using MeSH term for phylogenetic analysis"computational biology AND machine learning"
- Boolean searchget_article_details
Fetch complete information for specific articles
Returns full abstracts, author lists, MeSH terms, DOI, publication details
search_mesh_terms
Find standardized Medical Subject Headings
Helps discover related concepts and improve search precision
get_related_articles
Discover articles related to a specific paper
Perfect for literature reviews and finding relevant research
advanced_search
Complex searches with multiple criteria
The NCBI MCP Server includes comprehensive analytics to help you understand your research patterns and optimize performance.
get_analytics_summary
Get comprehensive analytics overview
"Show me my research analytics summary"
Returns:
get_detailed_metrics
Detailed performance metrics for specific time periods
"Get detailed metrics for the last 24 hours"
reset_analytics
Reset analytics data (use with caution)
"Reset all analytics data"
Note: This permanently clears all collected metrics.
Usage Patterns:
Performance Metrics:
Research Insights:
Configure credentials:
cp .env.example .env
# Edit .env with your NCBI email and API key
Choose deployment method:
# Local development
./deploy.sh local
# Docker deployment
./deploy.sh docker
# Production deployment
./deploy.sh production
Perfect for development and testing:
poetry install
poetry run python -m src.ncbi_mcp_server.server
Recommended for most users with two options:
Full setup with Redis (recommended):
# Copy and configure environment
cp .env.example .env
# Edit .env with your NCBI email and API key
# Start all services
docker-compose up -d
Simple setup without Redis:
# For basic usage without Redis dependencies
cp .env.example .env
# Edit .env with your NCBI email
docker-compose -f docker-compose.simple.yml up -d
Full setup includes:
Simple setup includes:
For production environments:
# Configure production settings
cp .env.production .env
# Edit with production values
# Deploy
./deploy.sh production
Docker logs:
docker-compose logs -f ncbi-mcp-server
Cache monitoring:
cache_stats()
Health checks:
# Test server health
curl http://localhost:8000/health
# Test via MCP
python -c "from src.ncbi_mcp_server.server import cache_stats; import asyncio; print(asyncio.run(cache_stats()))"
For higher rate limits and better performance:
src/ncbi_mcp_server/server.py
:# Replace the line: ncbi_client = NCBIClient()
# With:
ncbi_client = NCBIClient(
email="[email protected]",
api_key="your_api_key_here"
)
poetry shell # Activate virtual environment
poetry add package # Add new dependency
poetry remove package # Remove dependency
poetry update # Update all dependencies
poetry run python ... # Run commands in environment
poetry build # Create distribution packages
poetry add --group dev black mypy pytest isort flake8
poetry run black . # Format code
poetry run mypy . # Type checking
poetry run pytest # Run tests
poetry run isort . # Sort imports
# They just need:
git clone your-repo
cd ncbi-mcp-server
poetry install
# Everything works identically!
PubMed supports many field tags for precise searching:
[ti]
- Title[tiab]
- Title and Abstract[au]
- Author[mh]
- MeSH Terms[journal]
- Journal Name[pdat]
- Publication Date[pt]
- Publication Type[lang]
- Language[sb]
- Subset (e.g., medline, pubmed)Example Advanced Queries:
"machine learning"[ti] AND "phylogen*"[tiab] AND "2020"[pdat]:"2024"[pdat]
evolutionary[mh] AND computational[ti] AND (genomics[tiab] OR proteomics[tiab])
"ancient DNA"[ti] AND (paleogenomics[mh] OR phylogenomics[tiab])
search_pubmed("computational phylogenetics")
search_mesh_terms("phylogenetics")
get_related_articles(pmid="key_paper_id")
get_article_details(pmids=["12345", "67890"])
search_pubmed("new methods", date_range="90")
search_pubmed("author_name[au]", sort="pub_date")
advanced_search
with your research keywordssearch_pubmed("algorithm[ti] AND your_field")
search_pubmed("software[ti] OR tool[ti] AND bioinformatics")
search_pubmed("comparison[ti] OR benchmark[ti]")
Server won't start:
pip install -r requirements.txt
No search results:
Rate limit errors:
XML parsing errors:
This MCP server is designed to grow with the research community. Ideas for enhancement:
This project is open source. Feel free to modify and distribute according to your institution's policies.
Perfect for researchers in:
Start exploring the vast world of biological literature with powerful, precise searches!