pubmed-evidence
Enables PubMed literature search, metadata retrieval, BibTeX export, and evidence table generation for biomedical research agents.
README
mcp-pubmed-evidence
MCP server for reliable PubMed literature retrieval, BibTeX export, and evidence table generation for biomedical research agents.
This project exposes PubMed as structured MCP tools so AI assistants can retrieve biomedical literature with source URLs, PMID/DOI metadata, article types, and citation-ready outputs instead of relying on model memory.
Status
Early development. The first version focuses on PubMed metadata retrieval and citation provenance.
Features
- Search PubMed with optional year and publication type filters
- Search ClinicalTrials.gov by query, condition, intervention, status, and result limit
- Report result-limit metadata, including requested limits, effective limits, returned counts, and truncation flags
- Summarize source provenance at the response level so agents can see which databases contributed results
- Validate biomedical research queries and reject obvious personal medical advice requests
- Optionally write local JSONL audit logs for MCP tool calls without storing full query text or abstracts
- Fetch normalized metadata for a PubMed article by PMID
- Export PubMed records as BibTeX entries
- Build compact evidence tables for agent workflows
- Return structured PubMed fields such as PMID, title, authors, journal, year, DOI, abstract, article types, and PubMed URL
- Return structured trial fields such as NCT ID, condition, intervention, phase, status, enrollment, outcomes, locations, sponsors, and linked publication references
Why MCP for Biomedical Evidence
Biomedical research agents need reliable access to current, source-backed evidence. A plain chatbot can answer from model memory, but it may miss recent papers, blur study types, or provide weak citations. This MCP server gives agents a controlled tool layer for PubMed retrieval, ClinicalTrials.gov trial registry retrieval, structured metadata, citation export, and evidence-table generation.
The goal is not to make medical decisions. The goal is to help agents retrieve and organize biomedical literature with provenance, stable schemas, and clear source URLs.
Safety scope
This server is intended for biomedical research support, literature discovery, citation management, and evidence organization. It is not intended for diagnosis, treatment recommendations, or medical advice.
Tools reject obvious personal medical advice prompts such as requests to diagnose the user, prescribe medication, or decide whether the user should take or stop a treatment. Research-oriented terms such as diagnosis, treatment, and therapy remain valid when used for literature or trial retrieval.
Installation
git clone https://github.com/Tianyu-Qu/mcp-pubmed-evidence.git
cd mcp-pubmed-evidence
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .[dev]
For macOS/Linux, activate the virtual environment with:
source .venv/bin/activate
MCP Configuration
This server uses MCP stdio transport and can be used by any MCP-compatible client.
Generic stdio configuration:
{
"command": "python",
"args": ["-m", "mcp_pubmed_evidence.server"],
"env": {
"PYTHONPATH": "/path/to/mcp-pubmed-evidence/src"
}
}
Claude Desktop example:
{
"mcpServers": {
"pubmed-evidence": {
"command": "python",
"args": ["-m", "mcp_pubmed_evidence.server"],
"env": {
"PYTHONPATH": "/path/to/mcp-pubmed-evidence/src"
}
}
}
}
Replace /path/to/mcp-pubmed-evidence/src with the absolute path to your local src directory. On Windows, it may look like C:\\path\\to\\mcp-pubmed-evidence\\src.
If you install the project into the same Python environment used by your MCP client, you can omit PYTHONPATH.
If your network requires a proxy, add HTTP_PROXY and HTTPS_PROXY to env:
"HTTP_PROXY": "http://127.0.0.1:7890",
"HTTPS_PROXY": "http://127.0.0.1:7890"
Local Demo
You can test PubMed retrieval without an MCP client:
python examples/search_pubmed.py "Alzheimer disease machine learning" --max-results 3
With a year filter:
python examples/search_pubmed.py "Alzheimer disease machine learning" --max-results 5 --year-from 2022 --year-to 2026
Search ClinicalTrials.gov without an MCP client:
python examples/search_trials.py --condition "Alzheimer disease" --intervention "GLP-1" --max-results 5
Build a unified PubMed + ClinicalTrials.gov evidence table without an MCP client:
python examples/build_biomedical_evidence_table.py --query "Alzheimer disease machine learning" --condition "Alzheimer disease" --max-pubmed-results 2 --max-trial-results 2
To print the same rows as JSON:
python examples/build_biomedical_evidence_table.py --query "Alzheimer disease machine learning" --condition "Alzheimer disease" --max-pubmed-results 2 --max-trial-results 2 --json
Example outputs are available in examples/sample_search_output.json, examples/sample_trial_output.json, and examples/sample_biomedical_evidence_table.json.
You can also verify the MCP stdio server locally by listing its tools:
python examples/mcp_list_tools.py
Expected tools:
search_pubmed
get_pubmed_article
get_abstract
export_bibtex
build_evidence_table
search_trials
get_trial_summary
map_trial_to_publications
build_biomedical_evidence_table
Demo
Verified with Cursor as an MCP client. Cursor connected to the pubmed-evidence server and called the search_pubmed tool for the query Alzheimer disease machine learning with max_results=3.

