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

Basic Literature Search

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uh_joan_pubmed_mcp_server-0.1.4.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uh_joan_pubmed_mcp_server-0.1.4-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file uh_joan_pubmed_mcp_server-0.1.4.tar.gz.

File metadata

File hashes

Hashes for uh_joan_pubmed_mcp_server-0.1.4.tar.gz
Algorithm Hash digest
SHA256 115e9ed743d95599902a77dffd92f5ddcb066a7eb17f793e7777b6e81122ef49
MD5 f6eb89f4f53a5e81e2596628bebe0997
BLAKE2b-256 69a5f36a4b18fe8758fce5547147f6891cd1563d021aa832e1cdaf9e4e78ab2e

See more details on using hashes here.

File details

Details for the file uh_joan_pubmed_mcp_server-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for uh_joan_pubmed_mcp_server-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 531132253e2abf5dcb6816e118ffd0338898896ce686569cabafa1d421a3f5b4
MD5 e10872cd489defdcf29c69a63db410c3
BLAKE2b-256 2b7453fdf38dc07a656a90a7b8446990cdf3db1bab0de6ae946fdbd4b2f4ac0d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page