PubMed MCP Server

PubMed MCP Server

Enables searching and retrieving scientific articles from PubMed using NCBI E-utilities API with features like rate limiting and caching.

Category
Visit Server

README

pubmed-mcp: MCP Server for PubMed

PubMed is a free database maintained by the National Library of Medicine (NLM) at the National Institutes of Health (NIH), offering access to over 30 million citations for biomedical literature.

This is MCP server for searching PubMed scientific articles using NCBI E-utilities API.

Features

  • Search PubMed articles with flexible query parameters
  • Fetch detailed article information including abstracts, authors, and DOI
  • Built-in rate limiting (3 req/s without API key, 10 req/s with API key)
  • Caching support for improved performance
  • TypeScript implementation with full type safety

Usage with Claude Code

Node.js v18 or higher is required. Claude Code typically installs Node.js during setup.

Adding pubmed-mcp in project scope

claude mcp add pubmed-mcp \
  --scope project \
  npx -y @ncukondo/pubmed-mcp \
  --email your@email.com

The -y option is used to skip the confirmation prompt during the initial installation.
The --scope project option installs the server in project scope, creating a .mcp.json file in the project root to store the MCP server settings.

If you omit --scope project, the server will be installed globally:

claude mcp add pubmed-mcp \
  npx -y @ncukondo/pubmed-mcp \
  --email your@email.com

You can also set the email address via the PUBMED_EMAIL environment variable.

Adding pubmed-mcp with an API key

Specifying a PubMed API key relaxes PubMed’s request rate limits. Obtain an API key by creating an NCBI account and visiting the API Key Management page:

claude mcp add pubmed-mcp \
  --scope project \
  npx -y @ncukondo/pubmed-mcp \
  --email your@email.com \
  --api-key your-ncbi-api-key

Alternatively, set the API key via the PUBMED_API_KEY environment variable.

Enabling caching

Enabling caching returns cached results for identical requests, reducing the number of API calls:

claude mcp add pubmed-mcp \
  --scope project npx \
  -y @ncukondo/pubmed-mcp \
  --email your@email.com \
  --cache-dir ./pubmed-cache

Use --cache-dir to specify the cache directory, and --cache-ttl to set the cache time-to-live in seconds (default: 1 day / 86400 seconds):

claude mcp add pubmed-mcp \
  --scope project \
  npx -y @ncukondo/pubmed-mcp \
  --email your@email.com \
  --cache-dir ./pubmed-cache \
  --cache-ttl 3600

Configuration via JSON file

Instead of running commands, you can edit the JSON file directly.

  • For project scope: edit .mcp.json in the project root.
  • For global scope: edit ~/.claude.json.
{
  "mcpServers": {
    "pubmed": {
      "command": "npx",
      "args": [
        "-y",
        "@ncukondo/pubmed-mcp"
        ],
      "env": {
        "PUBMED_EMAIL": "your@email.com"
      }
    }
  }
}

Usage with Claude Desktop

1. Edit Configuration File

Edit Claude Desktop's configuration file (~/.claude/claude_desktop_config.json):

{
  "mcpServers": {
    "pubmed": {
      "command": "npx",
      "args": [
        "-y",
        "@ncukondo/pubmed-mcp"
      ],
      "env": {
        "PUBMED_EMAIL": "your-email@example.com"
      }
    }
  }
}

2. Configuration with Caching

{
  "mcpServers": {
    "pubmed": {
      "command": "npx",
      "args": [
        "-y",
        "@ncukondo/pubmed-mcp",
        "--cache-dir",
        "./cache",
        "--cache-ttl",
        "3600"
      ],
      "env": {
        "PUBMED_EMAIL": "your-email@example.com",
        "PUBMED_API_KEY": "your-api-key"
      }
    }
  }
}

3. Configuration for Globally Installed Version

If you've installed globally:

npm install -g @ncukondo/pubmed-mcp
{
  "mcpServers": {
    "pubmed": {
      "command": "pubmed-mcp",
      "args": ["--cache-dir", "./pubmed-cache"],
      "env": {
        "PUBMED_EMAIL": "your-email@example.com"
      }
    }
  }
}

Requirements

System Requirements

  • Node.js: >= 18
  • npm: Latest version recommended

Environment Variables (Recommended)

  • PUBMED_EMAIL: Email address recommended by NCBI
  • PUBMED_API_KEY: API key for higher rate limits (optional)

How to Use

Available Tools

search

Search PubMed articles with query parameters.

Parameters:

  • query (required): Search query string
  • max_results: Maximum number of results (default: 20)
  • sort: Sort order for results

Example usage:

Search for "COVID-19 vaccine efficacy"

fetch_summary

Fetch detailed summary for specific PubMed articles.

Parameters:

  • pmids (required): Array of PubMed IDs to fetch

Example usage:

Get detailed information for PMID 12345678

get_full_text

Get full text information for PubMed articles (when available).

Parameters:

  • pmids (required): Array of PubMed IDs

MCP Server Development

Development Environment Setup

git clone 
cd mcp-server-pubmed
npm install

Development Commands

# Build
npm run build

# Development mode (watch)
npm run dev

# Run tests
npm test

# Test (CI)
npm run test:run

Directory Structure

src/
├── index.ts          # Main server file
├── pubmed-api.ts     # PubMed API implementation
├── handlers/         # Request handlers
└── __tests__/        # Test files

Testing During Development

# Start server locally
npm run build
node dist/index.js

# Test with MCP client in another terminal
# Or use Claude Desktop config with "command": "node", "args": ["/absolute/path/to/dist/index.js"]

Debugging

# Start with debug mode
DEBUG=* node dist/index.js

# Debug with caching
DEBUG=* node dist/index.js --cache-dir ./debug-cache --cache-ttl 300

Packaging

# Build for distribution
npm run prepublishOnly

# Verify package
npm pack

Rate Limits

  • Without API key: 3 requests per second
  • With API key: 10 requests per second

NCBI recommends including an email address in requests for better support.

Technical Specifications

  • Runtime: Node.js (>=18)
  • Language: TypeScript with ES2022 target
  • Module System: ESM
  • Build Tool: Vite
  • Testing: Vitest
  • MCP SDK: @modelcontextprotocol/sdk v1.17.1

License

MIT License

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured