Skip to main content
Glama
ncukondo

PubMed MCP Server

by ncukondo

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

Related MCP server: PubMed MCP

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. For better security, consider managing credentials in a .env file.

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. For security reasons, it is recommended to store sensitive information like API keys in a .env file rather than in command line arguments or configuration files.

Enabling caching

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

Using command line arguments

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

You can also configure caching via environment variables.

  • PUBMED_CACHE_DIR: Directory path for caching responses

  • PUBMED_CACHE_TTL: Cache time-to-live in seconds (default: 86400)

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

  • PUBMED_EMAIL: Email address recommended by NCBI

  • PUBMED_API_KEY: API key for higher rate limits (optional)

  • PUBMED_CACHE_DIR: Directory path for caching responses (optional)

  • PUBMED_CACHE_TTL: Cache time-to-live in seconds (optional, default: 86400)

How to Use

Available Tools

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

Available Tools

3 tools
fetch_summaryPubMed Article SummaryC

Fetch detailed article information from PubMed using PMIDs.

ParametersJSON Schema
NameRequiredDescriptionDefault
pmidsYesArray of PubMed IDs (PMIDs) to fetch

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'detailed article information' but doesn't specify what that includes (e.g., title, authors, abstract), whether there are rate limits, authentication needs, or error handling. This leaves significant gaps in understanding the tool's behavior beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse. There's no wasted information, earning a high score for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'detailed article information' entails, potential limitations (e.g., batch size, availability), or error cases. For a tool with no structured behavioral data, this leaves too many unknowns for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the parameter 'pmids' clearly documented as an array of PubMed IDs. The description adds minimal value beyond the schema by mentioning 'using PMIDs', which reinforces but doesn't expand on the parameter's purpose. The baseline score of 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('fetch') and resource ('detailed article information from PubMed'), making the purpose understandable. It specifies the mechanism ('using PMIDs'), which helps distinguish it from general search operations. However, it doesn't explicitly differentiate from sibling tools like 'get_fulltext' or 'search_pubmed' beyond the 'detailed article information' phrasing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_fulltext' or 'search_pubmed' or explain scenarios where this tool is preferred (e.g., for known PMIDs vs. keyword searches). The usage context is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_fulltextPubMed Full TextC

Get full text content of PubMed articles using PMIDs.

ParametersJSON Schema
NameRequiredDescriptionDefault
pmidsYesArray of PubMed IDs (PMIDs) to get full text for

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool retrieves full text but doesn't disclose behavioral traits such as rate limits, authentication needs, error handling (e.g., for invalid PMIDs), or output format (e.g., plain text, HTML). For a tool with no annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It front-loads the purpose clearly and uses straightforward language, making it easy to parse. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., full text content in what format?), potential limitations (e.g., availability of full text), or error cases. For a tool with no structured support, more context is needed to be fully helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'pmids' clearly documented in the schema as an array of PubMed IDs. The description adds minimal value beyond the schema by mentioning 'using PMIDs', but doesn't provide additional semantics like format examples or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get full text content') and resource ('PubMed articles') with a specific mechanism ('using PMIDs'). It distinguishes from sibling tools like 'fetch_summary' (which presumably provides summaries) and 'search_pubmed' (which searches rather than retrieves full text). However, it doesn't explicitly mention how it differs from siblings beyond the verb, keeping it at 4 rather than 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'fetch_summary' or 'search_pubmed'. It doesn't specify prerequisites (e.g., needing valid PMIDs) or exclusions (e.g., not for abstracts). Without any usage context, it scores low.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_pubmedPubMed SearchC

Search PubMed for scientific articles.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for PubMed
searchOptionsNoOptional search parameters

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe important behaviors like pagination handling (implied by retMax/retStart), rate limits, authentication requirements, error conditions, or what the response format looks like. For a search tool with complex parameters, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core purpose without unnecessary words. It's appropriately sized for a search tool and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a search tool with 2 parameters (one being a complex nested object), no annotations, and no output schema, the description is insufficient. It doesn't explain what the tool returns, how results are structured, or important behavioral aspects like pagination. The agent would need to guess about the response format and operational constraints.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters and their sub-properties. The description adds no parameter-specific information beyond what's in the schema, maintaining the baseline score. It doesn't explain how parameters interact or provide usage examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Search') and resource ('PubMed for scientific articles'), making the purpose immediately understandable. However, it doesn't differentiate this search tool from sibling tools like 'fetch_summary' or 'get_fulltext', which presumably retrieve specific article details rather than perform searches.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus the sibling tools 'fetch_summary' or 'get_fulltext'. It doesn't mention prerequisites, limitations, or alternative approaches, leaving the agent to infer usage context from tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3.2/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: fetch_summary retrieves article metadata, get_fulltext provides full content, and search_pubmed finds articles. The descriptions make it easy for an agent to choose the right tool for each task without confusion.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (fetch_summary, get_fulltext, search_pubmed) with clear, action-oriented verbs. The naming is uniform and predictable across the set, making it easy to understand each tool's function.

Tool Count3/5

With only 3 tools, the count feels thin for a PubMed domain that typically involves more operations like filtering, citation management, or advanced search. While the tools cover basic needs, the scope could benefit from additional functionality to be fully robust.

Completeness3/5

The tools cover core functions (search, summary, fulltext) but lack operations for updating, deleting, or managing articles, as well as advanced features like filtering by date or author. This creates minor gaps that agents might need to work around for complex workflows.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    A
    quality
    D
    maintenance
    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.
    1
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables searching and retrieving academic article metadata from PubMed through a simple HTTP interface. Provides curated article summaries including titles, authors, publication dates, and DOIs for research and academic content discovery.
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables searching PubMed's biomedical literature database and retrieving article metadata, abstracts, and full content through the E-utilities API. Supports advanced queries, batch operations, and multiple output formats with automatic rate limiting.
    1

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ncukondo/pubmed-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server