@cyanheads/biorxiv-mcp-server 0.2.0 → 0.2.2
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 +5 -5
- package/CLAUDE.md +5 -5
- package/Dockerfile +1 -1
- package/README.md +10 -4
- package/changelog/0.2.x/0.2.1.md +30 -0
- package/changelog/0.2.x/0.2.2.md +21 -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 +24 -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 +77 -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 +17 -2
- 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 +56 -37
- 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 +17 -2
- 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 +41 -10
- 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 +18 -2
- 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 +104 -23
- 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 +2 -2
- package/dist/mcp-server/tools/definitions/index.d.ts +54 -9
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/services/biorxiv/biorxiv-service.d.ts.map +1 -1
- 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 +136 -14
- package/dist/services/biorxiv-fulltext/biorxiv-fulltext-service.js.map +1 -1
- package/dist/services/europe-pmc/europe-pmc-service.d.ts.map +1 -1
- package/package.json +15 -9
- package/server.json +31 -3
package/AGENTS.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Agent Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** biorxiv-mcp-server
|
|
4
|
-
**Version:** 0.2.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.
|
|
6
|
-
**Engines:** Bun ≥1.3.
|
|
7
|
-
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.
|
|
4
|
+
**Version:** 0.2.2
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.1`
|
|
6
|
+
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
|
+
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
|
|
8
8
|
**Zod:** ^4.4.3
|
|
9
9
|
|
|
10
10
|
> **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
|
|
@@ -198,7 +198,7 @@ src/
|
|
|
198
198
|
## Domain Conventions
|
|
199
199
|
|
|
200
200
|
- **DOI format:** `10.1101/YYYY.MM.DD.NNNNNN`. Validate on input — the bioRxiv API returns empty collections for malformed DOIs without an error code.
|
|
201
|
-
- **Server parameter:** `"biorxiv" | "medrxiv" | "both"`. Default to `"both"
|
|
201
|
+
- **Server parameter:** `"biorxiv" | "medrxiv" | "both"`. Default to `"both"`, including for DOI-resolution tools — both servers issue `10.1101/` DOIs, so the DOI never identifies the server and a single-server default silently misses records held by the other. Fan out via `Promise.allSettled` when `"both"` and name the answering server in the output.
|
|
202
202
|
- **Pagination:** integer `cursor` offset (0, 30, 60, …). Page size is fixed at 30 by the API — do not expose a `limit` parameter.
|
|
203
203
|
- **Two-server pagination:** when `server="both"`, surface per-server state: `{ biorxiv: { cursor, total }, medrxiv: { cursor, total } }`. A merged cursor is ambiguous.
|
|
204
204
|
- **EuropePMC enrichment:** `biorxiv_search_preprints` uses EuropePMC for relevance then enriches matching DOIs via the details endpoint. Enrichment routes based on `input.server` — when explicit ("biorxiv" or "medrxiv"), always use that server. `10.1101/` prefix is used as a hint only within `server="both"` to prefer bioRxiv first, but is not a reliable discriminator (both servers share this prefix).
|
package/CLAUDE.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Agent Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** biorxiv-mcp-server
|
|
4
|
-
**Version:** 0.2.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.
|
|
6
|
-
**Engines:** Bun ≥1.3.
|
|
7
|
-
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.
|
|
4
|
+
**Version:** 0.2.2
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.1`
|
|
6
|
+
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
|
+
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
|
|
8
8
|
**Zod:** ^4.4.3
|
|
9
9
|
|
|
10
10
|
> **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
|
|
@@ -198,7 +198,7 @@ src/
|
|
|
198
198
|
## Domain Conventions
|
|
199
199
|
|
|
200
200
|
- **DOI format:** `10.1101/YYYY.MM.DD.NNNNNN`. Validate on input — the bioRxiv API returns empty collections for malformed DOIs without an error code.
|
|
201
|
-
- **Server parameter:** `"biorxiv" | "medrxiv" | "both"`. Default to `"both"
|
|
201
|
+
- **Server parameter:** `"biorxiv" | "medrxiv" | "both"`. Default to `"both"`, including for DOI-resolution tools — both servers issue `10.1101/` DOIs, so the DOI never identifies the server and a single-server default silently misses records held by the other. Fan out via `Promise.allSettled` when `"both"` and name the answering server in the output.
|
|
202
202
|
- **Pagination:** integer `cursor` offset (0, 30, 60, …). Page size is fixed at 30 by the API — do not expose a `limit` parameter.
|
|
203
203
|
- **Two-server pagination:** when `server="both"`, surface per-server state: `{ biorxiv: { cursor, total }, medrxiv: { cursor, total } }`. A merged cursor is ambiguous.
|
|
204
204
|
- **EuropePMC enrichment:** `biorxiv_search_preprints` uses EuropePMC for relevance then enriches matching DOIs via the details endpoint. Enrichment routes based on `input.server` — when explicit ("biorxiv" or "medrxiv"), always use that server. `10.1101/` prefix is used as a hint only within `server="both"` to prefer bioRxiv first, but is not a reliable discriminator (both servers share this prefix).
|
package/Dockerfile
CHANGED
|
@@ -60,7 +60,7 @@ RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
|
60
60
|
ARG OTEL_ENABLED=true
|
|
61
61
|
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
62
62
|
if [ "$OTEL_ENABLED" = "true" ]; then \
|
|
63
|
-
bun add @hono/otel \
|
|
63
|
+
bun add --omit=dev --ignore-scripts @hono/otel \
|
|
64
64
|
@opentelemetry/instrumentation-http \
|
|
65
65
|
@opentelemetry/exporter-metrics-otlp-http \
|
|
66
66
|
@opentelemetry/exporter-trace-otlp-http \
|
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,6 +42,7 @@ 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
46
|
|
|
46
47
|
---
|
|
47
48
|
|
|
@@ -53,6 +54,8 @@ Page through preprints in a date interval.
|
|
|
53
54
|
- Fixed page size of 30 (API constraint); advance with integer `cursor` (0, 30, 60, …)
|
|
54
55
|
- Response includes `total` count per server for calculating remaining pages
|
|
55
56
|
- When `server="both"`, each server paginates independently; response surfaces per-server pagination state (`{ biorxiv: { cursor, total }, medrxiv: { cursor, total } }`)
|
|
57
|
+
- 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
|
+
- A server that does not answer 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
|
|
56
59
|
|
|
57
60
|
---
|
|
58
61
|
|
|
@@ -72,9 +75,10 @@ Keyword and/or author search with relevance ranking.
|
|
|
72
75
|
|
|
73
76
|
Resolve a preprint DOI to its journal publication crosswalk.
|
|
74
77
|
|
|
75
|
-
- Uses the `/pubs/{server}/{doi}` endpoint for richer metadata than the `
|
|
78
|
+
- Uses the `/pubs/{server}/{doi}` endpoint for richer metadata than the `publishedJournalDoi` field in `biorxiv_get_preprint`
|
|
76
79
|
- Returns journal DOI, journal name, published date, and corresponding author institution
|
|
77
|
-
- Use when the preprint's `
|
|
80
|
+
- Use when the preprint's `publishedJournalDoi` field is present and you need the full crosswalk record
|
|
81
|
+
- 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
|
|
78
82
|
|
|
79
83
|
---
|
|
80
84
|
|
|
@@ -84,8 +88,10 @@ Retrieve a preprint's full text as best-effort Markdown.
|
|
|
84
88
|
|
|
85
89
|
- Fetches the rendered HTML article page (`www.{server}.org/content/{doi}v{N}.full`) and extracts Markdown — there is no keyless JATS source
|
|
86
90
|
- Resolves the latest version via the details API first, for the URL version and clean not-found handling
|
|
87
|
-
-
|
|
91
|
+
- 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
|
|
92
|
+
- 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
|
|
88
93
|
- PDF-only preprints and blocked/challenge pages return a typed `fulltext_unavailable` error routing to `biorxiv_get_preprint`
|
|
94
|
+
- 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
|
|
89
95
|
|
|
90
96
|
---
|
|
91
97
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "biorxiv_get_preprint and biorxiv_get_published_version distinguish upstream failures from not-found; biorxiv_list_recent surfaces exhausted cursors and failed servers (#32, #34, #35, #39)"
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.2.1 — 2026-08-09
|
|
8
|
+
|
|
9
|
+
## Changed
|
|
10
|
+
|
|
11
|
+
- **`biorxiv_get_published_version`** — `server` gains `"both"` and now defaults to it, fanning out across bioRxiv and medRxiv in parallel (the two servers share the `10.1101/` prefix, so a single-server default silently missed records held by the other). New required output field `server` names which server answered. [#34](https://github.com/cyanheads/biorxiv-mcp-server/issues/34)
|
|
12
|
+
|
|
13
|
+
## Fixed
|
|
14
|
+
|
|
15
|
+
- **`biorxiv_get_preprint`** — a DOI is now reported `not_found` only when every attempted server answered with an empty collection; a server that failed to respond leaves absence unestablished and the DOI is classified `upstream_unavailable` (retryable) instead. Each `failed[]` entry carries a new `reason` (`not_found`, `invalid_doi_format`, `upstream_unavailable`) and `retryable` flag; the batch-level thrown error follows the same discrimination via a new declared `upstream_unavailable` contract entry. [#32](https://github.com/cyanheads/biorxiv-mcp-server/issues/32)
|
|
16
|
+
- **`biorxiv_get_published_version`** — `doi_not_found` recovery hint no longer asserts the preprint is unpublished; it now points at retrying with `server="both"` or checking `publishedJournalDoi`. A server that fails to respond throws a new retryable `upstream_unavailable` instead of being folded into `doi_not_found`. [#34](https://github.com/cyanheads/biorxiv-mcp-server/issues/34)
|
|
17
|
+
- **`biorxiv_list_recent`** — under `server="both"`, a per-server cursor past the last page now sets a new `exhausted: true` flag instead of its `total: 0` reading as "nothing in the interval"; a server that fails to answer is named in a new top-level `failed[]` (rather than silently dropped) and in the response `notice`, marking the result set as partial. `ctx.enrich.notice` is last-wins, so every applicable qualification (failed servers, exhausted cursors, empty results) is now composed into one notice string. [#35](https://github.com/cyanheads/biorxiv-mcp-server/issues/35), [#39](https://github.com/cyanheads/biorxiv-mcp-server/issues/39)
|
|
18
|
+
- **README** — `biorxiv_get_published_version` section referenced a `published` field; corrected to `publishedJournalDoi`, matching the actual `biorxiv_get_preprint` output.
|
|
19
|
+
|
|
20
|
+
## Dependencies
|
|
21
|
+
|
|
22
|
+
- **`@cyanheads/mcp-ts-core`** `^0.10.14` → `^0.11.1`
|
|
23
|
+
- **`typescript`** `^6.0.3` → `^7.0.2`
|
|
24
|
+
- **`defuddle`** `^0.19.0` → `^0.19.2`
|
|
25
|
+
- **`linkedom`** `^0.18.12` → `^0.18.13`
|
|
26
|
+
- **`@biomejs/biome`** `2.5.2` → `2.5.7`
|
|
27
|
+
- **`@types/node`** `26.1.0` → `26.1.2`
|
|
28
|
+
- **`ignore`** `^7.0.5` → `^7.0.6`
|
|
29
|
+
- **`tsc-alias`** `^1.9.0` → `^1.9.1`
|
|
30
|
+
- New `overrides` block pins `fast-uri` `^3.1.5`, `ip-address` `^10.3.1`, `js-yaml` `^3.15.1`, and `postcss` `^8.5.23` — transitive advisories that a floating range alone wouldn't hold down; clears `bun audit` to zero vulnerabilities.
|
|
@@ -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.
|
|
@@ -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;AAE/D;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,CAAC,CAAU,EAAW,EAAE,CACnD,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,CAAC;SACN,UAAU,CAAC,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC;SAC/D,QAAQ,CAAC,4EAA4E,CAAC;IACzF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IAChG,gBAAgB,EAAE,CAAC;SAChB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,kDAAkD,CAAC;SAC3D,QAAQ,CAAC,6BAA6B,CAAC;IAC1C,yEAAyE;IACzE,kEAAkE;IAClE,iBAAiB,EAAE,CAAC;SACjB,UAAU,CAAC,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;SACrF,QAAQ,CACP,6FAA6F,CAC9F;IACH,iBAAiB,EAAE,CAAC;SACjB,UAAU,CAAC,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;SACrF,QAAQ,CACP,6FAA6F,CAC9F;CACJ,CAAC,CAAC;AAIH,IAAI,OAAiC,CAAC;AAEtC,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,cAAc,CAAC,kBAAkB,EAAE;QAC7C,MAAM,EAAE,gBAAgB;QACxB,UAAU,EAAE,sBAAsB;QAClC,gBAAgB,EAAE,wBAAwB;QAC1C,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,15 @@
|
|
|
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.
|
|
10
15
|
* @module mcp-server/tools/definitions/biorxiv-get-fulltext.tool
|
|
11
16
|
*/
|
|
12
17
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
@@ -15,6 +20,7 @@ export declare const biorxivGetFulltextTool: import("@cyanheads/mcp-ts-core").To
|
|
|
15
20
|
doi: z.ZodString;
|
|
16
21
|
server: z.ZodDefault<z.ZodEnum<{
|
|
17
22
|
biorxiv: "biorxiv";
|
|
23
|
+
both: "both";
|
|
18
24
|
medrxiv: "medrxiv";
|
|
19
25
|
}>>;
|
|
20
26
|
offset: z.ZodDefault<z.ZodNumber>;
|
|
@@ -44,8 +50,20 @@ export declare const biorxivGetFulltextTool: import("@cyanheads/mcp-ts-core").To
|
|
|
44
50
|
}, {
|
|
45
51
|
readonly reason: "doi_not_found";
|
|
46
52
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
47
|
-
readonly when: "The DOI resolves to
|
|
48
|
-
readonly recovery: "
|
|
53
|
+
readonly when: "The DOI resolves to an empty collection on every attempted server.";
|
|
54
|
+
readonly recovery: "Retry with server=\"both\" if you scoped to one server, or find the correct DOI with biorxiv_search_preprints.";
|
|
55
|
+
}, {
|
|
56
|
+
readonly reason: "upstream_unavailable";
|
|
57
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
58
|
+
readonly retryable: true;
|
|
59
|
+
readonly when: "No attempted server resolved the DOI and at least one lookup failed against api.biorxiv.org.";
|
|
60
|
+
readonly recovery: "Retry the request after a short delay — the preprint may well exist; api.biorxiv.org did not answer.";
|
|
61
|
+
}, {
|
|
62
|
+
readonly reason: "rate_limited";
|
|
63
|
+
readonly code: JsonRpcErrorCode.RateLimited;
|
|
64
|
+
readonly retryable: true;
|
|
65
|
+
readonly when: "The full-text origin (www.biorxiv.org / www.medrxiv.org) returned HTTP 429 for this host.";
|
|
66
|
+
readonly recovery: "Wait the retryAfter seconds before calling again, and use biorxiv_get_preprint for the title, abstract, and metadata in the meantime.";
|
|
49
67
|
}, {
|
|
50
68
|
readonly reason: "fulltext_unavailable";
|
|
51
69
|
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;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAOjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsTjC,CAAC"}
|
|
@@ -3,10 +3,15 @@
|
|
|
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.
|
|
10
15
|
* @module mcp-server/tools/definitions/biorxiv-get-fulltext.tool
|
|
11
16
|
*/
|
|
12
17
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
@@ -16,16 +21,16 @@ import { getBiorxivFullTextService } from '../../../services/biorxiv-fulltext/bi
|
|
|
16
21
|
const DOI_REGEX = /^10\.\d{4,}\//;
|
|
17
22
|
export const biorxivGetFulltextTool = tool('biorxiv_get_fulltext', {
|
|
18
23
|
title: 'Get Preprint Full Text',
|
|
19
|
-
description:
|
|
24
|
+
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
25
|
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
21
26
|
input: z.object({
|
|
22
27
|
doi: z
|
|
23
28
|
.string()
|
|
24
29
|
.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
30
|
server: z
|
|
26
|
-
.enum(['biorxiv', 'medrxiv'])
|
|
27
|
-
.default('
|
|
28
|
-
.describe('Server the preprint was posted on.
|
|
31
|
+
.enum(['biorxiv', 'medrxiv', 'both'])
|
|
32
|
+
.default('both')
|
|
33
|
+
.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
34
|
offset: z
|
|
30
35
|
.number()
|
|
31
36
|
.int()
|
|
@@ -101,8 +106,22 @@ export const biorxivGetFulltextTool = tool('biorxiv_get_fulltext', {
|
|
|
101
106
|
{
|
|
102
107
|
reason: 'doi_not_found',
|
|
103
108
|
code: JsonRpcErrorCode.NotFound,
|
|
104
|
-
when: 'The DOI resolves to
|
|
105
|
-
recovery: '
|
|
109
|
+
when: 'The DOI resolves to an empty collection on every attempted server.',
|
|
110
|
+
recovery: 'Retry with server="both" if you scoped to one server, or find the correct DOI with biorxiv_search_preprints.',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
reason: 'upstream_unavailable',
|
|
114
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
115
|
+
retryable: true,
|
|
116
|
+
when: 'No attempted server resolved the DOI and at least one lookup failed against api.biorxiv.org.',
|
|
117
|
+
recovery: 'Retry the request after a short delay — the preprint may well exist; api.biorxiv.org did not answer.',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
reason: 'rate_limited',
|
|
121
|
+
code: JsonRpcErrorCode.RateLimited,
|
|
122
|
+
retryable: true,
|
|
123
|
+
when: 'The full-text origin (www.biorxiv.org / www.medrxiv.org) returned HTTP 429 for this host.',
|
|
124
|
+
recovery: 'Wait the retryAfter seconds before calling again, and use biorxiv_get_preprint for the title, abstract, and metadata in the meantime.',
|
|
106
125
|
},
|
|
107
126
|
{
|
|
108
127
|
reason: 'fulltext_unavailable',
|
|
@@ -131,22 +150,57 @@ export const biorxivGetFulltextTool = tool('biorxiv_get_fulltext', {
|
|
|
131
150
|
}
|
|
132
151
|
// Resolve the preprint and its latest version via the JSON details API — this
|
|
133
152
|
// provides the version for the full-text URL and clean not-found handling.
|
|
134
|
-
//
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
153
|
+
// Only this step fans out; the full-text fetch targets the server that answered.
|
|
154
|
+
const service = getBiorxivApiService();
|
|
155
|
+
const servers = input.server === 'both' ? ['biorxiv', 'medrxiv'] : [input.server];
|
|
156
|
+
const settled = await Promise.allSettled(servers.map((server) => service.getDetails(input.doi, server, ctx)));
|
|
157
|
+
let resolved;
|
|
158
|
+
for (const [i, settledResult] of settled.entries()) {
|
|
159
|
+
if (settledResult.status === 'fulfilled' && settledResult.value.length > 0) {
|
|
160
|
+
resolved = {
|
|
161
|
+
server: servers[i],
|
|
162
|
+
version: settledResult.value.at(-1)?.version ?? '1',
|
|
163
|
+
};
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
143
166
|
}
|
|
144
|
-
|
|
145
|
-
|
|
167
|
+
if (!resolved) {
|
|
168
|
+
// "Not found" is a claim about what the servers reported, so a server that
|
|
169
|
+
// never answered leaves absence unestablished — and retryable.
|
|
170
|
+
const rejections = settled.flatMap((r, i) => r.status === 'rejected' ? [{ server: servers[i], error: r.reason }] : []);
|
|
171
|
+
if (rejections.length > 0) {
|
|
172
|
+
const detail = rejections
|
|
173
|
+
.map((f) => `${f.server}: ${f.error instanceof Error ? f.error.message : String(f.error)}`)
|
|
174
|
+
.join('; ');
|
|
175
|
+
throw ctx.fail('upstream_unavailable', `Version lookup for ${input.doi} failed — ${detail}`, {
|
|
176
|
+
doi: input.doi,
|
|
177
|
+
servers: rejections.map((f) => f.server),
|
|
178
|
+
...ctx.recoveryFor('upstream_unavailable'),
|
|
179
|
+
}, { cause: rejections[0]?.error });
|
|
180
|
+
}
|
|
181
|
+
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') });
|
|
182
|
+
}
|
|
183
|
+
const { server, version } = resolved;
|
|
184
|
+
const result = await getBiorxivFullTextService().fetchFullText(server, input.doi, version, ctx);
|
|
146
185
|
if (result.kind === 'unavailable') {
|
|
186
|
+
if (result.reason === 'rate_limited') {
|
|
187
|
+
// Dynamic recovery — the origin's own wait is more actionable than the
|
|
188
|
+
// contract's static hint. The block-page HTML never leaves the service.
|
|
189
|
+
const wait = result.retryAfter === undefined ? 'a minute or two' : `${result.retryAfter} seconds`;
|
|
190
|
+
throw ctx.fail('rate_limited', result.detail, {
|
|
191
|
+
doi: input.doi,
|
|
192
|
+
server,
|
|
193
|
+
version,
|
|
194
|
+
sourceUrl: result.sourceUrl,
|
|
195
|
+
...(result.retryAfter !== undefined && { retryAfter: result.retryAfter }),
|
|
196
|
+
recovery: {
|
|
197
|
+
hint: `Wait ${wait} before calling biorxiv_get_fulltext again for this origin, and use biorxiv_get_preprint for the title, abstract, and metadata in the meantime.`,
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
}
|
|
147
201
|
throw ctx.fail('fulltext_unavailable', result.detail, {
|
|
148
202
|
doi: input.doi,
|
|
149
|
-
server
|
|
203
|
+
server,
|
|
150
204
|
version,
|
|
151
205
|
sourceUrl: result.sourceUrl,
|
|
152
206
|
...ctx.recoveryFor('fulltext_unavailable'),
|
|
@@ -170,7 +224,7 @@ export const biorxivGetFulltextTool = tool('biorxiv_get_fulltext', {
|
|
|
170
224
|
}
|
|
171
225
|
return {
|
|
172
226
|
doi: input.doi,
|
|
173
|
-
server
|
|
227
|
+
server,
|
|
174
228
|
version,
|
|
175
229
|
...(result.title && { title: result.title }),
|
|
176
230
|
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
|
|
1
|
+
{"version":3,"file":"biorxiv-get-fulltext.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-get-fulltext.tool.ts"],"names":[],"mappings":"AAAA;;;;;;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A2B,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"}
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* by DOI. Each DOI call returns all revisions in a single response. When
|
|
5
5
|
* server="both", each DOI fans out across bioRxiv and medRxiv in parallel;
|
|
6
6
|
* per-DOI failures are reported in failed[] rather than aborting the batch.
|
|
7
|
+
* A DOI is only reported as not found when every attempted server answered
|
|
8
|
+
* with an empty collection — if a server never answered, the DOI is reported
|
|
9
|
+
* as upstream-unavailable and retryable, on both the per-DOI and batch surfaces.
|
|
7
10
|
* @module mcp-server/tools/definitions/biorxiv-get-preprint.tool
|
|
8
11
|
*/
|
|
9
12
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
@@ -12,8 +15,8 @@ export declare const biorxivGetPreprintTool: import("@cyanheads/mcp-ts-core").To
|
|
|
12
15
|
dois: z.ZodArray<z.ZodString>;
|
|
13
16
|
server: z.ZodDefault<z.ZodEnum<{
|
|
14
17
|
biorxiv: "biorxiv";
|
|
15
|
-
medrxiv: "medrxiv";
|
|
16
18
|
both: "both";
|
|
19
|
+
medrxiv: "medrxiv";
|
|
17
20
|
}>>;
|
|
18
21
|
}, z.core.$strip>, z.ZodObject<{
|
|
19
22
|
preprints: z.ZodArray<z.ZodObject<{
|
|
@@ -39,16 +42,28 @@ export declare const biorxivGetPreprintTool: import("@cyanheads/mcp-ts-core").To
|
|
|
39
42
|
failed: z.ZodArray<z.ZodObject<{
|
|
40
43
|
doi: z.ZodString;
|
|
41
44
|
error: z.ZodString;
|
|
45
|
+
reason: z.ZodEnum<{
|
|
46
|
+
invalid_doi_format: "invalid_doi_format";
|
|
47
|
+
not_found: "not_found";
|
|
48
|
+
upstream_unavailable: "upstream_unavailable";
|
|
49
|
+
}>;
|
|
50
|
+
retryable: z.ZodBoolean;
|
|
42
51
|
}, z.core.$strip>>;
|
|
43
52
|
}, z.core.$strip>, readonly [{
|
|
44
53
|
readonly reason: "doi_not_found";
|
|
45
54
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
46
|
-
readonly when: "ALL requested DOIs resolve to empty collections on all requested servers.";
|
|
55
|
+
readonly when: "ALL requested DOIs resolve to empty collections on all requested servers, with every server answering.";
|
|
47
56
|
readonly recovery: "Verify the DOI exists on bioRxiv or medRxiv. Supported prefixes: 10.1101/ and 10.64898/.";
|
|
48
57
|
}, {
|
|
49
58
|
readonly reason: "invalid_doi_format";
|
|
50
59
|
readonly code: JsonRpcErrorCode.ValidationError;
|
|
51
60
|
readonly when: "One or more input DOIs do not match the 10.NNNN/ pattern.";
|
|
52
61
|
readonly recovery: "Correct the DOI format — bioRxiv DOIs start with 10.1101/ or 10.64898/ followed by the manuscript ID.";
|
|
62
|
+
}, {
|
|
63
|
+
readonly reason: "upstream_unavailable";
|
|
64
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
65
|
+
readonly retryable: true;
|
|
66
|
+
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
|
+
readonly recovery: "Retry the request after a short delay — the DOIs may well exist; api.biorxiv.org did not answer.";
|
|
53
68
|
}], undefined>;
|
|
54
69
|
//# sourceMappingURL=biorxiv-get-preprint.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biorxiv-get-preprint.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-get-preprint.tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"biorxiv-get-preprint.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/biorxiv-get-preprint.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAgEjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0MjC,CAAC"}
|