An MCP server for searching, retrieving, and analyzing articles from PubMed
Project description
PubMed MCP Server
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
- Clone this repository:
git clone https://github.com/uh-joan/pubmed-mcp-server.git
cd pubmed-mcp-server
- Install dependencies:
pip install -r requirements.txt
- 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:
- Replace
/path/to/pubmed-mcp-serverwith your actual project path - 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 stringmax_results: Maximum results to return (default: 10)sort: Sort order ('relevance', 'date', 'author')filters: Additional search filtersdate_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
- Start in development mode:
DEV_MODE=true python pubmed_server.py
- Run with debug logging:
LOG_LEVEL=debug python pubmed_server.py
- 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
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uh_joan_pubmed_mcp_server-0.1.4.tar.gz.
File metadata
- Download URL: uh_joan_pubmed_mcp_server-0.1.4.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
115e9ed743d95599902a77dffd92f5ddcb066a7eb17f793e7777b6e81122ef49
|
|
| MD5 |
f6eb89f4f53a5e81e2596628bebe0997
|
|
| BLAKE2b-256 |
69a5f36a4b18fe8758fce5547147f6891cd1563d021aa832e1cdaf9e4e78ab2e
|
File details
Details for the file uh_joan_pubmed_mcp_server-0.1.4-py3-none-any.whl.
File metadata
- Download URL: uh_joan_pubmed_mcp_server-0.1.4-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
531132253e2abf5dcb6816e118ffd0338898896ce686569cabafa1d421a3f5b4
|
|
| MD5 |
e10872cd489defdcf29c69a63db410c3
|
|
| BLAKE2b-256 |
2b7453fdf38dc07a656a90a7b8446990cdf3db1bab0de6ae946fdbd4b2f4ac0d
|