Get the FREE Ultimate OpenClaw Setup Guide →

pubmed

A Model Context Protocol (MCP) server enabling AI agents to intelligently search, retrieve, and analyze biomedical literature from PubMed via NCBI E-utilities. Includes a research agent scaffold. STDIO & HTTP

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio cyanheads-pubmed-mcp-server npx -y @cyanheads/pubmed-mcp-server@latest \
  --env NCBI_API_KEY="your-key-here" \
  --env MCP_LOG_LEVEL="info" \
  --env MCP_TRANSPORT_TYPE="stdio"

How to use

The pubmed MCP server provides access to PubMed and PubMed Central data via a single standardized MCP interface. It exposes seven tools that let you search PubMed, fetch article metadata, retrieve full-text from PMC where available, generate formatted citations, explore related articles, spell-check queries, and browse MeSH vocabulary. The server can run locally over stdio or HTTP, and it supports deployment to Cloudflare Workers. To start, connect an MCP client to the server using the provided transport type (stdio or http) and invoke any of the seven tools by name, passing appropriate parameters as defined in the tool descriptions. Each tool is designed to be self-contained and handles NCBI E-utilities interactions, rate limiting, and parsing of PubMed/PMC responses.

The available tools are: pubmed_search (advanced PubMed queries with filters and pagination), pubmed_fetch (retrieve article metadata by PMIDs), pubmed_pmc_fetch (download and parse full text from PubMed Central where open access is available), pubmed_cite (generate citations in APA, MLA, BibTeX, or RIS), pubmed_related (find similar articles or references using ELink), pubmed_spell (spell-check queries via ESpell), and pubmed_mesh_lookup (explore MeSH terms and tree numbers). Each tool is designed to be called in a single MCP request, and results are returned in a structured format suitable for downstream processing or client display.

How to install

Prerequisites:\n- Node.js or Bun environment for development and testing (the server supports stdio and HTTP transports).\n- Optional: NCBI API key for higher rate limits.\n\nInstallation steps:\n1) Clone the repository (or install via npm/bun if published as a package).\n2) Install dependencies (if applicable).\n3) Start the MCP server in stdio mode using npx or your preferred runner.\n\nExample using npx (stdio):\nbash\n# Run the MCP server directly with npx (latest release)\nMCP_TRANSPORT_TYPE=stdio MCP_LOG_LEVEL=info NCBI_API_KEY=your-key-here npx -y @cyanheads/pubmed-mcp-server@latest\n\n4) Connect your MCP client to the server using the same transport type (stdio) and the configured command/arguments.\n\nIf you prefer Docker or Bun-based setups, see the README for alternative run commands and environment variables.

Additional notes

Tips and common issues:\n- If you are hitting rate limits, supply an NCBI_API_KEY to gain higher quotas. The MCP server handles rate-limiting via a configurable request queue.\n- For HTTP/Streamable HTTP access, ensure MCP_TRANSPORT_TYPE is set to http and configure MCP_HTTP_PORT as needed.\n- When running locally, ensure the environment is set up to allow network access to NCBI services.\n- The MeSH lookup and PMC fetch tools rely on Open Access availability; some PMC articles may have restricted full text.\n- If you encounter XML parsing quirks from PubMed, the server includes a PubMed-specific XML parser with resilience to irregular structures.\n- Use the provided example configurations as templates and adjust MCP_LOG_LEVEL, transport type, and API keys to fit your deployment environment.

Related MCP Servers

Sponsor this space

Reach thousands of developers