@cyanheads/biorxiv-mcp-server 0.2.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  # Agent Protocol
2
2
 
3
3
  **Server:** biorxiv-mcp-server
4
- **Version:** 0.2.1
4
+ **Version:** 0.2.2
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
package/CLAUDE.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Agent Protocol
2
2
 
3
3
  **Server:** biorxiv-mcp-server
4
- **Version:** 0.2.1
4
+ **Version:** 0.2.2
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
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  <div align="center">
9
9
 
10
- [![Version](https://img.shields.io/badge/Version-0.2.1-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/biorxiv-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.30.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/biorxiv-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/biorxiv-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.2-blueviolet.svg?style=flat-square)](https://bun.sh/)
10
+ [![Version](https://img.shields.io/badge/Version-0.2.2-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/biorxiv-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.30.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/biorxiv-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/biorxiv-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.2-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
11
 
12
12
  </div>
13
13
 
@@ -88,8 +88,10 @@ Retrieve a preprint's full text as best-effort Markdown.
88
88
 
89
89
  - Fetches the rendered HTML article page (`www.{server}.org/content/{doi}v{N}.full`) and extracts Markdown — there is no keyless JATS source
90
90
  - Resolves the latest version via the details API first, for the URL version and clean not-found handling
91
- - Long articles page via `offset`/`limit` character chunking (`totalChars`, `remainingChars`, `hasMore`)
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
92
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
93
95
 
94
96
  ---
95
97
 
@@ -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 core config. Lazy-parsed on first access.
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;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAG3C,QAAA,MAAM,kBAAkB;;;;;;iBA+BtB,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
+ {"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 core config. Lazy-parsed on first access.
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((v) => (typeof v === 'string' && v.startsWith('${') ? undefined : v), z.string().email().optional())
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;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,+EAA+E;IAC/E,4EAA4E;IAC5E,MAAM,EAAE,CAAC;SACN,UAAU,CACT,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EACpE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAC9B;SACA,QAAQ,CAAC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;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. Long articles are paged with
7
- * offset/limit character chunking. Full text is best-effort HTML→Markdown, not
8
- * structured JATS; preprints that are PDF-only or whose page is blocked return a
9
- * typed `fulltext_unavailable` error routing to biorxiv_get_preprint.
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 no preprint on the requested server.";
48
- readonly recovery: "Find the correct DOI and server with biorxiv_search_preprints, or retry with the other server value.";
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;;;;;;;;;;GAUG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmPjC,CAAC"}
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. Long articles are paged with
7
- * offset/limit character chunking. Full text is best-effort HTML→Markdown, not
8
- * structured JATS; preprints that are PDF-only or whose page is blocked return a
9
- * typed `fulltext_unavailable` error routing to biorxiv_get_preprint.
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: "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. 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). 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.",
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('biorxiv')
28
- .describe('Server the preprint was posted on. Defaults to biorxiv.'),
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 no preprint on the requested server.',
105
- recovery: 'Find the correct DOI and server with biorxiv_search_preprints, or retry with the other server value.',
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
- // Transient failures here bubble as ServiceUnavailable.
135
- const revisions = await getBiorxivApiService().getDetails(input.doi, input.server, ctx);
136
- const latest = revisions.at(-1);
137
- if (!latest) {
138
- throw ctx.fail('doi_not_found', `No preprint found for ${input.doi} on ${input.server}.`, {
139
- doi: input.doi,
140
- server: input.server,
141
- ...ctx.recoveryFor('doi_not_found'),
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
- const version = latest.version ?? '1';
145
- const result = await getBiorxivFullTextService().fetchFullText(input.server, input.doi, version, ctx);
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: input.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: input.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;;;;;;;;;;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,OAAO,CAAC,CAAC,CAAC;aACV,QAAQ,CACP,mNAAmN,CACpN;QACH,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,GAAG,EAAE;aACL,GAAG,CAAC,CAAC,CA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I,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;;;;;;;;;;;;;;;GAeG;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;AAEpG,MAAM,SAAS,GAAG,eAAe,CAAC;AAElC,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,EAAE;IACjE,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EACT,2nCAA2nC;IAC7nC,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;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E,iBAAiB,MAAM,CAAC,cAAc,CAAC,cAAc,EAAE,eAAe,MAAM,CAAC,OAAO,EAAE,CAC1P,CAAC;QACF,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS;YAChC,KAAK,CAAC,IAAI,CAAC,gCAAgC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QACjE,KAAK,CAAC,IAAI,CAAC,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"}
@@ -227,6 +227,7 @@ export declare const allToolDefinitions: readonly [import("@cyanheads/mcp-ts-cor
227
227
  doi: import("zod").ZodString;
228
228
  server: import("zod").ZodDefault<import("zod").ZodEnum<{
229
229
  biorxiv: "biorxiv";
230
+ both: "both";
230
231
  medrxiv: "medrxiv";
231
232
  }>>;
232
233
  offset: import("zod").ZodDefault<import("zod").ZodNumber>;
@@ -256,8 +257,20 @@ export declare const allToolDefinitions: readonly [import("@cyanheads/mcp-ts-cor
256
257
  }, {
257
258
  readonly reason: "doi_not_found";
258
259
  readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
259
- readonly when: "The DOI resolves to no preprint on the requested server.";
260
- readonly recovery: "Find the correct DOI and server with biorxiv_search_preprints, or retry with the other server value.";
260
+ readonly when: "The DOI resolves to an empty collection on every attempted server.";
261
+ readonly recovery: "Retry with server=\"both\" if you scoped to one server, or find the correct DOI with biorxiv_search_preprints.";
262
+ }, {
263
+ readonly reason: "upstream_unavailable";
264
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.ServiceUnavailable;
265
+ readonly retryable: true;
266
+ readonly when: "No attempted server resolved the DOI and at least one lookup failed against api.biorxiv.org.";
267
+ readonly recovery: "Retry the request after a short delay — the preprint may well exist; api.biorxiv.org did not answer.";
268
+ }, {
269
+ readonly reason: "rate_limited";
270
+ readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.RateLimited;
271
+ readonly retryable: true;
272
+ readonly when: "The full-text origin (www.biorxiv.org / www.medrxiv.org) returned HTTP 429 for this host.";
273
+ readonly recovery: "Wait the retryAfter seconds before calling again, and use biorxiv_get_preprint for the title, abstract, and metadata in the meantime.";
261
274
  }, {
262
275
  readonly reason: "fulltext_unavailable";
263
276
  readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.NotFound;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAShF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAOrB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAShF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAOrB,CAAC"}
@@ -5,9 +5,20 @@
5
5
  *
6
6
  * This is a DISTINCT fetch path from BiorxivApiService: it EXPECTS an HTML
7
7
  * document (the rendered article page), so it never routes through the JSON
8
- * API's "HTML response = upstream error" guard. Cloudflare challenge/block pages
9
- * and empty extractions are surfaced as a typed `unavailable` result rather than
10
- * crashing or feeding interstitial garbage to the extractor.
8
+ * API's "HTML response = upstream error" guard. Cloudflare challenge/block pages,
9
+ * origin rate limiting (HTTP 429), and empty extractions are surfaced as a typed
10
+ * `unavailable` result rather than crashing or feeding interstitial garbage to
11
+ * the extractor.
12
+ *
13
+ * Extracted articles are cached in `ctx.state` under
14
+ * `fulltext/v1/{server}/{doi}/{version}` for {@link FULLTEXT_CACHE_TTL_SECONDS}
15
+ * seconds, so paging a long article with offset/limit costs one origin fetch and
16
+ * one extraction instead of one per chunk. `ctx.state` is tenant-scoped, which is
17
+ * the intended blast radius — no cross-tenant or process-wide sharing. Only
18
+ * `kind: 'article'` results are written: a blocked, rate-limited, or empty page
19
+ * must be able to recover on a later call. The cache is an optimization and never
20
+ * a dependency — a storage backend that refuses a read or a write degrades to an
21
+ * origin fetch instead of failing the caller.
11
22
  * @module services/biorxiv-fulltext/biorxiv-fulltext-service
12
23
  */
13
24
  import type { Context } from '@cyanheads/mcp-ts-core';
@@ -28,8 +39,15 @@ export type FullTextFetchResult = {
28
39
  sourceUrl: string;
29
40
  } | {
30
41
  kind: 'unavailable';
31
- reason: 'blocked' | 'empty';
42
+ reason: 'blocked' | 'empty' | 'rate_limited';
32
43
  detail: string;
44
+ /**
45
+ * Wait in whole seconds parsed from the origin's `Retry-After`, on
46
+ * `rate_limited` results that carried a usable one. Seconds rather than the
47
+ * raw header because the header's two RFC 9110 forms are not interchangeable
48
+ * in prose — an HTTP-date read as seconds renders nonsense.
49
+ */
50
+ retryAfter?: number;
33
51
  sourceUrl: string;
34
52
  };
35
53
  export declare class BiorxivFullTextService {
@@ -41,9 +59,13 @@ export declare class BiorxivFullTextService {
41
59
  *
42
60
  * Resolves to `{ kind: 'article', markdown, ... }` on success, or
43
61
  * `{ kind: 'unavailable', reason }` when the page is blocked (Cloudflare 403 /
44
- * challenge), missing, or yields no extractable text (PDF-only preprints).
45
- * Transient failures (5xx, timeout, network) bubble as `ServiceUnavailable`
46
- * after retry so the framework classifies them as retryable.
62
+ * challenge), rate-limited (429), missing, or yields no extractable text
63
+ * (PDF-only preprints). Transient failures (5xx, timeout, network) bubble as
64
+ * `ServiceUnavailable` after retry so the framework classifies them as retryable.
65
+ *
66
+ * A successful extraction is served from the tenant-scoped `ctx.state` cache on
67
+ * subsequent calls for the same server/DOI/version, so offset paging does not
68
+ * refetch the origin per chunk.
47
69
  */
48
70
  fetchFullText(server: BiorxivServer, doi: string, version: string, ctx: Context): Promise<FullTextFetchResult>;
49
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"biorxiv-fulltext-service.d.ts","sourceRoot":"","sources":["../../../src/services/biorxiv-fulltext/biorxiv-fulltext-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AA0CjE;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,GACD;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgC;IAC5D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAEnC,YAAY,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EASvD;IAED;;;;;;;;OAQG;IACG,aAAa,CACjB,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,OAAO,GACX,OAAO,CAAC,mBAAmB,CAAC,CA+E9B;CACF;AAMD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAE3F;AAED,wBAAgB,yBAAyB,IAAI,sBAAsB,CAMlE"}
1
+ {"version":3,"file":"biorxiv-fulltext-service.d.ts","sourceRoot":"","sources":["../../../src/services/biorxiv-fulltext/biorxiv-fulltext-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAsHjE;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,GACD;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,cAAc,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAKN,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgC;IAC5D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAEnC,YAAY,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EASvD;IAED;;;;;;;;;;;;OAYG;IACG,aAAa,CACjB,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,OAAO,GACX,OAAO,CAAC,mBAAmB,CAAC,CAuH9B;CACF;AAMD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAE3F;AAED,wBAAgB,yBAAyB,IAAI,sBAAsB,CAMlE"}
@@ -5,9 +5,20 @@
5
5
  *
6
6
  * This is a DISTINCT fetch path from BiorxivApiService: it EXPECTS an HTML
7
7
  * document (the rendered article page), so it never routes through the JSON
8
- * API's "HTML response = upstream error" guard. Cloudflare challenge/block pages
9
- * and empty extractions are surfaced as a typed `unavailable` result rather than
10
- * crashing or feeding interstitial garbage to the extractor.
8
+ * API's "HTML response = upstream error" guard. Cloudflare challenge/block pages,
9
+ * origin rate limiting (HTTP 429), and empty extractions are surfaced as a typed
10
+ * `unavailable` result rather than crashing or feeding interstitial garbage to
11
+ * the extractor.
12
+ *
13
+ * Extracted articles are cached in `ctx.state` under
14
+ * `fulltext/v1/{server}/{doi}/{version}` for {@link FULLTEXT_CACHE_TTL_SECONDS}
15
+ * seconds, so paging a long article with offset/limit costs one origin fetch and
16
+ * one extraction instead of one per chunk. `ctx.state` is tenant-scoped, which is
17
+ * the intended blast radius — no cross-tenant or process-wide sharing. Only
18
+ * `kind: 'article'` results are written: a blocked, rate-limited, or empty page
19
+ * must be able to recover on a later call. The cache is an optimization and never
20
+ * a dependency — a storage backend that refuses a read or a write degrades to an
21
+ * origin fetch instead of failing the caller.
11
22
  * @module services/biorxiv-fulltext/biorxiv-fulltext-service
12
23
  */
13
24
  import { McpError } from '@cyanheads/mcp-ts-core/errors';
@@ -31,6 +42,58 @@ const FULLTEXT_CONTENT_SELECTOR = '.fulltext-view';
31
42
  * is what medRxiv's Cloudflare edge returns for programmatic access.
32
43
  */
33
44
  const DETERMINISTIC_UNAVAILABLE_STATUSES = new Set([401, 403, 404, 410, 451]);
45
+ /**
46
+ * Statuses this service classifies itself rather than treating as a bug — the
47
+ * deterministic set plus 429, which becomes a `rate_limited` result. Passing them
48
+ * to `fetchWithTimeout` only lowers the log severity from `error` to `debug`; the
49
+ * thrown error and its classification are unchanged.
50
+ */
51
+ const EXPECTED_STATUSES = [...DETERMINISTIC_UNAVAILABLE_STATUSES, 429];
52
+ /**
53
+ * Lifetime of a cached extraction. A published version's rendered page is
54
+ * effectively immutable (a revision gets a new version, hence a new cache key),
55
+ * so this only bounds how long a re-render or a corrected page goes unseen. An
56
+ * hour comfortably covers paging through even the longest article.
57
+ */
58
+ const FULLTEXT_CACHE_TTL_SECONDS = 3_600;
59
+ /**
60
+ * Cache key: `fulltext/v1/{server}/{doi}/{version}`. Slash-delimited because the
61
+ * storage layer validates keys against `[a-zA-Z0-9_.\-/]` — a colon separator is
62
+ * rejected outright, and a DOI's own `/` and `.` are already inside the allowed
63
+ * set. The `v1` segment is the cached-value schema generation — bump it when
64
+ * {@link CachedArticle} changes so entries written by an older build are never
65
+ * read back under the new shape.
66
+ */
67
+ const cacheKeyFor = (server, doi, version) => `fulltext/v1/${server}/${doi}/${version}`;
68
+ /**
69
+ * Reads a cached extraction, treating any storage failure as a miss. A key the
70
+ * backend rejects, an unreachable provider, or an in-memory store at capacity
71
+ * must cost an origin fetch, not the caller's request.
72
+ */
73
+ async function readCachedArticle(ctx, key) {
74
+ try {
75
+ return (await ctx.state.get(key)) ?? undefined;
76
+ }
77
+ catch (err) {
78
+ ctx.log.warning('Full-text cache read failed — falling through to the origin', {
79
+ key,
80
+ error: err instanceof Error ? err.message : String(err),
81
+ });
82
+ return;
83
+ }
84
+ }
85
+ /** Writes an extraction to the cache; a storage failure only costs the next page a refetch. */
86
+ async function writeCachedArticle(ctx, key, article) {
87
+ try {
88
+ await ctx.state.set(key, article, { ttl: FULLTEXT_CACHE_TTL_SECONDS });
89
+ }
90
+ catch (err) {
91
+ ctx.log.warning('Full-text cache write failed — the next page will refetch the origin', {
92
+ key,
93
+ error: err instanceof Error ? err.message : String(err),
94
+ });
95
+ }
96
+ }
34
97
  /**
35
98
  * Markers unique to Cloudflare's interstitial / block pages. Deliberately narrow:
36
99
  * a genuine bioRxiv article page references `cloudflare-static/email-decode.min.js`
@@ -49,6 +112,24 @@ const CHALLENGE_MARKERS = [
49
112
  function isChallengePage(html) {
50
113
  return CHALLENGE_MARKERS.some((marker) => html.includes(marker));
51
114
  }
115
+ /**
116
+ * Reads a `Retry-After` header value as a wait in whole seconds. RFC 9110 §10.2.3
117
+ * allows either delta-seconds or an HTTP-date; the date form is converted to a
118
+ * wait from now and clamped at zero. Returns undefined for an absent, malformed,
119
+ * or unparseable value so callers fall back to generic wording rather than
120
+ * echoing an uninterpretable header into agent-facing prose.
121
+ */
122
+ function parseRetryAfterSeconds(raw) {
123
+ if (typeof raw !== 'string')
124
+ return;
125
+ const trimmed = raw.trim();
126
+ if (/^\d+$/.test(trimmed))
127
+ return Number(trimmed);
128
+ const dateMs = Date.parse(trimmed);
129
+ if (Number.isNaN(dateMs))
130
+ return;
131
+ return Math.max(0, Math.round((dateMs - Date.now()) / 1000));
132
+ }
52
133
  export class BiorxivFullTextService {
53
134
  webBaseUrls;
54
135
  userAgent;
@@ -67,20 +148,36 @@ export class BiorxivFullTextService {
67
148
  *
68
149
  * Resolves to `{ kind: 'article', markdown, ... }` on success, or
69
150
  * `{ kind: 'unavailable', reason }` when the page is blocked (Cloudflare 403 /
70
- * challenge), missing, or yields no extractable text (PDF-only preprints).
71
- * Transient failures (5xx, timeout, network) bubble as `ServiceUnavailable`
72
- * after retry so the framework classifies them as retryable.
151
+ * challenge), rate-limited (429), missing, or yields no extractable text
152
+ * (PDF-only preprints). Transient failures (5xx, timeout, network) bubble as
153
+ * `ServiceUnavailable` after retry so the framework classifies them as retryable.
154
+ *
155
+ * A successful extraction is served from the tenant-scoped `ctx.state` cache on
156
+ * subsequent calls for the same server/DOI/version, so offset paging does not
157
+ * refetch the origin per chunk.
73
158
  */
74
159
  async fetchFullText(server, doi, version, ctx) {
75
160
  const encodedDoi = doi.split('/').map(encodeURIComponent).join('/');
76
161
  const sourceUrl = `${this.webBaseUrls[server]}/content/${encodedDoi}v${version}.full`;
77
162
  const rc = asRc(ctx);
163
+ // ctx.state is tenant-scoped and throws without a tenant (HTTP + JWT whose
164
+ // token carries no `tid` claim), so a tenant-less caller runs uncached rather
165
+ // than losing full-text retrieval entirely.
166
+ const cacheKey = ctx.tenantId === undefined ? undefined : cacheKeyFor(server, doi, version);
167
+ if (cacheKey) {
168
+ const cached = await readCachedArticle(ctx, cacheKey);
169
+ if (cached) {
170
+ ctx.log.debug('Serving full text from cache', { cacheKey, sourceUrl });
171
+ return { kind: 'article', ...cached };
172
+ }
173
+ }
78
174
  let html;
79
175
  try {
80
176
  html = await withRetry(async () => {
81
177
  const response = await fetchWithTimeout(sourceUrl, 30_000, rc, {
82
178
  signal: ctx.signal,
83
179
  headers: { 'User-Agent': this.userAgent, Accept: 'text/html' },
180
+ expectedStatuses: EXPECTED_STATUSES,
84
181
  });
85
182
  return await response.text();
86
183
  }, {
@@ -91,13 +188,34 @@ export class BiorxivFullTextService {
91
188
  });
92
189
  }
93
190
  catch (err) {
94
- // fetchWithTimeout throws on non-2xx with data.statusCode set. Deterministic
95
- // access failures (403 block, 404 missing) become an `unavailable` result;
96
- // transient codes (5xx / timeout / network) bubble unchanged as ServiceUnavailable.
97
- const status = err instanceof McpError &&
98
- typeof err.data?.statusCode === 'number'
99
- ? err.data.statusCode
191
+ // fetchWithTimeout throws on non-2xx with data.status set. Deterministic
192
+ // access failures (403 block, 404 missing) and origin rate limiting (429)
193
+ // become an `unavailable` result; transient codes (5xx / timeout / network)
194
+ // bubble unchanged as ServiceUnavailable.
195
+ const errData = err instanceof McpError
196
+ ? err.data
100
197
  : undefined;
198
+ const status = typeof errData?.status === 'number' ? errData.status : undefined;
199
+ if (status === 429) {
200
+ // Only the parsed Retry-After crosses into the result — err.data also
201
+ // carries the origin's block-page HTML (body/responseBody), which must
202
+ // never reach the client payload.
203
+ const retryAfter = parseRetryAfterSeconds(errData?.retryAfter);
204
+ ctx.log.info('Full-text origin rate-limited the request', {
205
+ sourceUrl,
206
+ status,
207
+ ...(retryAfter !== undefined && { retryAfter }),
208
+ });
209
+ return {
210
+ kind: 'unavailable',
211
+ reason: 'rate_limited',
212
+ detail: retryAfter === undefined
213
+ ? 'The full-text origin is rate-limiting this host (HTTP 429).'
214
+ : `The full-text origin is rate-limiting this host (HTTP 429) and asked for a ${retryAfter}-second wait before the next request.`,
215
+ ...(retryAfter !== undefined && { retryAfter }),
216
+ sourceUrl,
217
+ };
218
+ }
101
219
  if (status !== undefined && DETERMINISTIC_UNAVAILABLE_STATUSES.has(status)) {
102
220
  ctx.log.info('Full-text HTML page unavailable', { sourceUrl, status });
103
221
  return {
@@ -134,13 +252,17 @@ export class BiorxivFullTextService {
134
252
  sourceUrl,
135
253
  };
136
254
  }
137
- return {
138
- kind: 'article',
255
+ const article = {
139
256
  markdown,
140
257
  ...(extracted.title && { title: extracted.title }),
141
258
  ...(typeof extracted.wordCount === 'number' && { wordCount: extracted.wordCount }),
142
259
  sourceUrl,
143
260
  };
261
+ // Success path only — an unavailable result must recover on a later call.
262
+ if (cacheKey) {
263
+ await writeCachedArticle(ctx, cacheKey, article);
264
+ }
265
+ return { kind: 'article', ...article };
144
266
  }
145
267
  }
146
268
  // ─── Init / accessor ─────────────────────────────────────────────────────────
@@ -1 +1 @@
1
- {"version":3,"file":"biorxiv-fulltext-service.js","sourceRoot":"","sources":["../../../src/services/biorxiv-fulltext/biorxiv-fulltext-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,QAAQ,E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,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,IAAI,CAAC,QAAQ;QACX,MAAM,IAAI,KAAK,CACb,uFAAuF,CACxF,CAAC;IACJ,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyanheads/biorxiv-mcp-server",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "mcpName": "io.github.cyanheads/biorxiv-mcp-server",
5
5
  "description": "Search and retrieve bioRxiv and medRxiv preprints — by DOI, date interval, or keyword — via MCP. STDIO or Streamable HTTP.",
6
6
  "type": "module",
package/server.json CHANGED
@@ -6,14 +6,14 @@
6
6
  "url": "https://github.com/cyanheads/biorxiv-mcp-server",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.2.1",
9
+ "version": "0.2.2",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "registryBaseUrl": "https://registry.npmjs.org",
14
14
  "identifier": "@cyanheads/biorxiv-mcp-server",
15
15
  "runtimeHint": "bun",
16
- "version": "0.2.1",
16
+ "version": "0.2.2",
17
17
  "packageArguments": [
18
18
  {
19
19
  "type": "positional",
@@ -31,6 +31,20 @@
31
31
  "format": "string",
32
32
  "isRequired": false
33
33
  },
34
+ {
35
+ "name": "BIORXIV_WEB_BASE_URL",
36
+ "description": "bioRxiv website base URL \u2014 source of rendered full-text HTML pages for biorxiv_get_fulltext.",
37
+ "format": "string",
38
+ "isRequired": false,
39
+ "default": "https://www.biorxiv.org"
40
+ },
41
+ {
42
+ "name": "MEDRXIV_WEB_BASE_URL",
43
+ "description": "medRxiv website base URL \u2014 source of rendered full-text HTML pages for biorxiv_get_fulltext.",
44
+ "format": "string",
45
+ "isRequired": false,
46
+ "default": "https://www.medrxiv.org"
47
+ },
34
48
  {
35
49
  "name": "MCP_LOG_LEVEL",
36
50
  "description": "Sets the minimum log level for output (e.g., 'debug', 'info', 'warn').",
@@ -48,7 +62,7 @@
48
62
  "registryBaseUrl": "https://registry.npmjs.org",
49
63
  "identifier": "@cyanheads/biorxiv-mcp-server",
50
64
  "runtimeHint": "bun",
51
- "version": "0.2.1",
65
+ "version": "0.2.2",
52
66
  "packageArguments": [
53
67
  {
54
68
  "type": "positional",
@@ -66,6 +80,20 @@
66
80
  "format": "string",
67
81
  "isRequired": false
68
82
  },
83
+ {
84
+ "name": "BIORXIV_WEB_BASE_URL",
85
+ "description": "bioRxiv website base URL \u2014 source of rendered full-text HTML pages for biorxiv_get_fulltext.",
86
+ "format": "string",
87
+ "isRequired": false,
88
+ "default": "https://www.biorxiv.org"
89
+ },
90
+ {
91
+ "name": "MEDRXIV_WEB_BASE_URL",
92
+ "description": "medRxiv website base URL \u2014 source of rendered full-text HTML pages for biorxiv_get_fulltext.",
93
+ "format": "string",
94
+ "isRequired": false,
95
+ "default": "https://www.medrxiv.org"
96
+ },
69
97
  {
70
98
  "name": "MCP_HTTP_HOST",
71
99
  "description": "The hostname for the HTTP server.",