Additional result screenshots:


Tools
search_pubmed
Search PubMed and return normalized article metadata.
Search responses include metadata with source_name, source_url, query_summary, requested_max_results, effective_max_results, max_allowed_results, returned_count, total_available when available, and truncated.
Inputs:
query: PubMed search querymax_results: maximum number of articles to return, capped at 50year_from: optional publication year lower boundyear_to: optional publication year upper boundarticle_types: optional publication type filters, such asRevieworRandomized Controlled Trial
get_pubmed_article
Fetch one PubMed article by PMID.
export_bibtex
Fetch PubMed articles by PMID and export BibTeX entries.
build_evidence_table
Fetch PubMed articles by PMID and return compact evidence table rows.
search_trials
Search ClinicalTrials.gov and return compact trial records.
Search responses include metadata with source provenance, query summary, result-limit, and truncation information.
Inputs:
query: optional general trial querycondition: optional condition or disease filterintervention: optional intervention, drug, or device filterstatus: optional recruitment status filtermax_results: maximum number of trials to return, capped at 50
get_trial_summary
Fetch one ClinicalTrials.gov trial by NCT ID and return detailed structured metadata including arms, outcomes, eligibility, locations, sponsors, collaborators, references, and result references.
map_trial_to_publications
Map one ClinicalTrials.gov NCT ID to linked PubMed publications when PMIDs are available in ClinicalTrials.gov references.
build_biomedical_evidence_table
Build a unified biomedical evidence table from PubMed articles and ClinicalTrials.gov trial records.
Inputs:
query: optional PubMed query and optional trial querycondition: optional condition or disease filter for ClinicalTrials.govintervention: optional intervention, drug, or device filter for ClinicalTrials.govmax_pubmed_results: maximum PubMed records to includemax_trial_results: maximum ClinicalTrials.gov records to include
Returns metadata plus integrated evidence rows. Rows include source type, source ID, title, date/year, study type, status, phase, conditions, interventions, outcomes, DOI, URL, and provenance.
The metadata includes query summary, sources used, source counts, requested/effective PubMed and ClinicalTrials.gov result limits, maximum allowed limits, returned row count, and whether a requested limit was truncated.
Development
Run tests:
pytest
Run linting:
ruff check .
Audit Logging
Audit logging is disabled by default. To enable local JSONL audit logs for MCP tool calls, set MCP_PUBMED_EVIDENCE_AUDIT_LOG to a file path before starting the MCP server:
$env:MCP_PUBMED_EVIDENCE_AUDIT_LOG = "F:\Healthcare\mcp-pubmed-evidence\audit.jsonl"
Audit events include timestamp, tool name, status, sanitized argument summaries, result counts, truncation flags, and source counts when available. They intentionally do not store full query text, abstracts, eligibility criteria, or other long biomedical text fields.
Limitations
- PubMed and ClinicalTrials.gov metadata can be incomplete; DOI, abstract, author, journal, publication date, outcomes, locations, or linked PMIDs may be missing.
- Evidence tables are metadata-oriented in the first version and do not extract PICO elements or judge study quality.
- Result limits are capped to keep MCP responses manageable; tools report truncation metadata when a request exceeds the configured limit or when a source reports more available records than returned.
- Query validation is a lightweight safety guardrail, not a complete medical-intent classifier.
- Audit logging is local and opt-in; users are responsible for choosing an appropriate log path and retention policy.
- The server does not provide diagnosis, treatment recommendations, or medical advice.
- Network access to PubMed may require a proxy depending on the user's environment.
- Tool outputs should be reviewed by a human before being used in manuscripts, clinical documents, or systematic reviews.
Release Notes
See CHANGELOG.md for v0.1.0 release notes.
v0.3.0 Development
The next milestone, v0.3.0 Evidence Table 2.0, introduces a unified biomedical evidence row schema for combining PubMed articles and ClinicalTrials.gov trial records. The build_biomedical_evidence_table MCP tool now returns integrated evidence rows with source provenance.
v0.4.0 Development
The v0.4.0 Evidence Quality & Safety milestone adds guardrails for agent-facing biomedical tools. Current improvements add explicit result-limit, truncation, query-summary, source-provenance metadata, lightweight biomedical query validation, and opt-in local audit logging so MCP clients can tell where evidence came from, whether a response was capped, and whether a request falls outside the research-support scope.
Roadmap
- Expand ClinicalTrials.gov result fields and examples
- Add OpenAlex/Crossref DOI resolution
- Add richer evidence table extraction
- Add example MCP client configurations
- Add local PDF library support
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。