Skip to content

v2.7.0

@cyanheads cyanheads tagged this 19 May 06:24
Adds `pubmed_europepmc_search` and expands `pubmed_fetch_fulltext` to a
three-stage chain — NCBI PMC EFetch → Europe PMC `fullTextXML` → Unpaywall —
with a new `dois` input branch (#52). EPMC is default-on; set
`EUROPEPMC_ENABLED=false` to skip tool registration and revert to PMC +
Unpaywall with zero EBI calls.

Breaking for readers of the old arrays: `unavailablePmcIds[]` is replaced by
a unified `unavailable[]` with an `idType` discriminator (`pmid` | `pmcid` |
`doi`) and a `triedTiers[]` execution trace. Each tier records
`{ tier, outcome, detail }` where `outcome` is a dedicated enum
(`not-attempted`, `miss`, `no-fulltext`, `no-doi`, `no-oa`, `fetch-failed`,
`parse-failed`, `service-error`) separate from the terminal `reason`.
Articles gain `viaSource: "pmc" | "europepmc" | "unpaywall"` to record
origin tier independent of payload schema. Two new reasons: `not-found` and
`no-epmc-fulltext`.

PMC EFetch failures now fall through gracefully (logged + recorded as
`pmc:service-error` in `triedTiers[]`) instead of aborting the batch. The
old `invalid_pmc_efetch_response` contract is removed. Unpaywall translates
`McpError(NotFound | ValidationError)` from `fetchWithTimeout` into `no-oa`
so mid-chain 404s surface cleanly.

New `src/services/europe-pmc/` module — api-client, service, request-queue,
types. Separate rate-limited queue from NCBI's; reuses the NCBI JATS parser.
New `EUROPEPMC_SERVICE_ERRORS` contract pair. `PmcArticleSchema` gains
`epmcId` / `epmcSource`.

Five new env vars: `EUROPEPMC_ENABLED` (default `true`), `EUROPEPMC_EMAIL`,
`EUROPEPMC_REQUEST_DELAY_MS` (200), `EUROPEPMC_MAX_RETRIES` (3),
`EUROPEPMC_TIMEOUT_MS` (20000). New `envBoolean` preprocessor — `z.coerce.boolean()`
mishandles env strings (`"false"` → `true` under JS truthy semantics).

Server `instructions` rewritten for the broader surface. README, server.json,
package.json, badges, docs/tree.md all updated.

Deps: `@types/node` ^25.8.0 → ^25.9.0.

618 tests pass; `bun run devcheck` clean.
Assets 2
Loading