Provides tools for searching PubMed articles using the NCBI Entrez API, enabling retrieval of detailed article information including title, authors, abstract, journal, and publication date with configurable search parameters
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
Installation
Clone this repository:
git clone <repository-url> cd PubMed-MCPInstall dependencies:
uv syncConfigure 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:
Requirements for VS Code Integration
VS Code with MCP extension support
uv
package manager installedPython virtual environment set up
Alternative Configuration
If you prefer to use pip
instead of uv
, you can modify the .vscode/mcp.json
file:
Make sure your virtual environment is activated when using this configuration.
Requirements
Python 3.11+
BioPython
FastMCP
Usage
Run the MCP server:
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=True
andabstract=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:
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.
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
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.