Purpose
ncbi-mcp-server is a Model Context Protocol (MCP) server for searching NCBI databases, designed specifically for researchers in the life sciences and biomedical fields. It provides access to over 35 million scientific articles in PubMed through natural language queries, enabling AI assistants to assist with literature reviews, research discovery, and scientific analysis.
Key Capabilities
- Comprehensive search: Search over 35 million articles in PubMed, covering all biological disciplines.
- Advanced queries: Support complex searches with Boolean operators, field tags, and filters.
- Life science research: Cover all biological and biomedical fields such as genetics, ecology, medicine, and biotechnology.
- Computational biology: Suitable for finding bioinformatics methods, algorithms, and computational tools.
- Research applications: Literature reviews, hypothesis generation, method discovery, and tracking scientific progress.
- Full article details: Retrieve abstracts, author lists, MeSH terms, DOI, and publication information.
- Related articles: Discover related research through NCBI's relationship algorithms.
- MeSH integration: Search and use Medical Subject Headings for precise terminology.
- Analysis and performance monitoring: Includes total requests, runtime, operation breakdown, cache performance metrics, recent activity, and error rates.
- Batch processing: Support retrieving detailed information for multiple articles at once.
Usage
Environment Requirements
- Python 3.8 or later
- Poetry (recommended)
Setup Steps
- Create and initialize the project:
mkdir ncbi-mcp-server && cd ncbi-mcp-server, thenpoetry init. Add dependencies during initialization:mcp、httpx、typing-extensions. - Create the project structure:
mkdir -p src/ncbi_mcp_server, save the server.py code assrc/ncbi_mcp_server/server.py. - Install dependencies:
poetry install. - Test the server:
poetry run python src/ncbi_mcp_server/server.py. - Configure Claude Desktop: Edit the configuration file (macOS:
~/Library/Application Support/Claude/claude_desktop_config.json;Windows:%APPDATA%/Claude/claude_desktop_config.json;Linux:~/.config/claude/claude_desktop_config.json), add the configuration:
{
"mcpServers": {
"ncbi-literature": {
"command": "poetry",
"args": ["run", "python", "src/ncbi_mcp_server/server.py"],
"cwd": "/FULL/PATH/TO/YOUR/ncbi-mcp-server"
}
}
}
- Restart Claude Desktop and begin searching.
Deployment Options
- Local development:
./deploy.sh local, suitable for development and testing. - Docker deployment:
./deploy.sh docker, providing a complete setup (including Redis cache and Redis Commander UI) or a simple setup (server container only, in-memory cache). - Production deployment:
./deploy.sh production, suitable for production environments.
Configure Credentials
Copy .env.example as .env, edit and fill in the NCBI email and API key. The API key is optional but recommended, for higher request limits: without an API key it is 3 requests/second; with an API key it is 10 requests/second; with an API key and email, the batch request limit is higher.
Tools and Features
- search_pubmed: The main search tool, supporting query terms (field tags such as [ti], [au], [mh]), maximum number of results (1-100, default 20), sort method (relevance, publication date, author, journal), and date range (30, 90, 365, 1095 days).
- get_article_details: Retrieves complete information for specific articles, supporting up to 50 PMIDs, and returns abstracts, author lists, MeSH terms, DOI, and publication details.
- search_mesh_terms: Finds standard medical subject headings, helping to discover related concepts and improve search precision.
- get_related_articles: Discovers articles related to a specific paper, supporting up to 50 results (default 10).
- advanced_search: Performs complex searches using multiple criteria, supporting term combinations (AND, OR, NOT), authors, journals, publication types, and date ranges.
- Analytics tools: Retrieve a comprehensive overview (total requests, runtime, operation breakdown, cache metrics, recent activity, error rate), detailed performance metrics for a specific time period, and reset analytics data.
Applicable Scenarios
- Evolutionary biology and phylogenetics
- Computational biology and bioinformatics
- Molecular evolution and population genetics
- Comparative genomics and proteomics
- Systems biology and network analysis
- Biostatistics and mathematical biology
- Ancient DNA and paleogenomics
- Conservation genetics and ecology
Limitations
- Requires Python 3.8+ and a Poetry environment.
- Without an API key, the request limit is 3 requests/second, which may affect large numbers of searches.
- Resetting analytics data permanently clears all collected metrics.
- XML parsing errors may be caused by temporary issues with NCBI servers and require retrying.
- This server currently mainly targets PubMed; other databases such as PMC, BioRxiv, etc. are not yet provided.