Skip to main content

An MCP server for searching, retrieving, and analyzing articles from PubMed

Project description

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

Project details


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.3.tar.gz (10.8 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.3-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for uh_joan_pubmed_mcp_server-0.1.3.tar.gz
Algorithm Hash digest
SHA256 0c41be83c4f9e4db13a048fbd5127f6a464e02a3bbc6fd5d7e2cfaa45cb31493
MD5 d2d11b57f950fd005ffd5c7c904fda87
BLAKE2b-256 84e19950c7444ec2781414a8f434d419d5d0e14c980d2e8b0da145fe796a6efb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for uh_joan_pubmed_mcp_server-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2cdf9d94ea369773df2024016aba0980f59a5f8e5c6e7eda6cf57635a8ab63f9
MD5 d2fc0341fe5ae0be511a8282a37d74c0
BLAKE2b-256 e36f56915b71fe15057f9f290d35424e798f0bb300f7d5358a13fcabe34152d4

See more details on using hashes here.

Supported by

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