PubMed MCP Server
Enables searching and retrieving detailed information from PubMed articles using the NCBI Entrez API. Supports configurable search parameters including title/abstract filtering and keyword expansion to find relevant scientific publications.
README
PubMed-MCP
A Model Context Protocol (MCP) server that provides tools for searching PubMed articles using the NCBI Entrez API.
Author: Emilio Delgado Muñoz
Features
- Search PubMed for articles based on queries
- Retrieve detailed information including title, authors, abstract, journal, and publication date
- Returns results in JSON format
- Configurable maximum number of results
Architecture
graph TB
A[Usuario] --> B[MCP Server<br/>pubmed_search.py]
B --> C[Función search_pubmed]
C --> D[Entrez.esearch<br/>Búsqueda en PubMed]
D --> E[Base de datos PubMed<br/>NCBI]
E --> F[Lista de PMIDs]
F --> G[Entrez.efetch<br/>Obtener detalles]
G --> E
G --> H[Registros XML<br/>de artículos]
H --> I[Procesamiento de datos]
I --> J[Extracción de:<br/>- Título<br/>- Autores<br/>- Abstract<br/>- Journal<br/>- Fecha]
J --> K[Lista de artículos<br/>en formato JSON]
K --> L[Respuesta al usuario]
subgraph "Dependencias"
M[BioPython<br/>requirements.txt]
N[FastMCP<br/>requirements.txt]
end
B -.-> M
B -.-> N
subgraph "Configuración"
O[Entrez.email<br/>Configurado en código]
end
C -.-> O
style A fill:#e1f5fe
style L fill:#c8e6c9
style E fill:#fff3e0
Installation
-
Clone this repository:
git clone <repository-url> cd PubMed-MCP -
Install dependencies:
uv sync -
Configure your email in
pubmed_search.py:Entrez.email = 'your-email@example.com' # Replace with your actual email
VS Code Configuration
To use this MCP server locally in VS Code, the project includes a pre-configured .vscode/mcp.json file. This file tells VS Code how to run the MCP server.
The configuration is already set up to use uv for running the server:
{
"servers": {
"pubmed-mcp": {
"command": "uv",
"args": ["run", "${workspaceFolder}/pubmed_search.py"]
}
}
}
Requirements for VS Code Integration
- VS Code with MCP extension support
uvpackage manager installed- Python virtual environment set up
Alternative Configuration
If you prefer to use pip instead of uv, you can modify the .vscode/mcp.json file:
{
"servers": {
"pubmed-mcp": {
"command": "python",
"args": ["${workspaceFolder}/pubmed_search.py"]
}
}
}
Make sure your virtual environment is activated when using this configuration.
Requirements
- Python 3.11+
- BioPython
- FastMCP
Usage
Run the MCP server:
python pubmed_search.py
The server will start and listen for MCP protocol messages on stdin/stdout.
Available Tools
search_pubmed
Searches PubMed for articles matching the given query.
Parameters:
query(string): The search querymax_results(integer, optional): Maximum number of results to return (default: 10)title(bool, optional): If true (default) search in Title fieldabstract(bool, optional): If true (default) search in Abstract fieldkeywords(bool, optional): If true (default) expand search with Author Keywords ([ot]) and MeSH Headings ([mh])
Field logic:
title=Trueandabstract=True-> query applied as(your terms)[tiab]- Only
title=True->(your terms)[ti] - Only
abstract=True->(your terms)[ab] - Both false -> no field tag (all fields)
keywords=True-> OR-expanded with(your terms)[ot] OR (your terms)[mh]
Example refined queries:
query = "breast cancer metastasis"
title=True, abstract=True, keywords=True -> (breast cancer metastasis)[tiab] OR ((breast cancer metastasis)[ot] OR (breast cancer metastasis)[mh])
title=True, abstract=False, keywords=False -> (breast cancer metastasis)[ti]
title=False, abstract=False, keywords=True -> (breast cancer metastasis) OR ((breast cancer metastasis)[ot] OR (breast cancer metastasis)[mh])
Returns: A list of article objects containing:
pmid: PubMed IDtitle: Article titleauthors: List of author namesabstract: Article abstractjournal: Journal namepublication_year: Year of publicationpublication_month: Month of publicationurl: PubMed URL
Configuration
Before using the tool, you must set your email address in the Entrez.email variable. This is required by NCBI's Entrez API.
License
This project is open source. Please check the license file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.