@cyanheads/biorxiv-mcp-server 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +6 -2
- package/CLAUDE.md +6 -2
- package/README.md +12 -6
- package/changelog/0.2.x/0.2.2.md +21 -0
- package/changelog/0.2.x/0.2.3.md +26 -0
- package/dist/config/server-config.d.ts +5 -4
- package/dist/config/server-config.d.ts.map +1 -1
- package/dist/config/server-config.js +12 -11
- package/dist/config/server-config.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.d.ts +35 -6
- package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.js +117 -23
- package/dist/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-preprint.tool.d.ts +11 -0
- package/dist/mcp-server/tools/definitions/biorxiv-get-preprint.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-preprint.tool.js +50 -13
- package/dist/mcp-server/tools/definitions/biorxiv-get-preprint.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.d.ts +10 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.js +26 -1
- package/dist/mcp-server/tools/definitions/biorxiv-get-published-version.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.d.ts +16 -0
- package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.js +54 -12
- package/dist/mcp-server/tools/definitions/biorxiv-list-recent.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.d.ts +12 -0
- package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.js +57 -17
- package/dist/mcp-server/tools/definitions/biorxiv-search-preprints.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +46 -2
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/services/biorxiv/biorxiv-service.d.ts +7 -1
- package/dist/services/biorxiv/biorxiv-service.d.ts.map +1 -1
- package/dist/services/biorxiv/biorxiv-service.js +148 -92
- package/dist/services/biorxiv/biorxiv-service.js.map +1 -1
- package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.d.ts +29 -7
- package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.d.ts.map +1 -1
- package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.js +119 -15
- package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.js.map +1 -1
- package/dist/services/shared.d.ts +35 -2
- package/dist/services/shared.d.ts.map +1 -1
- package/dist/services/shared.js +64 -2
- package/dist/services/shared.js.map +1 -1
- package/package.json +1 -1
- package/server.json +31 -3
package/AGENTS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Agent Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** biorxiv-mcp-server
|
|
4
|
-
**Version:** 0.2.
|
|
4
|
+
**Version:** 0.2.3
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.1`
|
|
6
6
|
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
|
|
@@ -166,10 +166,13 @@ src/
|
|
|
166
166
|
config/
|
|
167
167
|
server-config.ts # bioRxiv-specific env vars (BIORXIV_MAILTO, API base URLs)
|
|
168
168
|
services/
|
|
169
|
-
shared.ts # Shared utilities (asRc, detectHtmlError,
|
|
169
|
+
shared.ts # Shared utilities (asRc, detectHtmlError, normalizeUpstreamText,
|
|
170
|
+
# isValidCalendarDate, parseRetryAfterSeconds, findRateLimit, SERVER_VERSION)
|
|
170
171
|
biorxiv/
|
|
171
172
|
biorxiv-service.ts # BiorxivApiService — details, publications, pubs endpoints
|
|
172
173
|
types.ts # Domain types (Preprint, PublishedVersion, …)
|
|
174
|
+
biorxiv-fulltext/
|
|
175
|
+
biorxiv-fulltext-service.ts # BiorxivFullTextService — article-page HTML → Markdown, cached per version
|
|
173
176
|
europe-pmc/
|
|
174
177
|
europe-pmc-service.ts # EuropePmcService — preprint keyword search
|
|
175
178
|
types.ts # EuropePMC response types
|
|
@@ -179,6 +182,7 @@ src/
|
|
|
179
182
|
biorxiv-list-recent.tool.ts
|
|
180
183
|
biorxiv-search-preprints.tool.ts
|
|
181
184
|
biorxiv-get-published-version.tool.ts
|
|
185
|
+
biorxiv-get-fulltext.tool.ts
|
|
182
186
|
biorxiv-list-categories.tool.ts
|
|
183
187
|
```
|
|
184
188
|
|
package/CLAUDE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Agent Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** biorxiv-mcp-server
|
|
4
|
-
**Version:** 0.2.
|
|
4
|
+
**Version:** 0.2.3
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.1`
|
|
6
6
|
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
|
|
@@ -166,10 +166,13 @@ src/
|
|
|
166
166
|
config/
|
|
167
167
|
server-config.ts # bioRxiv-specific env vars (BIORXIV_MAILTO, API base URLs)
|
|
168
168
|
services/
|
|
169
|
-
shared.ts # Shared utilities (asRc, detectHtmlError,
|
|
169
|
+
shared.ts # Shared utilities (asRc, detectHtmlError, normalizeUpstreamText,
|
|
170
|
+
# isValidCalendarDate, parseRetryAfterSeconds, findRateLimit, SERVER_VERSION)
|
|
170
171
|
biorxiv/
|
|
171
172
|
biorxiv-service.ts # BiorxivApiService — details, publications, pubs endpoints
|
|
172
173
|
types.ts # Domain types (Preprint, PublishedVersion, …)
|
|
174
|
+
biorxiv-fulltext/
|
|
175
|
+
biorxiv-fulltext-service.ts # BiorxivFullTextService — article-page HTML → Markdown, cached per version
|
|
173
176
|
europe-pmc/
|
|
174
177
|
europe-pmc-service.ts # EuropePmcService — preprint keyword search
|
|
175
178
|
types.ts # EuropePMC response types
|
|
@@ -179,6 +182,7 @@ src/
|
|
|
179
182
|
biorxiv-list-recent.tool.ts
|
|
180
183
|
biorxiv-search-preprints.tool.ts
|
|
181
184
|
biorxiv-get-published-version.tool.ts
|
|
185
|
+
biorxiv-get-fulltext.tool.ts
|
|
182
186
|
biorxiv-list-categories.tool.ts
|
|
183
187
|
```
|
|
184
188
|
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://github.com/users/cyanheads/packages/container/package/biorxiv-mcp-server) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/biorxiv-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -42,7 +42,8 @@ Fetch preprint metadata by DOI — all revisions in one call.
|
|
|
42
42
|
- Each DOI returns the full revision history in `collection[]` — one API call per DOI, no enumeration loop
|
|
43
43
|
- Includes title, authors, abstract, category, license, JATS XML full-text link (`jatsxml`), and published journal DOI when the preprint has been accepted
|
|
44
44
|
- Scope to `biorxiv`, `medrxiv`, or `both`; when `both`, each DOI fans out in parallel and partial failures report per-DOI in `failed[]`
|
|
45
|
-
- Each `failed[]` entry carries a `reason` (`not_found`, `invalid_doi_format`, `upstream_unavailable`) and a `retryable` flag — a DOI is only reported as not found when every attempted server answered
|
|
45
|
+
- Each `failed[]` entry carries a `reason` (`not_found`, `invalid_doi_format`, `upstream_unavailable`, `rate_limited`) and a `retryable` flag — a DOI is only reported as not found when every attempted server answered
|
|
46
|
+
- A lookup the origin rate-limited (HTTP 429) reports as `rate_limited` rather than folding into `upstream_unavailable`, and carries `retryAfter` — the wait in seconds `api.biorxiv.org` asked for
|
|
46
47
|
|
|
47
48
|
---
|
|
48
49
|
|
|
@@ -55,7 +56,8 @@ Page through preprints in a date interval.
|
|
|
55
56
|
- Response includes `total` count per server for calculating remaining pages
|
|
56
57
|
- When `server="both"`, each server paginates independently; response surfaces per-server pagination state (`{ biorxiv: { cursor, total }, medrxiv: { cursor, total } }`)
|
|
57
58
|
- A server whose cursor is past its last page is marked `exhausted: true` — the API reports `total: 0` for an out-of-range cursor, so that count is an artifact rather than the interval total
|
|
58
|
-
-
|
|
59
|
+
- One server not answering under `server="both"` is named in `failed[]` rather than dropped; the other server's page is still returned, and a non-empty `failed[]` marks the result set as partial
|
|
60
|
+
- Every attempted server failing raises a retryable `upstream_unavailable` (or `rate_limited`) error instead of returning an empty page — nothing answered, so an empty interval was never established
|
|
59
61
|
|
|
60
62
|
---
|
|
61
63
|
|
|
@@ -67,7 +69,8 @@ Keyword and/or author search with relevance ranking.
|
|
|
67
69
|
- Optional `author` maps to an EuropePMC `AUTH:"…"` field query, ANDed with the keyword query — supply `query`, `author`, or both
|
|
68
70
|
- Covers both servers by default; scope down with `server`
|
|
69
71
|
- Optional date range filters (`date_from`, `date_to`)
|
|
70
|
-
-
|
|
72
|
+
- Enriched results carry the same latest-revision fields `biorxiv_get_preprint` returns — including `type`, `license`, `funder`, and `authorCorrespondingInstitution`
|
|
73
|
+
- Enrichment failures degrade gracefully to EuropePMC-only metadata, surfaced via `partial_results` and a per-record `enrichment_error` (`service_error`, `rate_limited`, or `not_found`)
|
|
71
74
|
|
|
72
75
|
---
|
|
73
76
|
|
|
@@ -79,6 +82,7 @@ Resolve a preprint DOI to its journal publication crosswalk.
|
|
|
79
82
|
- Returns journal DOI, journal name, published date, and corresponding author institution
|
|
80
83
|
- Use when the preprint's `publishedJournalDoi` field is present and you need the full crosswalk record
|
|
81
84
|
- Scope to `biorxiv`, `medrxiv`, or `both`; `both` is the default because the two servers share the `10.1101/` DOI prefix, and the output `server` field names the one that answered
|
|
85
|
+
- No server answering raises a retryable `upstream_unavailable`, or `rate_limited` with the origin's wait when the failure was an HTTP 429 — never `doi_not_found`, which would assert an absence nothing established
|
|
82
86
|
|
|
83
87
|
---
|
|
84
88
|
|
|
@@ -88,8 +92,10 @@ Retrieve a preprint's full text as best-effort Markdown.
|
|
|
88
92
|
|
|
89
93
|
- Fetches the rendered HTML article page (`www.{server}.org/content/{doi}v{N}.full`) and extracts Markdown — there is no keyless JATS source
|
|
90
94
|
- Resolves the latest version via the details API first, for the URL version and clean not-found handling
|
|
91
|
-
-
|
|
95
|
+
- Scope to `biorxiv`, `medrxiv`, or `both`; `both` is the default because the two servers share the `10.1101/` DOI prefix. Only the DOI resolution fans out — the full-text fetch targets the single server that answered, named in the output `server` field
|
|
96
|
+
- Long articles page via `offset`/`limit` character chunking (`totalChars`, `remainingChars`, `hasMore`); the extracted article is cached per version, so paging costs one origin fetch rather than one per chunk
|
|
92
97
|
- PDF-only preprints and blocked/challenge pages return a typed `fulltext_unavailable` error routing to `biorxiv_get_preprint`
|
|
98
|
+
- An origin rate limit (HTTP 429) returns a retryable `rate_limited` error carrying the origin's `Retry-After` wait, rather than a bare fetch failure. Both origins this tool touches can hit it — the article page during the full-text fetch, `api.biorxiv.org` during version resolution — and the recovery hint names which of them are limiting, since `biorxiv_get_preprint` is only a useful fallback while the metadata origin is answering
|
|
93
99
|
|
|
94
100
|
---
|
|
95
101
|
|
|
@@ -113,7 +119,7 @@ Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp
|
|
|
113
119
|
|
|
114
120
|
bioRxiv-specific:
|
|
115
121
|
|
|
116
|
-
- `BiorxivApiService` wraps `api.biorxiv.org` — details, publications, and crosswalk endpoints with retry and exponential backoff
|
|
122
|
+
- `BiorxivApiService` wraps `api.biorxiv.org` — details, publications, and crosswalk endpoints with retry and exponential backoff. An origin rate limit (HTTP 429) is classified as a retryable `rate_limited` error carrying the parsed `Retry-After` wait; the upstream response body never reaches the error payload
|
|
117
123
|
- `EuropePmcService` wraps the EuropePMC search endpoint for relevance-ranked keyword and/or author results
|
|
118
124
|
- `BiorxivFullTextService` fetches and extracts Markdown from the rendered HTML article pages on `www.biorxiv.org` / `www.medrxiv.org` — a distinct origin from the JSON API
|
|
119
125
|
- Two-server fan-out via `Promise.allSettled` — both `biorxiv` and `medrxiv` queried in parallel when `server="both"`, results merged and deduplicated by DOI
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "biorxiv_get_fulltext caches extracted articles for offset paging, classifies HTTP 429 as a retryable rate_limited error, and resolves DOIs against both servers by default (#36, #37, #38)"
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.2.2 — 2026-08-09
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- **`biorxiv_get_fulltext`** — `server` input gains `"both"` and now defaults to it, resolving the DOI across bioRxiv and medRxiv via `Promise.allSettled` (the shared `10.1101/` prefix does not identify the server). Only DOI resolution fans out; the full-text fetch still targets the single server that answered. A new retryable `upstream_unavailable` reason covers the all-rejected case. [#38](https://github.com/cyanheads/biorxiv-mcp-server/issues/38)
|
|
12
|
+
- **`biorxiv_get_fulltext`** — HTTP 429 from the full-text origin is now classified as its own retryable `rate_limited` reason, carrying the parsed `Retry-After` wait (RFC 9110 §10.2.3, both delta-seconds and HTTP-date forms) and a recovery hint pointing at `biorxiv_get_preprint`. The Cloudflare block page's HTML no longer reaches the response payload. [#37](https://github.com/cyanheads/biorxiv-mcp-server/issues/37)
|
|
13
|
+
|
|
14
|
+
## Changed
|
|
15
|
+
|
|
16
|
+
- **`BiorxivFullTextService.fetchFullText`** — the extracted article is now cached in tenant-scoped `ctx.state` under `fulltext/v1/{server}/{doi}/{version}` for one hour, so `offset` paging and the `offset_out_of_range` check serve from the cache instead of refetching and re-extracting the origin per call. Cache reads and writes are fail-soft (a storage failure logs a warning and falls through to the origin); `blocked`/`empty`/`rate_limited` results are never cached, and the cache is skipped without a tenant. [#36](https://github.com/cyanheads/biorxiv-mcp-server/issues/36)
|
|
17
|
+
- **`fetchWithTimeout`** call in the full-text service now passes `expectedStatuses` for the deterministic-unavailable set plus 429, logging those responses at `debug` instead of `error`. Status reads moved from the legacy `data.statusCode` alias to canonical `data.status`.
|
|
18
|
+
|
|
19
|
+
## Fixed
|
|
20
|
+
|
|
21
|
+
- **`BIORXIV_WEB_BASE_URL`/`MEDRXIV_WEB_BASE_URL`** — read by the config and documented in the README but never declared in `.env.example`, `server.json`, or `manifest.json`. Added to all three. `src/config/server-config.ts` now guards both with the existing MCPB-placeholder strip, so an unsubstituted `${user_config.X}` literal falls back to the default instead of failing URL validation at startup.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "BiorxivApiService classifies HTTP 429 as a retryable rate_limited error, biorxiv_list_recent raises when every server fails instead of returning an empty page, and biorxiv_search_preprints enrichment carries full revision metadata (#33, #40, #41)"
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.2.3 — 2026-08-09
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- **`biorxiv_search_preprints`** — enriched results now carry `type`, `license`, `funder`, and `authorCorrespondingInstitution` from the latest revision, in the output schema, `structuredContent`, and `format()` — the same latest-revision fields `biorxiv_get_preprint` returns. Full revision history stays out of search; `revisionCount` plus `biorxiv_get_preprint` remains the detailed-history workflow. [#33](https://github.com/cyanheads/biorxiv-mcp-server/issues/33)
|
|
12
|
+
- **`rate_limited` reason** added to the `biorxiv_get_preprint`, `biorxiv_get_published_version`, and `biorxiv_list_recent` error contracts, each carrying `retryAfter` when the origin's `Retry-After` was usable. [#41](https://github.com/cyanheads/biorxiv-mcp-server/issues/41)
|
|
13
|
+
- **`biorxiv_search_preprints`** — new `enrichment_error: 'rate_limited'` value distinguishes an origin 429 from a generic `service_error` on a degraded enrichment. [#41](https://github.com/cyanheads/biorxiv-mcp-server/issues/41)
|
|
14
|
+
|
|
15
|
+
## Changed
|
|
16
|
+
|
|
17
|
+
- **`BiorxivApiService.getDetails` / `getListing` / `getPublishedVersion`** — HTTP 429 from `api.biorxiv.org` is now classified as a retryable `rate_limited` error whose payload is rebuilt from scratch (`{ reason, retryable, retryAfter?, recovery }`); the upstream response body no longer reaches the caller. No retry or backoff logic was added — `withRetry` already honors `Retry-After`. [#41](https://github.com/cyanheads/biorxiv-mcp-server/issues/41)
|
|
18
|
+
- **`parseRetryAfterSeconds`** moved from `BiorxivFullTextService` into `services/shared.ts`, joined by `findRateLimit` (reduces a set of rejections to the longest reported wait) and `describeWait`. [#41](https://github.com/cyanheads/biorxiv-mcp-server/issues/41)
|
|
19
|
+
- **`biorxiv_list_recent`** — raises a retryable `upstream_unavailable` (or `rate_limited`) error when every attempted server fails under `server="both"`, instead of returning a successful empty listing with a notice. The partial-failure case — one server failing, the other's page returned — is unchanged. [#40](https://github.com/cyanheads/biorxiv-mcp-server/issues/40)
|
|
20
|
+
- A rate limit now outranks a generic upstream failure wherever an all-failed branch can mix the two — `biorxiv_get_preprint`, `biorxiv_get_published_version`, `biorxiv_list_recent`, and `biorxiv_get_fulltext`'s version-resolution step all raise `rate_limited` over `upstream_unavailable` when a 429 is among the rejections. [#41](https://github.com/cyanheads/biorxiv-mcp-server/issues/41)
|
|
21
|
+
- Service-level tests now drive the real `BiorxivApiService` 429 rejection via a shared `tests/helpers/rate-limit.ts` fixture, so the tool suites' mocked shape cannot drift from what the service actually throws.
|
|
22
|
+
|
|
23
|
+
## Fixed
|
|
24
|
+
|
|
25
|
+
- **`biorxiv_get_fulltext`** — the rate-limit recovery hint no longer recommends `biorxiv_get_preprint` as a working fallback when that tool's own metadata origin (`api.biorxiv.org`) is the one rate-limiting; it now reads the version-resolution rejections and reports the longer of the two waits.
|
|
26
|
+
- **`biorxiv_search_preprints`** — the two overlapping enrichment-failure flags collapsed into a single rejection list, fixing a case where an upstream outage or rate limit was mislabelled `not_found`.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Server-specific configuration for biorxiv-mcp-server. Parses
|
|
3
|
-
* domain env vars (BIORXIV_MAILTO, BIORXIV_API_BASE_URL, EUROPEPMC_API_BASE_URL
|
|
4
|
-
* separately from the framework's
|
|
3
|
+
* domain env vars (BIORXIV_MAILTO, BIORXIV_API_BASE_URL, EUROPEPMC_API_BASE_URL,
|
|
4
|
+
* BIORXIV_WEB_BASE_URL, MEDRXIV_WEB_BASE_URL) separately from the framework's
|
|
5
|
+
* core config. Lazy-parsed on first access.
|
|
5
6
|
* @module config/server-config
|
|
6
7
|
*/
|
|
7
8
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
@@ -9,8 +10,8 @@ declare const ServerConfigSchema: z.ZodObject<{
|
|
|
9
10
|
mailto: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
10
11
|
apiBaseUrl: z.ZodDefault<z.ZodString>;
|
|
11
12
|
europePmcBaseUrl: z.ZodDefault<z.ZodString>;
|
|
12
|
-
biorxivWebBaseUrl: z.ZodDefault<z.ZodString
|
|
13
|
-
medrxivWebBaseUrl: z.ZodDefault<z.ZodString
|
|
13
|
+
biorxivWebBaseUrl: z.ZodPreprocess<z.ZodDefault<z.ZodString>>;
|
|
14
|
+
medrxivWebBaseUrl: z.ZodPreprocess<z.ZodDefault<z.ZodString>>;
|
|
14
15
|
}, z.core.$strip>;
|
|
15
16
|
export type ServerConfig = z.infer<typeof ServerConfigSchema>;
|
|
16
17
|
export declare function getServerConfig(): ServerConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAW3C,QAAA,MAAM,kBAAkB;;;;;;iBAsBtB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D,wBAAgB,eAAe,IAAI,YAAY,CAS9C;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Server-specific configuration for biorxiv-mcp-server. Parses
|
|
3
|
-
* domain env vars (BIORXIV_MAILTO, BIORXIV_API_BASE_URL, EUROPEPMC_API_BASE_URL
|
|
4
|
-
* separately from the framework's
|
|
3
|
+
* domain env vars (BIORXIV_MAILTO, BIORXIV_API_BASE_URL, EUROPEPMC_API_BASE_URL,
|
|
4
|
+
* BIORXIV_WEB_BASE_URL, MEDRXIV_WEB_BASE_URL) separately from the framework's
|
|
5
|
+
* core config. Lazy-parsed on first access.
|
|
5
6
|
* @module config/server-config
|
|
6
7
|
*/
|
|
7
8
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
8
9
|
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
10
|
+
/**
|
|
11
|
+
* An unsubstituted MCPB placeholder (`${user_config.X}`) reads back as a literal
|
|
12
|
+
* string when the user leaves the optional field blank. Strip it to undefined so
|
|
13
|
+
* the field falls through to its default instead of failing format validation.
|
|
14
|
+
*/
|
|
15
|
+
const stripMcpbPlaceholder = (v) => typeof v === 'string' && v.startsWith('${') ? undefined : v;
|
|
9
16
|
const ServerConfigSchema = z.object({
|
|
10
|
-
// z.preprocess strips MCPB placeholder strings (${user_config.X}) to undefined
|
|
11
|
-
// so z.email() doesn't crash when the user leaves the optional field blank.
|
|
12
17
|
mailto: z
|
|
13
|
-
.preprocess(
|
|
18
|
+
.preprocess(stripMcpbPlaceholder, z.string().email().optional())
|
|
14
19
|
.describe('Contact email for User-Agent header — optional, used for polite API access'),
|
|
15
20
|
apiBaseUrl: z.string().url().default('https://api.biorxiv.org').describe('bioRxiv API base URL'),
|
|
16
21
|
europePmcBaseUrl: z
|
|
@@ -21,14 +26,10 @@ const ServerConfigSchema = z.object({
|
|
|
21
26
|
// Full-text HTML lives on the public websites, not the JSON API host — a
|
|
22
27
|
// distinct origin per server. Overridable for testing or mirrors.
|
|
23
28
|
biorxivWebBaseUrl: z
|
|
24
|
-
.string()
|
|
25
|
-
.url()
|
|
26
|
-
.default('https://www.biorxiv.org')
|
|
29
|
+
.preprocess(stripMcpbPlaceholder, z.string().url().default('https://www.biorxiv.org'))
|
|
27
30
|
.describe('bioRxiv website base URL — source of rendered full-text HTML pages for biorxiv_get_fulltext'),
|
|
28
31
|
medrxivWebBaseUrl: z
|
|
29
|
-
.string()
|
|
30
|
-
.url()
|
|
31
|
-
.default('https://www.medrxiv.org')
|
|
32
|
+
.preprocess(stripMcpbPlaceholder, z.string().url().default('https://www.medrxiv.org'))
|
|
32
33
|
.describe('medRxiv website base URL — source of rendered full-text HTML pages for biorxiv_get_fulltext'),
|
|
33
34
|
});
|
|
34
35
|
let _config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;A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1C,iBAAiB,EAAE,sBAAsB;QACzC,iBAAiB,EAAE,sBAAsB;KAC1C,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,GAAG,SAAS,CAAC;AACtB,CAAC"}
|
|
@@ -3,10 +3,26 @@
|
|
|
3
3
|
* fetching its rendered HTML page (`www.{server}.org/content/{doi}v{N}.full`) and
|
|
4
4
|
* extracting readable Markdown. The latest version is resolved via the details
|
|
5
5
|
* API first (for the URL version and clean not-found handling), then the HTML is
|
|
6
|
-
* fetched and run through the framework extractor.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* fetched and run through the framework extractor. bioRxiv and medRxiv share the
|
|
7
|
+
* 10.1101/ DOI prefix, so the default server="both" resolves the DOI against both
|
|
8
|
+
* in parallel; the fan-out is narrower than biorxiv_get_published_version's — only
|
|
9
|
+
* the resolution step fans out, and the full-text fetch targets the single server
|
|
10
|
+
* that answered. Long articles are paged with offset/limit character chunking.
|
|
11
|
+
* Full text is best-effort HTML→Markdown, not structured JATS; preprints that are
|
|
12
|
+
* PDF-only or whose page is blocked return a typed `fulltext_unavailable` error
|
|
13
|
+
* routing to biorxiv_get_preprint, while an origin rate limit (HTTP 429) routes to
|
|
14
|
+
* a retryable `rate_limited` error carrying the origin's Retry-After wait.
|
|
15
|
+
*
|
|
16
|
+
* This tool touches two origins that can each rate-limit independently — the
|
|
17
|
+
* article-page host during the full-text fetch, and api.biorxiv.org during
|
|
18
|
+
* version resolution — and both raise the single `rate_limited` reason. A
|
|
19
|
+
* caller's move is the same either way (wait the stated interval, then retry),
|
|
20
|
+
* so a second reason would only add a branch with no distinct action behind it;
|
|
21
|
+
* what does differ is the fallback advice, since biorxiv_get_preprint shares the
|
|
22
|
+
* metadata origin and is therefore useless while that one is the limited one.
|
|
23
|
+
* The recovery hint names the limiting origins — either, or both, since one
|
|
24
|
+
* server answering resolution does not establish that the metadata origin let
|
|
25
|
+
* the other one through — and adapts the fallback to them.
|
|
10
26
|
* @module mcp-server/tools/definitions/biorxiv-get-fulltext.tool
|
|
11
27
|
*/
|
|
12
28
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
@@ -15,6 +31,7 @@ export declare const biorxivGetFulltextTool: import("@cyanheads/mcp-ts-core").To
|
|
|
15
31
|
doi: z.ZodString;
|
|
16
32
|
server: z.ZodDefault<z.ZodEnum<{
|
|
17
33
|
biorxiv: "biorxiv";
|
|
34
|
+
both: "both";
|
|
18
35
|
medrxiv: "medrxiv";
|
|
19
36
|
}>>;
|
|
20
37
|
offset: z.ZodDefault<z.ZodNumber>;
|
|
@@ -44,8 +61,20 @@ export declare const biorxivGetFulltextTool: import("@cyanheads/mcp-ts-core").To
|
|
|
44
61
|
}, {
|
|
45
62
|
readonly reason: "doi_not_found";
|
|
46
63
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
47
|
-
readonly when: "The DOI resolves to
|
|
48
|
-
readonly recovery: "
|
|
64
|
+
readonly when: "The DOI resolves to an empty collection on every attempted server.";
|
|
65
|
+
readonly recovery: "Retry with server=\"both\" if you scoped to one server, or find the correct DOI with biorxiv_search_preprints.";
|
|
66
|
+
}, {
|
|
67
|
+
readonly reason: "upstream_unavailable";
|
|
68
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
69
|
+
readonly retryable: true;
|
|
70
|
+
readonly when: "No attempted server resolved the DOI and at least one lookup failed against api.biorxiv.org.";
|
|
71
|
+
readonly recovery: "Retry the request after a short delay — the preprint may well exist; api.biorxiv.org did not answer.";
|
|
72
|
+
}, {
|
|
73
|
+
readonly reason: "rate_limited";
|
|
74
|
+
readonly code: JsonRpcErrorCode.RateLimited;
|
|
75
|
+
readonly retryable: true;
|
|
76
|
+
readonly when: "Either origin returned HTTP 429 for this host — the article page (www.biorxiv.org / www.medrxiv.org) during the full-text fetch, or api.biorxiv.org during version resolution.";
|
|
77
|
+
readonly recovery: "Wait the retryAfter seconds before calling again; the recovery hint names which origins are limiting and what still works meanwhile.";
|
|
49
78
|
}, {
|
|
50
79
|
readonly reason: "fulltext_unavailable";
|
|
51
80
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biorxiv-get-fulltext.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"biorxiv-get-fulltext.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAQjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0VjC,CAAC"}
|
|
@@ -3,29 +3,46 @@
|
|
|
3
3
|
* fetching its rendered HTML page (`www.{server}.org/content/{doi}v{N}.full`) and
|
|
4
4
|
* extracting readable Markdown. The latest version is resolved via the details
|
|
5
5
|
* API first (for the URL version and clean not-found handling), then the HTML is
|
|
6
|
-
* fetched and run through the framework extractor.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* fetched and run through the framework extractor. bioRxiv and medRxiv share the
|
|
7
|
+
* 10.1101/ DOI prefix, so the default server="both" resolves the DOI against both
|
|
8
|
+
* in parallel; the fan-out is narrower than biorxiv_get_published_version's — only
|
|
9
|
+
* the resolution step fans out, and the full-text fetch targets the single server
|
|
10
|
+
* that answered. Long articles are paged with offset/limit character chunking.
|
|
11
|
+
* Full text is best-effort HTML→Markdown, not structured JATS; preprints that are
|
|
12
|
+
* PDF-only or whose page is blocked return a typed `fulltext_unavailable` error
|
|
13
|
+
* routing to biorxiv_get_preprint, while an origin rate limit (HTTP 429) routes to
|
|
14
|
+
* a retryable `rate_limited` error carrying the origin's Retry-After wait.
|
|
15
|
+
*
|
|
16
|
+
* This tool touches two origins that can each rate-limit independently — the
|
|
17
|
+
* article-page host during the full-text fetch, and api.biorxiv.org during
|
|
18
|
+
* version resolution — and both raise the single `rate_limited` reason. A
|
|
19
|
+
* caller's move is the same either way (wait the stated interval, then retry),
|
|
20
|
+
* so a second reason would only add a branch with no distinct action behind it;
|
|
21
|
+
* what does differ is the fallback advice, since biorxiv_get_preprint shares the
|
|
22
|
+
* metadata origin and is therefore useless while that one is the limited one.
|
|
23
|
+
* The recovery hint names the limiting origins — either, or both, since one
|
|
24
|
+
* server answering resolution does not establish that the metadata origin let
|
|
25
|
+
* the other one through — and adapts the fallback to them.
|
|
10
26
|
* @module mcp-server/tools/definitions/biorxiv-get-fulltext.tool
|
|
11
27
|
*/
|
|
12
28
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
13
29
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
14
30
|
import { getBiorxivApiService } from '../../../services/biorxiv/biorxiv-service.js';
|
|
15
31
|
import { getBiorxivFullTextService } from '../../../services/biorxiv-fulltext/biorxiv-fulltext-service.js';
|
|
32
|
+
import { describeWait, findRateLimit } from '../../../services/shared.js';
|
|
16
33
|
const DOI_REGEX = /^10\.\d{4,}\//;
|
|
17
34
|
export const biorxivGetFulltextTool = tool('biorxiv_get_fulltext', {
|
|
18
35
|
title: 'Get Preprint Full Text',
|
|
19
|
-
description:
|
|
36
|
+
description: 'Retrieve a preprint\'s full text as best-effort Markdown, extracted from its rendered HTML article page. Resolves the latest version via the details API, then fetches and extracts the body — abstract, sections, and references. bioRxiv and medRxiv share the 10.1101/ DOI prefix, so server="both" (the default) resolves the DOI against both in parallel and the response reports which server answered. This is HTML-to-Markdown extraction, not structured JATS: section structure is approximate and not guaranteed. Long articles exceed a single response, so use offset and limit to page through them (the response reports totalChars, remainingChars, and hasMore); paging is cheap because the extracted article is cached per version for an hour after the first read, so only the first chunk pays for a fetch. Not every preprint has an extractable HTML page — some are PDF-only and some origins block programmatic access — in which case a fulltext_unavailable error routes you to biorxiv_get_preprint for the title, abstract, and metadata. For a preprint that has been published in a journal, the journal\'s version may have richer full text elsewhere.',
|
|
20
37
|
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
21
38
|
input: z.object({
|
|
22
39
|
doi: z
|
|
23
40
|
.string()
|
|
24
41
|
.describe('Preprint DOI (e.g. 10.1101/2024.05.28.596311 or 10.64898/2026.05.07.723463). The latest version is resolved automatically.'),
|
|
25
42
|
server: z
|
|
26
|
-
.enum(['biorxiv', 'medrxiv'])
|
|
27
|
-
.default('
|
|
28
|
-
.describe('Server the preprint was posted on.
|
|
43
|
+
.enum(['biorxiv', 'medrxiv', 'both'])
|
|
44
|
+
.default('both')
|
|
45
|
+
.describe('Server the preprint was posted on. "both" (default) checks bioRxiv and medRxiv in parallel to resolve the DOI — the full-text fetch itself only ever targets whichever server resolved, and the output server field names it.'),
|
|
29
46
|
offset: z
|
|
30
47
|
.number()
|
|
31
48
|
.int()
|
|
@@ -101,8 +118,22 @@ export const biorxivGetFulltextTool = tool('biorxiv_get_fulltext', {
|
|
|
101
118
|
{
|
|
102
119
|
reason: 'doi_not_found',
|
|
103
120
|
code: JsonRpcErrorCode.NotFound,
|
|
104
|
-
when: 'The DOI resolves to
|
|
105
|
-
recovery: '
|
|
121
|
+
when: 'The DOI resolves to an empty collection on every attempted server.',
|
|
122
|
+
recovery: 'Retry with server="both" if you scoped to one server, or find the correct DOI with biorxiv_search_preprints.',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
reason: 'upstream_unavailable',
|
|
126
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
127
|
+
retryable: true,
|
|
128
|
+
when: 'No attempted server resolved the DOI and at least one lookup failed against api.biorxiv.org.',
|
|
129
|
+
recovery: 'Retry the request after a short delay — the preprint may well exist; api.biorxiv.org did not answer.',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
reason: 'rate_limited',
|
|
133
|
+
code: JsonRpcErrorCode.RateLimited,
|
|
134
|
+
retryable: true,
|
|
135
|
+
when: 'Either origin returned HTTP 429 for this host — the article page (www.biorxiv.org / www.medrxiv.org) during the full-text fetch, or api.biorxiv.org during version resolution.',
|
|
136
|
+
recovery: 'Wait the retryAfter seconds before calling again; the recovery hint names which origins are limiting and what still works meanwhile.',
|
|
106
137
|
},
|
|
107
138
|
{
|
|
108
139
|
reason: 'fulltext_unavailable',
|
|
@@ -131,22 +162,85 @@ export const biorxivGetFulltextTool = tool('biorxiv_get_fulltext', {
|
|
|
131
162
|
}
|
|
132
163
|
// Resolve the preprint and its latest version via the JSON details API — this
|
|
133
164
|
// provides the version for the full-text URL and clean not-found handling.
|
|
134
|
-
//
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
165
|
+
// Only this step fans out; the full-text fetch targets the server that answered.
|
|
166
|
+
const service = getBiorxivApiService();
|
|
167
|
+
const servers = input.server === 'both' ? ['biorxiv', 'medrxiv'] : [input.server];
|
|
168
|
+
const settled = await Promise.allSettled(servers.map((server) => service.getDetails(input.doi, server, ctx)));
|
|
169
|
+
let resolved;
|
|
170
|
+
for (const [i, settledResult] of settled.entries()) {
|
|
171
|
+
if (settledResult.status === 'fulfilled' && settledResult.value.length > 0) {
|
|
172
|
+
resolved = {
|
|
173
|
+
server: servers[i],
|
|
174
|
+
version: settledResult.value.at(-1)?.version ?? '1',
|
|
175
|
+
};
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
143
178
|
}
|
|
144
|
-
|
|
145
|
-
|
|
179
|
+
if (!resolved) {
|
|
180
|
+
// "Not found" is a claim about what the servers reported, so a server that
|
|
181
|
+
// never answered leaves absence unestablished — and retryable.
|
|
182
|
+
const rejections = settled.flatMap((r, i) => r.status === 'rejected' ? [{ server: servers[i], error: r.reason }] : []);
|
|
183
|
+
if (rejections.length > 0) {
|
|
184
|
+
const detail = rejections
|
|
185
|
+
.map((f) => `${f.server}: ${f.error instanceof Error ? f.error.message : String(f.error)}`)
|
|
186
|
+
.join('; ');
|
|
187
|
+
// The metadata origin rate-limiting resolution is the one case where the
|
|
188
|
+
// usual "fall back to biorxiv_get_preprint" advice is wrong — that tool
|
|
189
|
+
// queries this same origin — so the hint names the origin and says so.
|
|
190
|
+
const rateLimit = findRateLimit(rejections.map((f) => f.error));
|
|
191
|
+
if (rateLimit) {
|
|
192
|
+
const wait = describeWait(rateLimit.retryAfter);
|
|
193
|
+
throw ctx.fail('rate_limited', `Version lookup for ${input.doi} failed — ${detail}`, {
|
|
194
|
+
doi: input.doi,
|
|
195
|
+
servers: rejections.map((f) => f.server),
|
|
196
|
+
...(rateLimit.retryAfter !== undefined && { retryAfter: rateLimit.retryAfter }),
|
|
197
|
+
recovery: {
|
|
198
|
+
hint: `Wait ${wait} before retrying — api.biorxiv.org is rate-limiting this host, and biorxiv_get_preprint queries the same origin, so it will not answer sooner either.`,
|
|
199
|
+
},
|
|
200
|
+
}, { cause: rejections[0]?.error });
|
|
201
|
+
}
|
|
202
|
+
throw ctx.fail('upstream_unavailable', `Version lookup for ${input.doi} failed — ${detail}`, {
|
|
203
|
+
doi: input.doi,
|
|
204
|
+
servers: rejections.map((f) => f.server),
|
|
205
|
+
...ctx.recoveryFor('upstream_unavailable'),
|
|
206
|
+
}, { cause: rejections[0]?.error });
|
|
207
|
+
}
|
|
208
|
+
throw ctx.fail('doi_not_found', `No preprint found for ${input.doi} on ${servers.join(' or ')}.`, { doi: input.doi, servers, ...ctx.recoveryFor('doi_not_found') });
|
|
209
|
+
}
|
|
210
|
+
const { server, version } = resolved;
|
|
211
|
+
const result = await getBiorxivFullTextService().fetchFullText(server, input.doi, version, ctx);
|
|
146
212
|
if (result.kind === 'unavailable') {
|
|
213
|
+
if (result.reason === 'rate_limited') {
|
|
214
|
+
// Dynamic recovery — the origin's own wait is more actionable than the
|
|
215
|
+
// contract's static hint. The block-page HTML never leaves the service.
|
|
216
|
+
//
|
|
217
|
+
// A server that answered resolution can mask a 429 the other one got from
|
|
218
|
+
// the same metadata origin, so whether api.biorxiv.org is still serving is
|
|
219
|
+
// read off the resolution rejections rather than assumed from the fact
|
|
220
|
+
// that resolution succeeded. Pointing the caller at biorxiv_get_preprint
|
|
221
|
+
// while that origin is limiting too sends them back into the limit, and a
|
|
222
|
+
// retry re-runs resolution, so the wait must clear whichever origin asked
|
|
223
|
+
// for the longer one.
|
|
224
|
+
const metadataLimit = findRateLimit(settled.flatMap((r) => (r.status === 'rejected' ? [r.reason] : [])));
|
|
225
|
+
const waits = [result.retryAfter, metadataLimit?.retryAfter].filter((n) => n !== undefined);
|
|
226
|
+
const retryAfter = waits.length > 0 ? Math.max(...waits) : undefined;
|
|
227
|
+
const wait = describeWait(retryAfter);
|
|
228
|
+
throw ctx.fail('rate_limited', result.detail, {
|
|
229
|
+
doi: input.doi,
|
|
230
|
+
server,
|
|
231
|
+
version,
|
|
232
|
+
sourceUrl: result.sourceUrl,
|
|
233
|
+
...(retryAfter !== undefined && { retryAfter }),
|
|
234
|
+
recovery: {
|
|
235
|
+
hint: metadataLimit
|
|
236
|
+
? `Wait ${wait} before calling biorxiv_get_fulltext again — the ${server} article-page origin and api.biorxiv.org are both rate-limiting this host, so biorxiv_get_preprint will not answer sooner either.`
|
|
237
|
+
: `Wait ${wait} before calling biorxiv_get_fulltext again — the ${server} article-page origin is rate-limiting this host. api.biorxiv.org answered this call, so biorxiv_get_preprint still serves the title, abstract, and metadata meanwhile.`,
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
}
|
|
147
241
|
throw ctx.fail('fulltext_unavailable', result.detail, {
|
|
148
242
|
doi: input.doi,
|
|
149
|
-
server
|
|
243
|
+
server,
|
|
150
244
|
version,
|
|
151
245
|
sourceUrl: result.sourceUrl,
|
|
152
246
|
...ctx.recoveryFor('fulltext_unavailable'),
|
|
@@ -170,7 +264,7 @@ export const biorxivGetFulltextTool = tool('biorxiv_get_fulltext', {
|
|
|
170
264
|
}
|
|
171
265
|
return {
|
|
172
266
|
doi: input.doi,
|
|
173
|
-
server
|
|
267
|
+
server,
|
|
174
268
|
version,
|
|
175
269
|
...(result.title && { title: result.title }),
|
|
176
270
|
content,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biorxiv-get-fulltext.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,yDAAyD,CAAC;AAEpG,MAAM,SAAS,GAAG,eAAe,CAAC;AAElC,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,EAAE;IACjE,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EACT,6zBAA6zB;IAC/zB,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE;IAExD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,GAAG,EAAE,CAAC;aACH,MAAM,EAAE;aACR,QAAQ,CACP,4HAA4H,CAC7H;QACH,MAAM,EAAE,CAAC;aACN,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;aAC5B,OAAO,CAAC,SAAS,CAAC;aAClB,QAAQ,CAAC,yDAAyD,CAAC;QACtE,MAAM,EAAE,CAAC;aACN,MAAM,EAAE;aACR,GAAG,EAAE;aACL,GAAG,CAAC,CAAC,CAAC;aACN,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eAAe,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QAC9C,KAAK,CAAC,IAAI,CAAC,eAAe,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;QAClD,KAAK,CAAC,IAAI,CACR,6KAA6K,CAC9K,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3B,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,KAAK,CAAC,IAAI,CACR,oDAAoD,MAAM,CAAC,GAAG,YAAY,GAAG,2BAA2B,CACzG,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"biorxiv-get-fulltext.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,yDAAyD,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEnE,MAAM,SAAS,GAAG,eAAe,CAAC;AAElC,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,EAAE;IACjE,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EACT,2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ACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
* A DOI is only reported as not found when every attempted server answered
|
|
8
8
|
* with an empty collection — if a server never answered, the DOI is reported
|
|
9
9
|
* as upstream-unavailable and retryable, on both the per-DOI and batch surfaces.
|
|
10
|
+
* A lookup the origin rate-limited (HTTP 429) is separated from a generic
|
|
11
|
+
* upstream failure and carries the origin's Retry-After wait, because that wait
|
|
12
|
+
* is the one thing that tells a caller when a retry can succeed.
|
|
10
13
|
* @module mcp-server/tools/definitions/biorxiv-get-preprint.tool
|
|
11
14
|
*/
|
|
12
15
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
@@ -45,9 +48,11 @@ export declare const biorxivGetPreprintTool: import("@cyanheads/mcp-ts-core").To
|
|
|
45
48
|
reason: z.ZodEnum<{
|
|
46
49
|
invalid_doi_format: "invalid_doi_format";
|
|
47
50
|
not_found: "not_found";
|
|
51
|
+
rate_limited: "rate_limited";
|
|
48
52
|
upstream_unavailable: "upstream_unavailable";
|
|
49
53
|
}>;
|
|
50
54
|
retryable: z.ZodBoolean;
|
|
55
|
+
retryAfter: z.ZodOptional<z.ZodNumber>;
|
|
51
56
|
}, z.core.$strip>>;
|
|
52
57
|
}, z.core.$strip>, readonly [{
|
|
53
58
|
readonly reason: "doi_not_found";
|
|
@@ -65,5 +70,11 @@ export declare const biorxivGetPreprintTool: import("@cyanheads/mcp-ts-core").To
|
|
|
65
70
|
readonly retryable: true;
|
|
66
71
|
readonly when: "No DOI resolved and at least one lookup failed against api.biorxiv.org, so absence could not be established for any requested DOI.";
|
|
67
72
|
readonly recovery: "Retry the request after a short delay — the DOIs may well exist; api.biorxiv.org did not answer.";
|
|
73
|
+
}, {
|
|
74
|
+
readonly reason: "rate_limited";
|
|
75
|
+
readonly code: JsonRpcErrorCode.RateLimited;
|
|
76
|
+
readonly retryable: true;
|
|
77
|
+
readonly when: "No DOI resolved and at least one lookup was rejected with HTTP 429 by api.biorxiv.org.";
|
|
78
|
+
readonly recovery: "Wait the retryAfter seconds before retrying — every preprint metadata tool queries the same origin, so none of them will answer sooner.";
|
|
68
79
|
}], undefined>;
|
|
69
80
|
//# sourceMappingURL=biorxiv-get-preprint.tool.d.ts.map
|