PubMed MCP Server

by aeghnnsw

Not rated
GitHub

About

Search and download scientific articles from PubMed's E-utilities API.

Details

Author
aeghnnsw
Categories
Search, Other, Knowledge Base

Setup

Install PubMed MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/aeghnnsw/pubmed-mcp

Follow the installation instructions in the repository README, then restart your MCP client.

A Model Context Protocol (MCP) server that provides access to PubMed's E-utilities API for searching and downloading scientific articles. This server enables LLM applications to search PubMed's vast database of biomedical literature and retrieve article metadata, abstracts, and full content.

- Article Search: Search PubMed database with flexible query terms
- Article Download: Retrieve full article metadata, abstracts, and available content
- Batch Operations: Download multiple articles in a single request
- Article Summaries: Get document summaries with metadata
- Multiple Formats: Support for XML, JSON, and text output formats
- Rate Limiting: Automatic rate limiting to respect PubMed API limits
- Error Handling: Robust error handling for API failures
- Clone or downloadthis repository
- Run the setup script:

./setup.sh

- Clone or downloadthis repository
- Create and activate virtual environment:

python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
cp .env.example .env # Edit .env file with your NCBI API key and email

Create a.envfile with the following optional configuration:

- NCBI_API_KEY: Your NCBI API key (increases rate limit from 3 to 10 requests/second)
- NCBI_EMAIL: Your email address (recommended by NCBI for API usage tracking)

Get your free NCBI API key at:https://www.ncbi.nlm.nih.gov/account/settings/
-

Activate the virtual environment(if not already active):

source venv/bin/activate # On Windows: venv\Scripts\activate

The server will start and listen for MCP connections via stdio.
- To deactivatethe virtual environment when done:

deactivate

Search PubMed for articles matching a query.

- query(string, required): Search query (e.g., "COVID-19 vaccines", "machine learning AND healthcare")
- max_results(int, optional): Maximum results to return (default: 20, max: 200)
- sort(string, optional): Sort order - "relevance", "pub_date", or "first_author" (default: "relevance")

- pmids: List of PubMed IDs
- total_count: Total number of matching articles
- query_used: The search query executed
- results_returned: Number of results returned
- sort_order: Sort order used

{ "query": "CRISPR gene editing", "max_results": 10, "sort": "pub_date" }

- pmid(string, required): PubMed ID (e.g., "33073741")
- format_type(string, optional): Content format - "abstract", "medline", or "full" (default: "abstract")
- return_mode(string, optional): Return format - "xml", "text", or "json" (default: "xml")

- pmid: The PubMed ID
- content: Article content in requested format
- format_type: Format type used
- return_mode: Return mode used
- content_length: Length of content

Download multiple articles in a single request.

- pmids(list, required): List of PubMed IDs
- format_type(string, optional): Content format (default: "abstract")
- return_mode(string, optional): Return format (default: "xml")

- pmids: List of requested PMIDs
- content: Combined article content
- article_count: Number of articles requested
- content_length: Length of content

Get document summaries for articles (metadata without full content).

- pmids(list, required): List of PubMed IDs

- pmids: List of requested PMIDs
- summaries: XML summary data
- article_count: Number of articles requested

- "COVID-19"- Search for COVID-19 articles
- "machine learning"- Search for machine learning articles
- "breast cancer"- Search for breast cancer articles

- "COVID-19 AND vaccine"- Articles about COVID-19 vaccines
- "machine learning AND healthcare"- ML in healthcare
- "CRISPR
[Title]"- CRISPR in article titles only
- "Nature[Journal]"- Articles from Nature journal
- "2023[PDAT]"- Articles published in 2023
- "Smith J[Author]"- Articles by author "Smith J"

- [Title]- Search in title only
- [Author]- Search by author
- [Journal]- Search by journal name
- [PDAT]- Search by publication date
- [MeSH]- Search MeSH terms

If you configured your API key in the.envfile during installation:

{ "mcpServers": { "pubmed": { "command": "/path/to/pubmed-mcp/venv/bin/python", "args": ["/path/to/pubmed-mcp/server.py"] } } }

Alternatively, you can specify the API key directly in the Claude Desktop configuration:

{ "mcpServers": { "pubmed": { "command": "/path/to/pubmed-mcp/venv/bin/python", "args": ["/path/to/pubmed-mcp/server.py"], "env": { "NCBI_API_KEY": "your_api_key_here", "NCBI_EMAIL": "your_email@example.com" } } } }

Recommendation: Use Option 1 (.env file) for better security and easier management.

Note: Make sure to use the full path to the Python executable in the virtual environment (venv/bin/python) to ensure the correct dependencies are available.

- Without API key: 3 requests per second
- With API key: 10 requests per second
- Batch size limit: 50 articles per batch request

The server provides comprehensive error handling:

- Invalid PMIDs are automatically cleaned (non-numeric characters removed)
- Empty queries return descriptive errors
- API failures are caught and reported
- Rate limiting prevents API abuse

pubmed-mcp/ ├── server.py # Main MCP server implementation ├── pubmed_client.py # PubMed API client wrapper ├── requirements.txt # Python dependencies ├── setup.sh # Automated setup script ├── .gitignore # Git ignore file ├── README.md # This file ├── .env.example # Environment variables template └── venv/ # Virtual environment (created by setup)

- mcp[cli]- MCP Python SDK
- requests- HTTP client for PubMed API
- python-dotenv- Environment variables
- typing-extensions- Type hints support

This project is open source. Please check PubMed's terms of service for API usage guidelines.

For issues with this MCP server, please check:
- Your API key and email configuration
- Network connectivity to NCBI servers
- Rate limiting compliance
- Valid PMID formats

For PubMed API documentation, visit:https://www.ncbi.nlm.nih.gov/books/NBK25500/

Search global news using natural language. Webz.io News Search API returns the most relevant articles and content, with filters for source, country, language, date, sentiment, and category.

An MCP (Model Context Protocol) server for searching and analyzing academic papers across multiple databases (Semantic Scholar, Crossref, OpenAlex, PubMed), with regex-powered filtering and statistical analysis.

Search scientific papers with structured experimental data extracted from full-text studies. Returns 25+ fields per paper including methods, results, sample sizes, limitations, and quality scores.

A server for searching, retrieving, and analyzing articles from the PubMed database.

Lightning-Fast, High-Accuracy Deep Research Agent 👉 8–10x faster 👉 Greater depth & accuracy 👉 Unlimited parallel runs

Search and retrieve academic paper information from multiple sources like Semantic Scholar and CrossRef.

Research papers from arXiv, Google Scholar, and Wikipedia with citation metrics

A flexible service for searching and analyzing academic papers on arXiv.

Live Austin-area MLS listings in your AI assistant — active listings, property details, schools, taxes, and neighborhood data for the Austin metro. Free remote MCP server, no install.

Search scientific papers from any MCP tool. Raw experimental data from full-text papers — methods, results, quality scores. 50 free searches, then $0.01/result.

Search and access clinical trial data from ClinicalTrials.gov.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.