pubmed-clinical-mcp
Provides tools for searching PubMed/MEDLINE, fetching article metadata, retrieving full text from PubMed Central, checking full-text availability via Unpaywall, finding related articles, building clinical queries, extracting PICO, and summarizing evidence.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pubmed-clinical-mcp search for diabetic foot ulcer classification evidence"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.
Related MCP server: PubMed MCP Server
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 |
| Convert a natural-language clinical question into a PubMed-ready query. |
| Search PubMed and return PMIDs plus lightweight metadata. |
| Fetch detailed PubMed article metadata for PMIDs. |
| Build a query, search, fetch, rank, and return citations in one call. |
| Fetch PMC full-text sections when a PMCID is legally available. |
| Check PMC and Unpaywall for legal full-text access. |
| Find related PubMed articles using NCBI |
| Rank article objects against a clinical question. |
| Extract rough population/intervention/comparator/outcome fields. |
| 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-mcpor:
python -m pubmed_clinical_mcp.serverExample 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 + limitationsDevelopment
Tests use fixtures and do not call live APIs:
PYTHONPATH=src python3 -m unittest discover -s testsCompile check:
PYTHONPATH=src python3 -m compileall src testsAPI 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.
Available Tools
10 toolsbuild_clinical_queryB
Convert a natural-language clinical question into a PubMed-ready query.
Inputs: natural_language_question (required), filters. Returns: object
check_full_text_availabilityC
Check PMC and Unpaywall for legal full-text availability.
Inputs: doi, pmid. Returns: object
extract_picoB
Extract a rough PICO structure from an abstract or article passage.
Inputs: article_text_or_abstract (required). Returns: object
fetch_pmc_full_textB
Fetch legal PubMed Central full-text sections when a PMCID is available.
Inputs: pmid, pmcid. Returns: object
fetch_pubmed_articlesC
Fetch PubMed title, abstract, authors, journal, year, DOI, MeSH, and publication types.
Inputs: pmids (required). Returns: object
rank_articlesA
Rank article summaries against a clinical question and explain relevance.
Inputs: articles (required), clinical_question (required). Returns: object
search_and_fetch_pubmedC
Build a clinical PubMed query, search PubMed, fetch articles, and return ranked summaries.
Inputs: clinical_question (required), filters, max_results. Returns: object
search_pubmedB
Search PubMed and return PMIDs plus a lightweight metadata summary.
Inputs: query (required), filters, max_results. Returns: object
summarize_evidenceC
Summarize article evidence into a table, limitations, and citation-backed findings.
Inputs: articles (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool has a clearly distinct purpose: building queries, checking availability, extracting PICO, fetching full text, fetching articles, finding related articles, ranking, searching (with and without full pipeline), and summarizing. No ambiguity.
All tool names follow a consistent verb_noun pattern in snake_case (e.g., build_clinical_query, fetch_pubmed_articles, summarize_evidence). No deviations or mixed conventions.
10 tools is well-scoped for a clinical PubMed assistant. Each tool serves a distinct step in the research workflow without unnecessary overlap or missing critical functionality.
The tool set covers the full clinical evidence retrieval workflow: natural language query conversion, search, article fetch, full text retrieval, PICO extraction, ranking, summarization, and related article discovery. No obvious gaps.
Maintenance
Related MCP Connectors
Auditable MCP server for PubMed, Europe PMC, ClinicalTrials.gov, and bioRxiv/medRxiv queries
PubMed MCP — wraps the NCBI E-utilities API (biomedical literature, free, no auth)
PubTator 3 MCP — biomedical entity search, literature search with entity highlighting, and…
Europe PMC MCP — biomedical literature.
Related MCP Servers
- AlicenseAqualityCmaintenanceAn MCP server that provides access to PubMed articles through the Entrez API.291 PyPI171MIT
- -licenseNot gradedqualityNot gradedmaintenanceAn MCP server implementation that enables searching and retrieving research articles from PubMed with specific focus on open access content filtering and full-text link retrieval.8 npm3-
- AlicenseNot gradedqualityDmaintenanceMCP server for PubMed search and literature summarization52MIT
- AlicenseAqualityDmaintenance轻量级MCP服务器,提供学术文献检索、论文详情、全文下载等功能,可配合PubMed MCP用于生物医学检索链路。826 npm3ISC