pubmed-clinical-mcp
A lightweight MCP server for clinical biomedical literature retrieval, enabling PubMed search, article metadata, full-text access, and evidence summarization through MCP-compatible clients.
README
PubMed Clinical MCP
pubmed-clinical-mcp is a lightweight Model Context Protocol (MCP) server for clinical biomedical literature retrieval. It gives MCP-compatible clients reusable tools for PubMed/MEDLINE search, article metadata retrieval, PubMed Central full text, full-text availability checks, related articles, clinical query building, PICO extraction, article ranking, and evidence summarization.
This project is designed for clinical evidence support and research workflows. It is not a diagnosis system, treatment recommendation system, paywall bypasser, or institutional-library automation tool.
Why This Exists
Many medical agents need reliable access to public biomedical literature, but PubMed handling often gets mixed into one-off application code. This package separates that capability into a standalone MCP server so tools like Codex, Claude Desktop, Cursor, or other MCP clients can call PubMed-focused tools directly.
Features
- PubMed/MEDLINE search through NCBI E-utilities.
- PubMed article fetching with title, abstract, authors, journal, year, DOI, PMCID, MeSH terms, publication types, and URL.
- PubMed Central open-access full-text section retrieval when legally available.
- Related PubMed article lookup through NCBI
elink. - Unpaywall DOI availability checks for legal open-access links.
- Clinical query builder for natural-language medical questions.
- Article ranking against a clinical question with relevance reasons.
- Rough PICO extraction from abstracts or article passages.
- Citation-backed evidence table and limitations summary.
- Retry/backoff on
429and transient server failures. - Optional local JSON cache.
- Tests use local fixtures, so CI does not need live API access.
Tool List
| Tool | Purpose |
|---|---|
build_clinical_query |
Convert a natural-language clinical question into a PubMed-ready query. |
search_pubmed |
Search PubMed and return PMIDs plus lightweight metadata. |
fetch_pubmed_articles |
Fetch detailed PubMed article metadata for PMIDs. |
search_and_fetch_pubmed |
Build a query, search, fetch, rank, and return citations in one call. |
fetch_pmc_full_text |
Fetch PMC full-text sections when a PMCID is legally available. |
check_full_text_availability |
Check PMC and Unpaywall for legal full-text access. |
find_related_articles |
Find related PubMed articles using NCBI elink. |
rank_articles |
Rank article objects against a clinical question. |
extract_pico |
Extract rough population/intervention/comparator/outcome fields. |
summarize_evidence |
Produce an evidence table, citation-backed findings, and limitations. |
Install
git clone https://github.com/jxia622/pubmed-clinical-mcp.git
cd pubmed-clinical-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
Optional Environment Variables
No paid keys are required. For low-volume demos, the server can run without API keys.
export NCBI_EMAIL="you@example.com"
export NCBI_API_KEY="optional_free_ncbi_key"
export UNPAYWALL_EMAIL="you@example.com"
export PUBMED_MCP_CACHE_PATH=".cache/pubmed_clinical_mcp.json"
Notes:
NCBI_EMAILis recommended for NCBI E-utilities usage.NCBI_API_KEYis optional and raises NCBI rate limits.UNPAYWALL_EMAILis required for Unpaywall checks.PUBMED_MCP_CACHE_PATHenables a simple local JSON cache.
Run The MCP Server
pubmed-clinical-mcp
or:
python -m pubmed_clinical_mcp.server
Example MCP Client Config
{
"mcpServers": {
"pubmed-clinical": {
"command": "python",
"args": ["-m", "pubmed_clinical_mcp.server"],
"env": {
"NCBI_EMAIL": "you@example.com",
"PUBMED_MCP_CACHE_PATH": ".cache/pubmed_clinical_mcp.json"
}
}
}
}
Example Tool Calls
Build a PubMed query
{
"natural_language_question": "Why might a diabetic foot ulcer be Wagner grade 2 instead of grade 1?",
"filters": {
"english_only": true,
"year_from": 2020
}
}
Example output:
{
"query": "(\"diabetic foot\"[Title/Abstract] OR \"diabetic foot ulcer\"[Title/Abstract]) AND (Wagner[Title/Abstract] OR classification[Title/Abstract] OR staging[Title/Abstract]) AND english[Language] AND (\"2020\"[Date - Publication] : \"3000\"[Date - Publication])",
"explanation": [
"Mapped diabetic foot ulcer + Wagner wording to title/abstract terms for classification and staging."
],
"filters": {
"english_only": true,
"year_from": 2020
}
}
Search and fetch ranked PubMed articles
{
"clinical_question": "What evidence supports using wound depth in diabetic foot ulcer severity assessment?",
"filters": {
"english_only": true
},
"max_results": 10
}
Returns:
query_usedquery_explanationranked_articlescitations
Fetch PMC full text
{
"pmcid": "PMC9446755"
}
Returns parsed sections when the article is available in PubMed Central.
Architecture
flowchart LR
Client["MCP client"] --> Server["pubmed-clinical-mcp server"]
Server --> Query["clinical query builder"]
Server --> PubMed["NCBI PubMed E-utilities"]
Server --> PMC["PubMed Central XML"]
Server --> Unpaywall["Unpaywall API"]
Server --> Rank["ranking + PICO + summarization helpers"]
Server --> Cache["optional JSON cache"]
Core modules:
src/pubmed_clinical_mcp/
server.py # MCP tool definitions
sources/pubmed.py # PubMed esearch, efetch, elink
sources/pmc.py # PMC full-text XML parsing
sources/unpaywall.py # DOI open-access checks
clinical/query_builder.py # natural language -> PubMed query
clinical/ranking.py # relevance ranking
clinical/pico.py # rough PICO extraction
clinical/summarizer.py # evidence table + limitations
Development
Tests use fixtures and do not call live APIs:
PYTHONPATH=src python3 -m unittest discover -s tests
Compile check:
PYTHONPATH=src python3 -m compileall src tests
API And Rate-Limit Notes
- PubMed and PMC use NCBI E-utilities.
- NCBI allows higher request rates when
NCBI_API_KEYis configured. - The server includes basic retry/backoff for
429and transient5xxfailures. - The cache is intentionally simple and optional. It is not a vector database.
Safety And Scope
This server:
- retrieves public biomedical literature metadata and legal open-access text;
- does not diagnose;
- does not prescribe treatment;
- does not bypass paywalls;
- does not scrape publisher websites;
- does not automate university or hospital library login;
- does not store institutional credentials.
Any clinical interpretation should be performed by qualified clinicians using the retrieved sources and appropriate guidelines.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。