masa061580/pubmed_mcp_server2
If you are the rightful owner of pubmed_mcp_server2 and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The PubMed MCP Server v2 is a comprehensive Model Context Protocol server designed to enhance access to the PubMed database for biomedical literature search, retrieval, and analysis.
PubMed MCP Server v2 (Version 1.0.2)
A comprehensive Model Context Protocol (MCP) server that provides advanced access to the PubMed database for biomedical literature search, retrieval, and analysis. This server transforms natural language queries into optimized PubMed searches using MeSH terms and provides citation analysis capabilities.
š Features
š§ Tools
search_pubmed
: Search PubMed database with comprehensive article summaries, abstracts, and metadataget_full_abstract
: Retrieve complete, untruncated abstracts for specific articles by PMIDget_full_text
: Extract full text content from PubMed Central (PMC) open access articlesexport_ris
: Export citations in RIS format for reference management software (Zotero, Mendeley, EndNote)get_citation_counts
: Analyze citation metrics and find citing articles using NCBI elink APIoptimize_search_query
āØ: Transform natural language queries into optimized PubMed searches with MeSH terms and field tagsfind_similar_articles
: Find articles similar to a given PMID using NCBI's similarity algorithm with relevance scoresbatch_process
š: Process multiple PMIDs with multiple operations efficiently for bulk analysis
š Resources
pubmed://search/{query}
: Access search results as structured JSON resource
š” Prompts
generate_search_query
: Interactive assistant for creating effective PubMed search strategies
š Prerequisites
- Node.js v18.x or higher
- npm or yarn package manager
šÆ Usage
Method 1: NPM Package (Recommended)
Benefits: Easy installation, automatic updates, no local build required.
Claude Desktop Configuration
Add to your Claude Desktop configuration file:
Windows: %APPDATA%\\Claude\\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"pubmed": {
"command": "npx",
"args": ["-y", "pubmed_mcp_server2"]
}
}
}
Claude Code Configuration
claude mcp add pubmed -s project -- cmd /c npx pubmed_mcp_server2
Method 2: Local Development
Use case: For development, customization, or when you want to modify the source code.
š ļø Installation
- Clone this repository:
git clone https://github.com/YOUR_USERNAME/pubmed_mcp_server2.git
cd pubmed_mcp_server2
- Install dependencies:
npm install
- Build the server:
npm run build
Claude Desktop Integration (Local)
Add to your Claude Desktop configuration file:
Windows: %APPDATA%\\Claude\\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"pubmed-server": {
"command": "node",
"args": ["C:\\path\\to\\pubmed_mcp_server2\\dist\\index.js"],
"env": {}
}
}
}
Replace the path with your actual installation directory.
Example Usage
1. Query Optimization
Input: "covid vaccine effectiveness in elderly"
ā Transforms to: ("COVID-19"[MeSH Terms] OR "SARS-CoV-2"[MeSH Terms]) AND ("Vaccination"[MeSH Terms]) AND ("Treatment Outcome"[MeSH Terms]) AND ("Aged"[MeSH Terms])
2. Basic Literature Search
search_pubmed: "diabetes treatment 2023"
ā Returns: Detailed articles with abstracts, PMIDs, DOIs, and citation metrics
3. Citation Analysis
get_citation_counts: "36038128, 30105375"
ā Returns: Citation counts and lists of citing articles for each PMID
4. Reference Management
export_ris: "36038128, 30105375"
ā Returns: RIS formatted citations ready for import into reference managers
5. Find Similar Articles
find_similar_articles: "36038128"
ā Returns: Up to 10 similar articles ranked by NCBI's similarity algorithm
ā Each result includes similarity score, title, authors, abstract preview
6. Batch Processing (NEW in v1.0.2)
batch_process: {pmids: ["36038128", "35105375"], operations: ["abstract", "citations"]}
ā Returns: Comprehensive analysis of multiple articles in one request
ā Supports: abstract, citations, similar, ris_export, full_text operations
š§ MeSH Term Optimization
The server includes an extensive database of medical term mappings covering:
- COVID-19 & Vaccines: covid, coronavirus, vaccination, immunization
- Cardiovascular: heart attack, myocardial infarction, cardiovascular disease
- Cancer: cancer, tumor, oncology, carcinoma
- Mental Health: depression, anxiety, psychiatric disorders
- Age Groups: elderly, children, pediatric, adolescent
- Study Types: clinical trial, meta-analysis, systematic review, RCT
- Treatment Types: therapy, surgery, medication, drug treatment
š§ Advanced Search Features
Field Tags Supported
[ti]
- Title[ab]
- Abstract[au]
- Author[ta]
- Journal Title[MeSH Terms]
- Medical Subject Headings[tw]
- Text Word[pt]
- Publication Type[pdat]
- Publication Date
Boolean Operators
AND
- All terms must be presentOR
- Any of the terms can be presentNOT
- Exclude specific terms- Parentheses for grouping complex queries
š API Endpoints & Rate Limiting
NCBI E-utilities APIs Used
- ESearch: Search and retrieve primary IDs
- EFetch: Retrieve full records and abstracts
- ESummary: Retrieve document summaries
- ELink: Find related articles and citations
- Literature Citation Exporter: RIS format export
Rate Limiting & Limits
- Search results: Maximum 100 articles per query
- Citation analysis: Maximum 20 PMIDs per request
- RIS export: Maximum 50 PMIDs per batch
- Full text: Maximum 10 PMC articles per request
- Similar articles: Maximum 50 similar articles per PMID (default: 10)
- Batch processing: Maximum 50 PMIDs per batch with up to 5 concurrent operations
- API delays: 200-600ms between requests to respect NCBI guidelines
āļø Configuration
Customizable Parameters
Edit src/pubmed-api.ts
to modify:
// Email for NCBI API (required by NCBI guidelines)
email: 'your-email@example.com'
// Rate limiting delays
const delayBetweenRequests = 200; // milliseconds
// Result limits
const maxResults = 100; // search results
const maxPmids = 20; // citation analysis
š Error Handling
Comprehensive error handling for:
- Network connectivity issues
- Invalid PMIDs or queries
- API rate limiting and timeouts
- XML/JSON parsing errors
- Missing full text content
- Citation data unavailability
š§ Development
Available Scripts
npm run build # Compile TypeScript
npm run dev # Build and run in development
npm run clean # Remove compiled files
npm run start # Start the compiled server
Project Structure
pubmed_mcp_server2/
āāā src/
ā āāā index.ts # Main MCP server setup and tool registration
ā āāā pubmed-api.ts # PubMed API integration and utilities
āāā dist/ # Compiled JavaScript output
āāā package.json # Dependencies and scripts
āāā tsconfig.json # TypeScript configuration
āāā README.md # This file
Adding New Features
- New MeSH mappings: Add to
MESH_MAPPINGS
object inpubmed-api.ts
- New tools: Register in
index.ts
usingserver.registerTool()
- Field tags: Add to
FIELD_TAGS
object for query optimization
š¤ Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name
- Make your changes and test thoroughly
- Commit with descriptive messages:
git commit -m "Add feature description"
- Push to your branch:
git push origin feature-name
- Submit a pull request
š Documentation
PubMed Search Tips
- Use MeSH terms for standardized medical vocabulary
- Combine multiple concepts with AND/OR operators
- Use field tags to target specific parts of articles
- Add date ranges to focus on recent research
- Filter by publication type for specific study designs
Reference Management Integration
The RIS export feature supports:
- Zotero: File ā Import
- Mendeley: File ā Import ā RIS
- EndNote: File ā Import ā File
- Papers: Import ā From File
- RefWorks: Import ā References
š”ļø Privacy & Ethics
- No user data is stored or logged
- All queries are sent directly to NCBI APIs
- Complies with NCBI usage guidelines
- Respects API rate limits and terms of service
š License
MIT License - see LICENSE file for details
šāāļø Support
For issues, questions, or contributions:
- Check existing issues on GitHub
- Create a new issue with detailed description
- Include error messages and steps to reproduce
š¦ Installation Options
Quick Start (NPM)
npm install -g pubmed_mcp_server2
Update to Latest Version
npm update -g pubmed_mcp_server2
š Version History
v1.0.2 (Latest)
- š Batch Processing: Process multiple PMIDs with multiple operations efficiently
- š§ Flexible Input: Support for array, space-separated, and comma-separated PMID input
- š Enhanced Analytics: Improved citation analysis and error reporting
- ā” Performance: Optimized API rate limiting and concurrent processing
v1.0.1
- š Similar Articles: Find articles similar to a given PMID using NCBI's algorithm
- šÆ Improved Relevance: Similarity scores and ranking
- š§ Bug Fixes: Enhanced error handling and API stability
v1.0.0
- š Initial Release: Core PubMed search and analysis functionality
- š Full Features: Search, abstracts, citations, RIS export, query optimization