pubmed-access-mcp
v0.3.1A minimal, auditable Model Context Protocol (MCP) server for PubMed via NCBI E-utilities with open-access detection.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
search_pubmed
Search PubMed (NCBI esearch) and return PMIDs exactly as NCBI returns them. Args: query: PubMed query; supports field tags, MeSH and Boolean, e.g. '"hypertrophic cardiomyopathy"[MeSH] AND mavacamten[tiab] AND randomized controlled trial[pt]'. max_results: 1-9999 (default 20). `total_matches` reports the full hit count. sort: 'relevance' or 'pub_date' (newest first). date_from / date_to: optional publication-year bounds (e.g. 2018, 2025). Returns pmids, total_matches and query_translation (how PubMed interpreted the query; log it for reproducibility…
| Parameter | Type | Description |
|---|---|---|
query * | string | |
date_from | ||
date_to | ||
max_results | integer | |
sort | string |
fetch_abstracts
Fetch exact PubMed records (NCBI efetch) for up to 200 PMIDs. Per record: pmid, title, authors, journal, pub_date, doi, publication_types, has_retraction_notice, abstract (structured abstracts keep their section labels), url. Any field PubMed does not provide is the literal string 'Data not provided in PubMed abstract'. PMIDs NCBI did not return are listed in `not_found`. Never infer or complete missing text.
| Parameter | Type | Description |
|---|---|---|
pmids * | array |
check_access
Classify each PMID as open-access PDF, open-access landing page only, no open access found (likely paywalled), or unchecked. Uses DOI -> Unpaywall and PMCID -> PubMed Central. 'no_open_access_found' means no legal free copy is indexed; it does not prove the paper cannot be reached through an institution. Max 100 PMIDs per call. Needs UNPAYWALL_EMAIL (or NCBI_EMAIL) for the Unpaywall lookup; without it only PubMed Central links are found.
| Parameter | Type | Description |
|---|---|---|
pmids * | array |
search_with_access
Run a PubMed search, then report for every hit whether a legal open-access PDF exists or the paper looks paywalled. max_results is capped at 100 here. Returns query_translation and total_matches (as search_pubmed) plus counts and four lists: open_access_pdf, open_access_landing_page_only, no_open_access_found, unchecked.
| Parameter | Type | Description |
|---|---|---|
query * | string | |
date_from | ||
date_to | ||
max_results | integer | |
sort | string |
download_pdfs
Download open-access PDFs for the given PMIDs (max 50) as PMID<id>.pdf. Paywalled papers are skipped, never bypassed. folder: absolute path, or a sub-folder name under PUBMED_PDF_DIR (default ~/pubmed_pdfs). Every file is verified to be a real PDF (starts with %PDF); HTML login/bot-check pages are rejected and reported as failed.
| Parameter | Type | Description |
|---|---|---|
pmids * | array | |
folder |
pubmed_database_info
Query NCBI EInfo for database statistics and field tags.
| Parameter | Type | Description |
|---|---|---|
db | string |
pubmed_search
Search PubMed (NCBI esearch) with reproducibility object, query translation, and audit provenance. Args: query: PubMed query; supports field tags, MeSH, and Boolean logic. max_results: 1-9999 (default 20). Capped at MAX_SEARCH (9999). start: Result offset / retstart for pagination (default 0). sort: 'relevance' or 'pub_date' (newest first). date_from / date_to: Optional publication-year bounds. use_history: If True, stores search on NCBI Entrez History server (returns webenv & query_key). To retrieve all records when total_matches > max_results:…
| Parameter | Type | Description |
|---|---|---|
query * | string | |
date_from | ||
date_to | ||
max_results | integer | |
sort | string | |
start | integer | |
use_history | boolean |
pubmed_fetch
Fetch exact PubMed records (NCBI efetch) with per-record status and provenance. Every field comes strictly from the NCBI response; missing fields are flagged and never inferred. Returns records with 'status': 'success' and unretrieved items with 'status': 'not_found'.
| Parameter | Type | Description |
|---|---|---|
pmids * | array |
pubmed_get
Retrieve a single PubMed record by PMID in normalized mode or raw verbatim XML. Args: pmid: PubMed identifier (1-9 digits). mode: 'normalized' (default) returns deterministic schema with structured missingness indicators; 'raw' returns verbatim XML with SHA-256 integrity hash for auditing.
| Parameter | Type | Description |
|---|---|---|
pmid * | string | |
mode | string |
pubmed_batch_fetch
Batch fetch PubMed records in chunks supporting long PMID lists (>200) or NCBI Entrez History. Supports two retrieval modes: 1. Direct PMID batching: Accepts an arbitrary list of PMIDs, chunking them into batch_size (max 200). 2. Entrez History batching: Accepts webenv and query_key from a prior pubmed_search(..., use_history=True), iterating retstart up to total_records in chunks of batch_size. Args: pmids: Optional list of PMIDs (arbitrary length; chunked into batch_size). webenv: Optional NCBI WebEnv token from a prior pubmed_search(..., use_histor…
| Parameter | Type | Description |
|---|---|---|
batch_size | integer | |
pmids | ||
query_key | ||
retstart | integer | |
total_records | ||
webenv |
pubmed_create_search_snapshot
Create a reproducible search snapshot (PUBMED-YYYYMMDD-XXXXXX). Thin wrapper around the in-memory SnapshotStore. Stores exactly what NCBI returned; never invents results. Snapshots live for the lifetime of the MCP server process (Phase 1).
| Parameter | Type | Description |
|---|---|---|
effective_query * | string | |
original_query * | string | |
pmids * | array | |
total_matches * | integer | |
date_from | ||
date_to | ||
query_key | ||
response_hash | ||
retmax | integer | |
sort | string | |
webenv |
pubmed_get_snapshot
Retrieve a previously created search snapshot by its stable ID.
| Parameter | Type | Description |
|---|---|---|
snapshot_id * | string |
pubmed_list_snapshots
List the most recent search snapshots (newest first).
| Parameter | Type | Description |
|---|---|---|
limit | integer |
pubmed_export_ris
Export records (or a whole search snapshot) to RIS format. Provide either `records` or `snapshot_id`. When snapshot_id is given, PMIDs are read from the snapshot store, records are fetched via pubmed_fetch/fetch_abstracts, then exported. Never invents field values.
| Parameter | Type | Description |
|---|---|---|
records | ||
snapshot_id |
pubmed_export_bibtex
Export records (or a whole search snapshot) to BibTeX format.
| Parameter | Type | Description |
|---|---|---|
records | ||
snapshot_id |
pubmed_export_csv
Export records (or a whole search snapshot) to CSV format.
| Parameter | Type | Description |
|---|---|---|
records | ||
snapshot_id |
pubmed_export_json
Export records (or a whole search snapshot) to JSON format. Preserves full provenance structure if present in the records.
| Parameter | Type | Description |
|---|---|---|
records | ||
snapshot_id |
pubmed_evidence_table
Build a source-linked evidence table from records or a search snapshot. Provide either `records` or `snapshot_id`. When snapshot_id is given, PMIDs are read from the snapshot store, records are fetched via pubmed_fetch/fetch_abstracts, then the evidence table is built. Only extracts what is explicitly present in title/abstract. Every cell carries value + status (+ optional source quote). Never invents sample size, study design, PICO elements, or effect estimates.
| Parameter | Type | Description |
|---|---|---|
format | string | |
records | ||
snapshot_id |
europe_pmc_search
Search Europe PMC and normalize results into the provenance schema. Every record declares source "Europe PMC" and preserves available identifiers (PMID, PMCID, DOI, Europe PMC ID). Rate-limited politely. Never invents fields.
| Parameter | Type | Description |
|---|---|---|
query * | string | |
cursor_mark | string | |
page_size | integer |
europe_pmc_get
Fetch a single record from Europe PMC by external ID (usually PMID with source=MED).
| Parameter | Type | Description |
|---|---|---|
ext_id * | string | |
source | string |
pubmed_deduplicate
Cross-source deduplication of PubMed / Europe PMC records. Matches on PMID → DOI → PMCID → conservative title + first-author + year. Ambiguous matches are emitted to a review list; nothing is silently dropped. Every kept record declares its source.
| Parameter | Type | Description |
|---|---|---|
records * | array |
pubmed_citation_chase
Citation-chase stub: references and citing articles for a PMID. Europe PMC supports reference/citation endpoints; this stub records coverage notes and returns no citations until the live endpoint is wired. Never invents citations. Absence of data is not evidence of absence.
| Parameter | Type | Description |
|---|---|---|
pmid * | string |
pubmed_retraction_check
Re-check PMIDs (or a search snapshot) for retraction / erratum / correction notices. Uses has_retraction_notice / has_erratum_notice / comments_corrections already attached to PubMed records. Distinguishes "verified no notice" from "not yet checked" (PMIDs not returned by the fetch). Never invents notices.
| Parameter | Type | Description |
|---|---|---|
pmids | ||
snapshot_id |
pubmed_validate
Validate a normalized record against its raw source input for inference violations. A field marked `directly_sourced` must have its value present in the source input. Any mismatch is reported as a false inference. This enforces the anti-inference guarantee: absence of data is never evidence of absence, and nothing is ever inferred, guessed, or fabricated. Args: record: Normalized record with provenance-style field entries (value + status). source_input: The raw source data the record was derived from. record_name: Optional name for the record…
| Parameter | Type | Description |
|---|---|---|
record * | object | |
source_input * | object | |
record_name | string |