Skip to main content

A Model Context Protocol (MCP) server for PubMed biomedical research database

Project description

MCP PubMed Server

A Model Context Protocol (MCP) server that provides access to PubMed, the comprehensive biomedical literature database maintained by NCBI. This server enables AI assistants like Claude to search and retrieve detailed information from millions of biomedical research articles.

Features

  • Search PubMed Database: Search across 39+ million biomedical articles using flexible query syntax
  • Retrieve Article Details: Get complete article metadata, abstracts, authors, and publication information
  • Database Information: Access current PubMed database statistics and status
  • API Key Support: Optional NCBI API key integration for enhanced rate limits
  • MCP Protocol: Full Model Context Protocol compliance for seamless AI assistant integration

Installation

From PyPI (Recommended)

pip install mcp-pubmed

From Source

git clone <repository-url>
cd mcp-pubmed
pip install -e .

Usage

As MCP Server

The server can be run directly:

mcp-pubmed

Claude Desktop Integration

Add to your Claude Desktop configuration (claude_desktop_config.json):

{
  "mcpServers": {
    "pubmed": {
      "command": "mcp-pubmed",
      "args": [],
      "env": {
        "PUBMED_API_KEY": "your_api_key_here_optional"
      }
    }
  }
}

API Key Setup (Optional)

For enhanced rate limits, obtain a free API key from NCBI:

  1. Visit NCBI API Key Settings
  2. Create an account or log in
  3. Generate an API key
  4. Set environment variable: export PUBMED_API_KEY="your_key_here"

Available Tools

search_pubmed

Search the PubMed database with flexible query syntax.

Parameters:

  • term (required): Search query using PubMed syntax
  • retmax (optional): Maximum results to return (1-1000, default: 20)
  • email (optional): Your email for NCBI tracking

Example:

{
  "term": "BRCA1 mutations AND breast cancer",
  "retmax": 10
}

get_pubmed_details

Retrieve detailed information for specific PubMed articles.

Parameters:

  • id (required): PubMed ID(s) - single ID or array of IDs

Example:

{
  "id": ["35123456", "35789012"]
}

get_pubmed_info

Get current information about the PubMed database.

Parameters: None

Query Syntax Examples

  • Basic search: "covid vaccine"
  • Multiple terms: "BRCA1 AND breast cancer"
  • Author search: "Smith J[Author]"
  • Date range: "covid vaccine" AND 2020:2023[dp]
  • Journal: "Nature[Journal]"
  • Title search: "machine learning"[Title]

Error Handling

The server provides comprehensive error handling for:

  • Invalid queries or parameters
  • Network connectivity issues
  • Rate limiting (automatically handled)
  • Invalid PubMed IDs
  • API key validation

Development

Testing

Run the test suite:

python test_focused.py

Requirements

  • Python 3.10+
  • httpx>=0.25.0
  • mcp>=1.0.0
  • pydantic>=2.0.0
  • email-validator>=2.0.0

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues.

Support

For issues and questions:

  • Check the troubleshooting section below
  • Open an issue on the repository

Troubleshooting

Connection Issues

  • Verify internet connectivity
  • Check if NCBI servers are accessible
  • Ensure firewall allows outbound HTTPS connections

Rate Limiting

  • Consider adding a PUBMED_API_KEY for higher limits
  • Reduce query frequency
  • Check NCBI rate limiting guidelines

Invalid Results

  • Verify PubMed ID format (numeric)
  • Check query syntax against PubMed documentation
  • Ensure search terms are properly formatted

Made with ❤️ for biomedical research and AI assistance

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

autocleaneeg_pubmedmcp-1.0.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

autocleaneeg_pubmedmcp-1.0.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file autocleaneeg_pubmedmcp-1.0.0.tar.gz.

File metadata

File hashes

Hashes for autocleaneeg_pubmedmcp-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7ed0bacd491308301d1ac9e8464264df495a912b57ee88420951be12ac80fa9b
MD5 75330be98ffe3cb7f5b4cab53c8f3f10
BLAKE2b-256 c554ea8fe3da2cf46aad903547decc1bfc580481508933976d168bbad561f0b6

See more details on using hashes here.

File details

Details for the file autocleaneeg_pubmedmcp-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for autocleaneeg_pubmedmcp-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80fb3feba6ee38c27ad1ec82bb18687ea06f3a1e7f2c137db0eace257da46a42
MD5 0e97cce7a2f4b336823f1a566fb55edc
BLAKE2b-256 4cd21ccf2e3ffd86ccecd3f1f663b8d824fb2044e6dd3d32b306d2e5a38346b5

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