pubmed-access-mcp

v0.3.1
pubmed-access-mcp Checked 2 days ago Published 1 month ago

A 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…

ParameterTypeDescription
query *string
date_from
date_to
max_resultsinteger
sortstring

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.

ParameterTypeDescription
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.

ParameterTypeDescription
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.

ParameterTypeDescription
query *string
date_from
date_to
max_resultsinteger
sortstring

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.

ParameterTypeDescription
pmids *array
folder

pubmed_database_info

Query NCBI EInfo for database statistics and field tags.

ParameterTypeDescription
dbstring

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'.

ParameterTypeDescription
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.

ParameterTypeDescription
pmid *string
modestring

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…

ParameterTypeDescription
batch_sizeinteger
pmids
query_key
retstartinteger
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).

ParameterTypeDescription
effective_query *string
original_query *string
pmids *array
total_matches *integer
date_from
date_to
query_key
response_hash
retmaxinteger
sortstring
webenv

pubmed_get_snapshot

Retrieve a previously created search snapshot by its stable ID.

ParameterTypeDescription
snapshot_id *string

pubmed_list_snapshots

List the most recent search snapshots (newest first).

ParameterTypeDescription
limitinteger

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.

ParameterTypeDescription
records
snapshot_id

pubmed_export_bibtex

Export records (or a whole search snapshot) to BibTeX format.

ParameterTypeDescription
records
snapshot_id

pubmed_export_csv

Export records (or a whole search snapshot) to CSV format.

ParameterTypeDescription
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.

ParameterTypeDescription
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.

ParameterTypeDescription
formatstring
records
snapshot_id

europe_pmc_get

Fetch a single record from Europe PMC by external ID (usually PMID with source=MED).

ParameterTypeDescription
ext_id *string
sourcestring

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.

ParameterTypeDescription
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.

ParameterTypeDescription
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.

ParameterTypeDescription
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…

ParameterTypeDescription
record *object
source_input *object
record_namestring