Skip to main content

PubMed MCP Server

npm version License: MIT FastMCP

An MCP server providing access to PubMed's vast repository of biomedical literature through a simple interface. This server enables AI assistants to search, access, and analyze scientific articles, retrieve detailed metadata, and perform comprehensive analysis in a programmatic way.

🔬 Supported Data Sources

This server provides comprehensive access to biomedical literature and research data:

Scientific Literature

  • PubMed Search - Query millions of biomedical articles with keywords or advanced search
  • Article Metadata - Retrieve detailed information including authors, abstracts, and citations
  • Full-text Access - Attempt to download PDF content when available

Research Analysis

  • Deep Paper Analysis - Perform comprehensive analysis of research papers
  • Research Prompts - Specialized analysis templates for biomedical research
  • Citation Analysis - Track research impact and relationships

Data Integration

  • FastMCP Framework - High-performance async server implementation
  • Efficient Retrieval - Optimized access to paper metadata and content
  • Research Support - Facilitate biomedical sciences research and analysis

Installation

From pip

pip install pubmed-mcp-server

Then run directly:

python pubmed_server.py

From Source

  1. Clone this repository:
git clone https://github.com/uh-joan/pubmed-mcp-server.git
cd pubmed-mcp-server
  1. Install dependencies:
pip install -r requirements.txt
  1. Start the server:
python pubmed_server.py

Project Structure

src/
├── pubmed_server.py          # Main MCP server implementation
├── pubmed_web_search.py      # PubMed search and retrieval logic
├── requirements.txt          # Python dependencies
├── pyproject.toml           # Project configuration
└── README.md                # This file

🔧 Configuration

The server can be configured using environment variables:

Server Settings

  • SERVER_NAME: Server name (default: 'pubmed-mcp-server')
  • SERVER_VERSION: Server version (default: '1.0.0')
  • LOG_LEVEL: Logging level - 'error', 'warn', 'info', 'debug' (default: 'info')

Performance Settings

  • REQUEST_TIMEOUT: Request timeout in milliseconds (default: 30000)
  • MAX_REQUEST_SIZE: Maximum request size in bytes (default: 1048576)
  • ENABLE_PERFORMANCE_MONITORING: Enable performance monitoring (default: false)

Development Settings

  • NODE_ENV: Environment mode (default: 'production')
  • DEV_MODE: Enable development mode (default: false)
  • DEBUG: Enable debug logging (default: false)

MCP Client Configuration

Claude Desktop

Add this configuration to your claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "pubmed": {
      "command": "python",
      "args": ["/path/to/pubmed-mcp-server/pubmed_server.py"],
      "env": {
        "LOG_LEVEL": "info"
      }
    }
  }
}

Cursor MCP Settings

To use this server with Cursor, add this configuration to your ~/.cursor/mcp.json:

{
  "pubmed-mcp-server": {
    "command": "python",
    "args": ["/path/to/pubmed-mcp-server/pubmed_server.py"],
    "env": {
      "LOG_LEVEL": "info",
      "DEV_MODE": "false"
    }
  }
}

Make sure to:

  1. Replace /path/to/pubmed-mcp-server with your actual project path
  2. Restart your MCP client after making changes

🔍 Available Tools

The PubMed MCP Server provides the following tools for biomedical research:

Literature Search Tools

Tool Name: search_pubmed_key_words Description: Search for articles on PubMed using keywords and terms.

Usage Example:

{
  "query": "CRISPR gene editing",
  "max_results": 10,
  "sort": "relevance"
}

Tool Name: search_pubmed_advanced Description: Perform advanced search with multiple parameters and filters.

Parameters:

  • query (required): Search query string
  • max_results: Maximum results to return (default: 10)
  • sort: Sort order ('relevance', 'date', 'author')
  • filters: Additional search filters
  • date_range: Limit results by publication date

Article Analysis Tools

Tool Name: get_pubmed_article_metadata Description: Fetch detailed metadata for a specific PubMed article using its PMID.

Tool Name: download_pubmed_pdf Description: Attempt to download the full-text PDF for a PubMed article.

Tool Name: deep_paper_analysis Description: Perform comprehensive analysis of a PubMed article including methodology, findings, and significance.

Usage Examples

You can ask the AI assistant to search for papers using queries like:

Can you search PubMed for recent papers about CRISPR gene editing?

Detailed Article Analysis

Once you have a PMID, you can request detailed analysis:

Can you perform a deep analysis of the paper with PMID 12345678?

Research Workflow

Search for papers on "COVID-19 vaccine effectiveness", then analyze the top 3 most recent papers for methodology and findings.

Development

Prerequisites

  • Python 3.10+
  • FastMCP library
  • requests
  • beautifulsoup4

Development Setup

  1. Start in development mode:
DEV_MODE=true python pubmed_server.py
  1. Run with debug logging:
LOG_LEVEL=debug python pubmed_server.py
  1. Test the server:
python -c "import pubmed_server; print('✅ Server module loaded successfully')"

📡 API Integration

This server integrates with PubMed's E-utilities API provided by the National Center for Biotechnology Information (NCBI). The API provides access to biomedical literature with search and retrieval capabilities.

Supported Data Sources

  • NCBI/NLM: National Center for Biotechnology Information
  • PubMed: Biomedical literature database
  • PMC: PubMed Central full-text articles
  • MeSH: Medical Subject Headings

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

📄 License

MIT License - see LICENSE file for details.

⚠️ Disclaimer

This tool is for research purposes only. Please respect PubMed's terms of service and use this tool responsibly.

📚 Resources

Metadata

Release files for uh-joan-pubmed-mcp-server 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uh-joan-pubmed-mcp-server 0.1.4
File Size Uploaded
uh_joan_pubmed_mcp_server-0.1.4.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for uh-joan-pubmed-mcp-server 0.1.4
File Interpreter ABI Platform
uh_joan_pubmed_mcp_server-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 22.9 kB

Release files / uh_joan_pubmed_mcp_server-0.1.4.tar.gz

Download URL uh_joan_pubmed_mcp_server-0.1.4.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
115e9ed743d95599902a77dffd92f5ddcb066a7eb17f793e7777b6e81122ef49
BLAKE2b-256 checksum
How to use checksums
69a5f36a4b18fe8758fce5547147f6891cd1563d021aa832e1cdaf9e4e78ab2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release files / uh_joan_pubmed_mcp_server-0.1.4-py3-none-any.whl

Download URL uh_joan_pubmed_mcp_server-0.1.4-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
531132253e2abf5dcb6816e118ffd0338898896ce686569cabafa1d421a3f5b4
BLAKE2b-256 checksum
How to use checksums
2b7453fdf38dc07a656a90a7b8446990cdf3db1bab0de6ae946fdbd4b2f4ac0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page