NC

NCBI Entrez MCP Server for PubMed, Genes

Access biomedical data via MCP server for NCBI Entrez: search PubMed, genes, proteins and more using E-utilities for research and analysis.

Quick Install
npx -y @QuentinCody/entrez-mcp-server

Overview

The NCBI Entrez MCP Server exposes NCBI Entrez (PubMed, Genes, Proteins and related databases) through a Model Context Protocol (MCP)–compatible HTTP interface. It wraps Entrez E-utilities (ESearch, ESummary, EFetch, ELink, etc.) and presents them as discoverable tools that can be invoked directly by LLM agents or other automated clients. This makes it easy to integrate biomedical literature and sequence metadata into downstream analysis workflows or tool-enabled language models without direct handling of XML responses or E-utilities URL composition.

The server is useful when you want programmatic, reproducible access to Entrez datasets and prefer a JSON-friendly, tool-oriented interface. It manages common concerns such as API key configuration, rate-limiting control, optional caching, and returning concise, parsed summaries suitable for prompt contexts or structured pipelines.

Features

  • MCP-compliant discovery endpoint that returns a toolset describing available Entrez operations
  • Wraps core NCBI E-utilities: ESearch, ESummary, EFetch, ELink
  • Support for PubMed, Gene, Protein, Nucleotide and other Entrez databases
  • Query parameter mapping and pagination support (retstart/retmax)
  • Optional caching and configurable cache TTL to reduce repeated calls
  • API key support via environment variable to increase rate limits
  • JSON responses and parsed summaries to simplify downstream use
  • Lightweight HTTP server deployable via Docker or as a local process

Installation / Configuration

Clone the repository and run with Docker (recommended) or install locally.

Using Docker (example)

# Build and run (example)
git clone https://github.com/QuentinCody/entrez-mcp-server.git
cd entrez-mcp-server

# Build image (if Dockerfile present)
docker build -t entrez-mcp-server .

# Run with environment variables
docker run -p 8080:8080 \
  -e NCBI_API_KEY=your_ncbi_api_key \
  -e PORT=8080 \
  -e CACHE_TTL=3600 \
  entrez-mcp-server

Using Node / npm (if project is Node-based)

git clone https://github.com/QuentinCody/entrez-mcp-server.git
cd entrez-mcp-server
npm install
# set env vars and run
export NCBI_API_KEY=your_ncbi_api_key
export PORT=8080
npm start

Configuration environment variables

PORT           # HTTP port to listen on (default: 8080)
NCBI_API_KEY   # Optional NCBI API key to increase rate limits
CACHE_TTL      # Cache time-to-live in seconds (optional)
LOG_LEVEL      # Logging verbosity (info/debug)

Adjust configuration files or command-line flags as provided by the repository README.

Available Resources

The server exposes a small set of MCP-discoverable tools that correspond to Entrez operations. Typical endpoints:

Tool namePurposeExample backend
esearchSearch a database for IDs matching a queryESearch
esummaryRetrieve summaries for given IDsESummary
efetchFetch full records (XML/FASTA/etc.)EFetch
elinkFollow links between Entrez databasesELink
discoverMCP discovery document listing tools/mcp/discover

Discovery endpoint (returns MCP tool descriptors):

curl http://localhost:8080/mcp/discover

Search/search-result endpoint (JSON):

curl "http://localhost:8080/tools/esearch?db=pubmed&term=CRISPR&retmax=10"

Use Cases

  1. Search PubMed for recent papers and fetch summaries
# Find PMIDs for "single-cell RNA-seq"
curl "http://localhost:8080/tools/esearch?db=pubmed&term=single-cell%20RNA-seq&retmax=5"

# Get summaries for returned PMIDs
curl -X POST "http://localhost:8080/tools/esummary" \
  -H "Content-Type: application/json" \
  -d '{"db":"pubmed","ids":["12345678","23456789"]}'
  1. Retrieve gene summaries for downstream annotation
# Search for a gene by symbol
curl "http://localhost:8080/tools/esearch?db=gene&term=BRCA1[Gene%20Name]"

# Fetch gene summary
curl -X POST "http://localhost:8080/tools/esummary" \
  -H "Content-Type: application/json" \
  -d '{"db":"gene","ids":["672"]}'
  1. Integrate with an LLM tool loop
  • The MCP discovery endpoint exposes tool metadata the model can use to plan actions (search → summarize → fetch full records).
  • Use the esearch tool to produce candidate IDs, then call efetch to obtain full records for extraction or citation generation.
  1. Batch retrieval and caching
  • For systematic reviews or pipelines that re-query the same set of PMIDs, enable CACHE_TTL to reduce NCBI requests and improve throughput.

Notes and Best Practices

  • Provide an NCBI API key (NCBI_API_KEY) for higher request quota when running programmatically.
  • Respect NCBI usage policies and rate limits; the server exposes controls to throttle or cache calls.
  • Use esummary for compact metadata (titles, authors, abstracts summary) and efetch when full XML/FASTA records are required.
  • Inspect the MCP discovery document to understand tool argument schemas and response formats before integrating into an LLM agent.

Repository and source code

  • GitHub: https://github.com/QuentinCody/entrez-mcp-server

Tags: database, search