Skip to main content
Glama

PubMed MCP Server

A Model Context Protocol (MCP) server that provides access to PubMed scientific publications. Search research papers, retrieve abstracts, and get publication details directly within your Claude Desktop application.

Python 3.8+ License: MIT MCP Compatible

✨ Features

  • πŸ” Smart PubMed Search - Search scientific publications with advanced filtering

  • πŸ“„ Detailed Article Info - Get comprehensive publication details by PMID

  • πŸ”— Related Articles - Discover similar research papers

  • 🌐 Clickable Links - Direct access to PubMed, DOI, and full-text sources

  • πŸ”’ Secure API Management - Environment-based API key storage

  • ⚑ Fast & Reliable - Optimized API calls with proper error handling

Related MCP server: NCBI Literature Search MCP Server

πŸš€ Quick Start

1. Clone the Repository

git clone https://github.com/yourusername/pubmed-mcp-server.git
cd pubmed-mcp-server

2. Install Dependencies

pip install -r requirements.txt

3. Configure Environment

# Copy the example environment file
cp .env.example .env

# Edit .env with your details
PUBMED_API_KEY=your_api_key_here
PUBMED_EMAIL=your_email@example.com
PUBMED_TOOL_NAME=PubMedMCPServer

πŸ’‘ Getting an API Key: Visit NCBI Account Settings to generate a free API key for better rate limits.

4. Test the Server

python test_server.py

πŸ”§ Claude Desktop Integration

1. Locate Your Claude Desktop Config

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

2. Add Server Configuration

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

3. Restart Claude Desktop

You should now see PubMed tools available in Claude Desktop! πŸŽ‰

πŸ› οΈ Available Tools

search_pubmed

Search PubMed for scientific publications with advanced filtering.

Parameters:

  • query (required): Search terms (e.g., "machine learning healthcare", "CRISPR gene editing")

  • max_results (optional): Results to return (1-50, default: 10)

  • sort (optional): Sort by "relevance", "pub_date", "author", or "journal"

  • date_range (optional): Filter by date ("2020:2024", "last_5_years", "2023")

get_publication_details

Get comprehensive information about a specific publication.

Parameters:

  • pmid (required): PubMed ID of the publication

get_similar_articles

Find articles similar to a given publication.

Parameters:

  • pmid (required): Reference publication PMID

  • max_results (optional): Number of similar articles (1-20, default: 10)

πŸ’¬ Usage Examples

Once connected to Claude Desktop, try these natural language queries:

πŸ” "Search PubMed for recent papers on COVID-19 vaccines published in 2024"
πŸ“„ "Get detailed information for PMID 33301246"
πŸ”— "Find articles similar to PMID 34567890"
πŸ“Š "Look up machine learning applications in radiology from the last 3 years"
🧬 "Search for CRISPR gene editing papers, show me 20 results sorted by date"

⚑ API Rate Limits

  • Without API key: 3 requests/second

  • With API key: 10 requests/second

The server automatically handles rate limiting and includes retry logic.

πŸ› Troubleshooting

Server Won't Start

# Check dependencies
python diagnose.py

# Verify Python version
python --version  # Should be 3.8+

Claude Desktop Not Connecting

  1. Verify file paths in Claude config

  2. Restart Claude Desktop completely

  3. Check server logs for errors

  4. Ensure .env file is properly configured

No Search Results

  • Check internet connection

  • Verify PubMed API accessibility

  • Try simpler search terms

  • Check if API key is valid

πŸ”— API Reference

This server uses the NCBI E-utilities API:

  • E-search: Find publication PMIDs

  • E-fetch: Retrieve detailed article information

  • E-link: Discover related articles

πŸ§ͺ Development

Project Structure

pubmed-mcp-server/
β”œβ”€β”€ server.py              # Main MCP server
β”œβ”€β”€ test_server.py         # Test suite
β”œβ”€β”€ diagnose.py           # Diagnostic tool
β”œβ”€β”€ requirements.txt      # Dependencies
β”œβ”€β”€ .env.example         # Environment template
└── README.md           # Documentation

Adding New Features

  1. New Tools: Extend _setup_handlers() in server.py

  2. API Endpoints: Add methods following PubMed E-utilities

  3. Data Sources: Integrate other NCBI databases (PMC, Taxonomy, etc.)

Running Tests

python test_server.py
python diagnose.py

πŸ“‹ Requirements

  • Python: 3.8 or higher

  • Claude Desktop: Latest version

  • Dependencies: See requirements.txt

  • Optional: NCBI API key for better performance

🀝 Contributing

Contributions welcome! Please:

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Commit changes (git commit -m 'Add amazing feature')

  4. Push to branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support


⭐ Star this repo if it helps your research! ⭐

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers