@cyanheads/congressgov-mcp-server 0.5.0 → 0.5.1

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:** congressgov-mcp-server
4
- **Version:** 0.5.0
4
+ **Version:** 0.5.1
5
5
  **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.5`
6
6
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
7
7
  **MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
@@ -174,11 +174,12 @@ Four services. `CongressApiService` backs nine tools and the House branch of `co
174
174
  - Party totals are derived from the roster (the feed publishes none)
175
175
 
176
176
  **`CongressDocumentsService`** — reads the document bodies behind Congress.gov's format URLs (`www.congress.gov`):
177
- - A second host, so a sibling service rather than a method on `CongressApiService` — no API key, no JSON, documents past a megabyte
177
+ - A second host, so a sibling service rather than a method on `CongressApiService` — no API key, no JSON, and enrolled omnibus bills that run to ten megabytes
178
178
  - URLs are resolved from upstream format metadata and checked against a `www.congress.gov` allowlist; a caller never supplies one
179
- - The fetch is bounded: a 5 MB ceiling (refused on `Content-Length`, else mid-stream), a 30s deadline, and a content-type allowlist
179
+ - The fetch is bounded: a 25 MB ceiling (refused on `Content-Length`, else mid-stream), a 30s deadline, and a content-type allowlist
180
+ - The body is extracted as it streams and only the requested window is retained, so a read's live set is flat in the size of the document (transient allocation is not — peak RSS runs above a buffered read); the ceiling bounds how long a response may run, not how much of one fits in a buffer
180
181
  - The response is bounded by an exact character window — offsets index the extracted plain text and are never snapped to section breaks, so feeding `nextOffset` back walks a document with no overlap and no gap
181
- - `extract-text.ts` unwraps GPO's `<pre>` print output verbatim (whitespace is the document's structure) and decodes entities in one pass
182
+ - `extract-text.ts` unwraps GPO's `<pre>` print output verbatim (whitespace is the document's structure) and decodes entities in one pass; `extract-text-stream.ts` is its incremental twin, pinned byte-for-byte against it by a differential test
182
183
 
183
184
  **`CongressMirrorService`** — local SQLite FTS5 mirror of bill title + CRS summary text, backing `congressgov_search_bills` only:
184
185
  - Opt-in via `CONGRESS_MIRROR_ENABLED` (off by default); built out-of-band via the `mirror:init`/`mirror:refresh` scripts, never on server startup
package/CLAUDE.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Agent Protocol
2
2
 
3
3
  **Server:** congressgov-mcp-server
4
- **Version:** 0.5.0
4
+ **Version:** 0.5.1
5
5
  **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.5`
6
6
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
7
7
  **MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
@@ -174,11 +174,12 @@ Four services. `CongressApiService` backs nine tools and the House branch of `co
174
174
  - Party totals are derived from the roster (the feed publishes none)
175
175
 
176
176
  **`CongressDocumentsService`** — reads the document bodies behind Congress.gov's format URLs (`www.congress.gov`):
177
- - A second host, so a sibling service rather than a method on `CongressApiService` — no API key, no JSON, documents past a megabyte
177
+ - A second host, so a sibling service rather than a method on `CongressApiService` — no API key, no JSON, and enrolled omnibus bills that run to ten megabytes
178
178
  - URLs are resolved from upstream format metadata and checked against a `www.congress.gov` allowlist; a caller never supplies one
179
- - The fetch is bounded: a 5 MB ceiling (refused on `Content-Length`, else mid-stream), a 30s deadline, and a content-type allowlist
179
+ - The fetch is bounded: a 25 MB ceiling (refused on `Content-Length`, else mid-stream), a 30s deadline, and a content-type allowlist
180
+ - The body is extracted as it streams and only the requested window is retained, so a read's live set is flat in the size of the document (transient allocation is not — peak RSS runs above a buffered read); the ceiling bounds how long a response may run, not how much of one fits in a buffer
180
181
  - The response is bounded by an exact character window — offsets index the extracted plain text and are never snapped to section breaks, so feeding `nextOffset` back walks a document with no overlap and no gap
181
- - `extract-text.ts` unwraps GPO's `<pre>` print output verbatim (whitespace is the document's structure) and decodes entities in one pass
182
+ - `extract-text.ts` unwraps GPO's `<pre>` print output verbatim (whitespace is the document's structure) and decodes entities in one pass; `extract-text-stream.ts` is its incremental twin, pinned byte-for-byte against it by a differential test
182
183
 
183
184
  **`CongressMirrorService`** — local SQLite FTS5 mirror of bill title + CRS summary text, backing `congressgov_search_bills` only:
184
185
  - Opt-in via `CONGRESS_MIRROR_ENABLED` (off by default); built out-of-band via the `mirror:init`/`mirror:refresh` scripts, never on server startup
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.5.0-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/congressgov-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/congressgov-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/congressgov-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.14-blueviolet.svg?style=flat-square)](https://bun.sh/)
10
+ [![Version](https://img.shields.io/badge/Version-0.5.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/congressgov-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/congressgov-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/congressgov-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.14-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
11
 
12
12
  </div>
13
13
 
@@ -98,7 +98,7 @@ export declare const billLookupTool: import("@cyanheads/mcp-ts-core").ToolDefini
98
98
  readonly reason: 'document_too_large';
99
99
  readonly retryable: false;
100
100
  readonly when: 'The document is larger than the byte ceiling this server retrieves, so no character window can be served from it.';
101
- readonly recovery: "Request the other 'format' for this document, which is usually far smaller, or read it directly at the sourceUrl the text operation returns.";
101
+ readonly recovery: 'Read the document at the sourceUrl the text operation returns. A document this size clears the ceiling in every format it publishes, so switching format reaches the same limit.';
102
102
  }, {
103
103
  readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
104
104
  readonly reason: 'offset_past_end';
@@ -78,7 +78,7 @@ export declare const committeeReportsTool: import("@cyanheads/mcp-ts-core").Tool
78
78
  readonly reason: 'document_too_large';
79
79
  readonly retryable: false;
80
80
  readonly when: 'The document is larger than the byte ceiling this server retrieves, so no character window can be served from it.';
81
- readonly recovery: "Request the other 'format' for this document, which is usually far smaller, or read it directly at the sourceUrl the text operation returns.";
81
+ readonly recovery: 'Read the document at the sourceUrl the text operation returns. A document this size clears the ceiling in every format it publishes, so switching format reaches the same limit.';
82
82
  }, {
83
83
  readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
84
84
  readonly reason: 'offset_past_end';
@@ -74,7 +74,7 @@ export declare const dailyRecordTool: import("@cyanheads/mcp-ts-core").ToolDefin
74
74
  readonly reason: 'document_too_large';
75
75
  readonly retryable: false;
76
76
  readonly when: 'The document is larger than the byte ceiling this server retrieves, so no character window can be served from it.';
77
- readonly recovery: "Request the other 'format' for this document, which is usually far smaller, or read it directly at the sourceUrl the text operation returns.";
77
+ readonly recovery: 'Read the document at the sourceUrl the text operation returns. A document this size clears the ceiling in every format it publishes, so switching format reaches the same limit.';
78
78
  }, {
79
79
  readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.InvalidParams;
80
80
  readonly reason: 'offset_past_end';
@@ -195,7 +195,7 @@ export declare const documentErrorContracts: readonly [{
195
195
  readonly reason: 'document_too_large';
196
196
  readonly retryable: false;
197
197
  readonly when: 'The document is larger than the byte ceiling this server retrieves, so no character window can be served from it.';
198
- readonly recovery: "Request the other 'format' for this document, which is usually far smaller, or read it directly at the sourceUrl the text operation returns.";
198
+ readonly recovery: 'Read the document at the sourceUrl the text operation returns. A document this size clears the ceiling in every format it publishes, so switching format reaches the same limit.';
199
199
  }, {
200
200
  readonly code: JsonRpcErrorCode.InvalidParams;
201
201
  readonly reason: 'offset_past_end';
@@ -1 +1 @@
1
- {"version":3,"file":"tool-helpers.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/tool-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAEL,gBAAgB,EAEjB,MAAM,+BAA+B,CAAC;AAqCvC,8DAA8D;AAC9D,eAAO,MAAM,UAAU;;;;;;iBAKP,CAAC;AAEjB;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;;;;;;kBASnE;AAQD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,mDAapD;AAED,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAEjE;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBA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Qf,cAAc;CASf,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB;;qBAGvB,sBAAsB;;mBAExB,qOAAqO;uBAEzO,0JAA0J;;;qBAIpJ,oBAAoB;;mBAEtB,kLAAkL;uBAEtL,wKAAwK;;;qBAIlK,uBAAuB;;mBAEzB,sJAAsJ;uBAE1J,kJAAkJ;;;qBAI5I,oBAAoB;;mBAEtB,mHAAmH;uBAEvH,kLAAkL;;;qBAI5K,iBAAiB;;mBAEnB,mGAAmG;uBAEvG,0HAA0H;EAEnF,CAAC;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB;;qBAGvB,WAAW;;mBAEb,kGAAkG;uBAEtG,yGAAyG;;;qBAInG,cAAc;;mBAEhB,6EAA6E;uBAEjF,kGAAkG;;;qBAI5F,iBAAiB;;mBAEnB,8GAA8G;uBAElH,8HAA8H;;;qBAIxH,gBAAgB;;mBAElB,4EAA4E;uBAEhF,0GAA0G;EAEnE,CAAC"}
@@ -336,7 +336,7 @@ export const documentErrorContracts = [
336
336
  reason: 'document_too_large',
337
337
  retryable: false,
338
338
  when: 'The document is larger than the byte ceiling this server retrieves, so no character window can be served from it.',
339
- recovery: "Request the other 'format' for this document, which is usually far smaller, or read it directly at the sourceUrl the text operation returns.",
339
+ recovery: 'Read the document at the sourceUrl the text operation returns. A document this size clears the ceiling in every format it publishes, so switching format reaches the same limit.',
340
340
  },
341
341
  {
342
342
  code: JsonRpcErrorCode.InvalidParams,
@@ -1 +1 @@
1
- {"version":3,"file":"tool-helpers.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/tool-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAEL,gBAAgB,EAChB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAErF;;;;;GAKG;AACH,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AA0H;KAC7H;CAC0C,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC;QACE,IAAI,EAAE,gBAAgB,CAAC,QAAQ;QAC/B,MAAM,EAAE,WAAW;QACnB,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,kGAAkG;QACxG,QAAQ,EACN,yGAAyG;KAC5G;IACD;QACE,IAAI,EAAE,gBAAgB,CAAC,WAAW;QAClC,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,6EAA6E;QACnF,QAAQ,EACN,kGAAkG;KACrG;IACD;QACE,IAAI,EAAE,gBAAgB,CAAC,aAAa;QACpC,MAAM,EAAE,iBAAiB;QACzB,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,8GAA8G;QACpH,QAAQ,EACN,8HAA8H;KACjI;IACD;QACE,IAAI,EAAE,gBAAgB,CAAC,kBAAkB;QACzC,MAAM,EAAE,gBAAgB;QACxB,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,4EAA4E;QAClF,QAAQ,EACN,0GAA0G;KAC7G;CAC0C,CAAC"}
1
+ {"version":3,"file":"tool-helpers.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/tool-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAEL,gBAAgB,EAChB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAErF;;;;;GAKG;AACH,MAAM,eAAe,GAAG,CAAC;KACtB,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IACtF,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,EAAE;SACL,WAAW,EAAE;SACb,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C5G;IACD;QACE,IAAI,EAAE,gBAAgB,CAAC,WAAW;QAClC,MAAM,EAAE,cAAc;QACtB,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,6EAA6E;QACnF,QAAQ,EACN,kGAAkG;KACrG;IACD;QACE,IAAI,EAAE,gBAAgB,CAAC,aAAa;QACpC,MAAM,EAAE,iBAAiB;QACzB,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,8GAA8G;QACpH,QAAQ,EACN,8HAA8H;KACjI;IACD;QACE,IAAI,EAAE,gBAAgB,CAAC,kBAAkB;QACzC,MAAM,EAAE,gBAAgB;QACxB,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,4EAA4E;QAClF,QAAQ,EACN,0GAA0G;KAC7G;CAC0C,CAAC"}
@@ -9,9 +9,10 @@
9
9
  *
10
10
  * Two bounds, deliberately separate:
11
11
  * - **The fetch** is bounded by {@link MAX_DOCUMENT_BYTES}, a request timeout, and
12
- * a content-type allowlist. An oversized document is refused — before the body
13
- * is read when Content-Length says so, mid-stream when it does not — rather
14
- * than silently truncated or pulled whole into memory.
12
+ * a content-type allowlist. The body is extracted as it streams and only the
13
+ * requested window is kept, so what a read *retains* is flat in the size of
14
+ * the document and the ceiling bounds how long a response may run rather than
15
+ * how much of one fits in a buffer.
15
16
  * - **The response** is bounded by an exact character offset/limit window. Offsets
16
17
  * index into the extracted plain text and are never snapped to section or
17
18
  * paragraph breaks, so feeding `nextOffset` back walks a document with every
@@ -22,12 +23,14 @@
22
23
  import type { Context } from '@cyanheads/mcp-ts-core';
23
24
  import type { DocumentContent, FetchDocumentParams } from './types.js';
24
25
  /**
25
- * Ceiling on a single document. The largest body observed across bills,
26
- * committee reports, and the Daily Record is the 119th Congress H.R. 1 USLM XML
27
- * at ~2.7 MB (its Formatted Text is ~1.0 MB), so this clears real documents with
28
- * room to spare while still refusing a pathological one.
26
+ * Ceiling on a single document. The largest bodies Congress.gov publishes are
27
+ * the omnibus appropriations acts — 116th Congress H.R. 133 enrolled runs
28
+ * 6,790,482 bytes as Formatted Text and 9,812,888 as XML — and both formats of a
29
+ * document have to clear it, since a caller sent to the other one by a recovery
30
+ * hint would hit the same refusal. This clears the largest by better than a
31
+ * factor of two; the request deadline is what a runaway response meets first.
29
32
  */
30
- export declare const MAX_DOCUMENT_BYTES = 5000000;
33
+ export declare const MAX_DOCUMENT_BYTES = 25000000;
31
34
  /** Bounds the whole exchange, headers and body — a megabyte-scale body needs the room. */
32
35
  export declare const REQUEST_TIMEOUT_MS = 30000;
33
36
  export declare class CongressDocumentsService {
@@ -42,8 +45,8 @@ export declare class CongressDocumentsService {
42
45
  * general-purpose fetcher.
43
46
  */
44
47
  fetchDocument(params: FetchDocumentParams, ctx: Context): Promise<DocumentContent>;
45
- /** Slice the exact `[offset, offset + limit)` window and describe what remains. */
46
- private window;
48
+ /** Describe the extracted `[offset, offset + limit)` window and what remains. */
49
+ private describeWindow;
47
50
  private assertAllowedHost;
48
51
  private doFetch;
49
52
  /**
@@ -56,11 +59,22 @@ export declare class CongressDocumentsService {
56
59
  /** Refuse an oversized document on its advertised length, before reading a byte of it. */
57
60
  private assertAdvertisedSize;
58
61
  /**
59
- * Read the body under a hard byte budget, cancelling the stream the moment it
60
- * is exceeded. Chunks are decoded once at the end so a multi-byte character
61
- * split across a chunk boundary still decodes correctly.
62
+ * Extract the requested character window as the body streams, under a hard
63
+ * byte budget that cancels the stream the moment it is exceeded.
64
+ *
65
+ * Nothing but the window is retained: the decoder carries a partial character
66
+ * across a chunk boundary and the extractor carries its parse state, so the
67
+ * live set stays near the window's own size however large the document is.
68
+ * Transient allocation still scales with the body — peak RSS is higher than a
69
+ * buffered read of the same document — but it is garbage, not live, so it is
70
+ * concurrent reads rather than one large read that the ceiling has to survive.
71
+ */
72
+ private readWindow;
73
+ /**
74
+ * A body that dies partway through is the transport failing, not a malformed
75
+ * document — the same classification a connection that never opened gets.
62
76
  */
63
- private readBounded;
77
+ private readChunk;
64
78
  private tooLarge;
65
79
  private isRetryableError;
66
80
  private getRequestContext;
@@ -1 +1 @@
1
- {"version":3,"file":"congress-documents-service.d.ts","sourceRoot":"","sources":["../../../src/services/congress-documents/congress-documents-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAUtD,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,UAAY,CAAC;AAE5C,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,QAAS,CAAC;AA4CzC,qBAAa,wBAAwB;IACvB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAA7C,YAA6B,gBAAgB,GAAE,MAA2B,EAAI;IAE9E;;;;;;;OAOG;IACG,aAAa,CAAC,MAAM,EAAE,mBAAmB,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAkBvF;IAED,mFAAmF;IACnF,OAAO,CAAC,MAAM;IA8Bd,OAAO,CAAC,iBAAiB;YAoBX,OAAO;IAsBrB;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAqB1B,OAAO,CAAC,iBAAiB;IAgBzB,0FAA0F;IAC1F,OAAO,CAAC,oBAAoB;IAQ5B;;;;OAIG;YACW,WAAW;IAoCzB,OAAO,CAAC,QAAQ;IAahB,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,cAAc;CAIvB;AAID,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,wBAAgB,oBAAoB,IAAI,wBAAwB,CAO/D"}
1
+ {"version":3,"file":"congress-documents-service.d.ts","sourceRoot":"","sources":["../../../src/services/congress-documents/congress-documents-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAUtD,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEvE;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,WAAa,CAAC;AAE7C,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,QAAS,CAAC;AA4CzC,qBAAa,wBAAwB;IACvB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAA7C,YAA6B,gBAAgB,GAAE,MAA2B,EAAI;IAE9E;;;;;;;OAOG;IACG,aAAa,CAAC,MAAM,EAAE,mBAAmB,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAiBvF;IAED,iFAAiF;IACjF,OAAO,CAAC,cAAc;IAiCtB,OAAO,CAAC,iBAAiB;YAoBX,OAAO;IAsBrB;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAqB1B,OAAO,CAAC,iBAAiB;IAgBzB,0FAA0F;IAC1F,OAAO,CAAC,oBAAoB;IAQ5B;;;;;;;;;;OAUG;YACW,UAAU;IAuCxB;;;OAGG;YACW,SAAS;IAevB,OAAO,CAAC,QAAQ;IAahB,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,cAAc;CAIvB;AAID,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,wBAAgB,oBAAoB,IAAI,wBAAwB,CAO/D"}
@@ -9,9 +9,10 @@
9
9
  *
10
10
  * Two bounds, deliberately separate:
11
11
  * - **The fetch** is bounded by {@link MAX_DOCUMENT_BYTES}, a request timeout, and
12
- * a content-type allowlist. An oversized document is refused — before the body
13
- * is read when Content-Length says so, mid-stream when it does not — rather
14
- * than silently truncated or pulled whole into memory.
12
+ * a content-type allowlist. The body is extracted as it streams and only the
13
+ * requested window is kept, so what a read *retains* is flat in the size of
14
+ * the document and the ceiling bounds how long a response may run rather than
15
+ * how much of one fits in a buffer.
15
16
  * - **The response** is bounded by an exact character offset/limit window. Offsets
16
17
  * index into the extracted plain text and are never snapped to section or
17
18
  * paragraph breaks, so feeding `nextOffset` back walks a document with every
@@ -21,14 +22,16 @@
21
22
  */
22
23
  import { invalidParams, JsonRpcErrorCode, McpError, notFound, serviceUnavailable, } from '@cyanheads/mcp-ts-core/errors';
23
24
  import { fetchWithTimeout, withRetry } from '@cyanheads/mcp-ts-core/utils';
24
- import { extractDocumentText } from './extract-text.js';
25
+ import { createStreamingExtractor } from './extract-text-stream.js';
25
26
  /**
26
- * Ceiling on a single document. The largest body observed across bills,
27
- * committee reports, and the Daily Record is the 119th Congress H.R. 1 USLM XML
28
- * at ~2.7 MB (its Formatted Text is ~1.0 MB), so this clears real documents with
29
- * room to spare while still refusing a pathological one.
27
+ * Ceiling on a single document. The largest bodies Congress.gov publishes are
28
+ * the omnibus appropriations acts — 116th Congress H.R. 133 enrolled runs
29
+ * 6,790,482 bytes as Formatted Text and 9,812,888 as XML — and both formats of a
30
+ * document have to clear it, since a caller sent to the other one by a recovery
31
+ * hint would hit the same refusal. This clears the largest by better than a
32
+ * factor of two; the request deadline is what a runaway response meets first.
30
33
  */
31
- export const MAX_DOCUMENT_BYTES = 5_000_000;
34
+ export const MAX_DOCUMENT_BYTES = 25_000_000;
32
35
  /** Bounds the whole exchange, headers and body — a megabyte-scale body needs the room. */
33
36
  export const REQUEST_TIMEOUT_MS = 30_000;
34
37
  const MAX_ATTEMPTS = 3;
@@ -79,7 +82,7 @@ export class CongressDocumentsService {
79
82
  const operation = 'CongressDocumentsService GET document';
80
83
  const requestContext = this.getRequestContext(ctx, operation);
81
84
  const signal = this.getAbortSignal(ctx);
82
- const body = await withRetry(() => this.doFetch(params.url, requestContext, ctx, signal), {
85
+ const window = await withRetry(() => this.doFetch(params, requestContext, ctx, signal), {
83
86
  operation,
84
87
  context: requestContext,
85
88
  baseDelayMs: BASE_BACKOFF_MS,
@@ -87,12 +90,11 @@ export class CongressDocumentsService {
87
90
  isTransient: (error) => this.isRetryableError(error),
88
91
  ...(signal ? { signal } : {}),
89
92
  });
90
- const text = extractDocumentText(body);
91
- return this.window(text, params, ctx);
93
+ return this.describeWindow(window, params, ctx);
92
94
  }
93
- /** Slice the exact `[offset, offset + limit)` window and describe what remains. */
94
- window(text, params, ctx) {
95
- const totalCharacters = text.length;
95
+ /** Describe the extracted `[offset, offset + limit)` window and what remains. */
96
+ describeWindow(window, params, ctx) {
97
+ const { text, totalCharacters } = window;
96
98
  const offset = params.characterOffset;
97
99
  /** An empty document is a real (if unusual) answer at offset 0 — not a bad offset. */
98
100
  if (totalCharacters > 0 && offset >= totalCharacters) {
@@ -104,11 +106,10 @@ export class CongressDocumentsService {
104
106
  retryable: false,
105
107
  });
106
108
  }
107
- const slice = text.slice(offset, offset + params.characterLimit);
108
- const end = offset + slice.length;
109
+ const end = offset + text.length;
109
110
  const truncated = end < totalCharacters;
110
111
  return {
111
- text: slice,
112
+ text,
112
113
  totalCharacters,
113
114
  offset,
114
115
  truncated,
@@ -133,10 +134,10 @@ export class CongressDocumentsService {
133
134
  });
134
135
  }
135
136
  }
136
- async doFetch(url, requestContext, ctx, signal) {
137
+ async doFetch(params, requestContext, ctx, signal) {
137
138
  let response;
138
139
  try {
139
- response = await fetchWithTimeout(url, REQUEST_TIMEOUT_MS, requestContext, {
140
+ response = await fetchWithTimeout(params.url, REQUEST_TIMEOUT_MS, requestContext, {
140
141
  headers: { Accept: 'text/html, application/xml, text/plain, */*' },
141
142
  expectedStatuses: [404],
142
143
  ...(signal ? { signal } : {}),
@@ -147,7 +148,7 @@ export class CongressDocumentsService {
147
148
  }
148
149
  this.assertContentType(response, ctx);
149
150
  this.assertAdvertisedSize(response, ctx);
150
- return this.readBounded(response, ctx);
151
+ return this.readWindow(response, params, ctx);
151
152
  }
152
153
  /**
153
154
  * A 404 means Congress.gov's metadata named a document its own file host does
@@ -191,17 +192,27 @@ export class CongressDocumentsService {
191
192
  throw this.tooLarge(ctx, { contentLength });
192
193
  }
193
194
  /**
194
- * Read the body under a hard byte budget, cancelling the stream the moment it
195
- * is exceeded. Chunks are decoded once at the end so a multi-byte character
196
- * split across a chunk boundary still decodes correctly.
195
+ * Extract the requested character window as the body streams, under a hard
196
+ * byte budget that cancels the stream the moment it is exceeded.
197
+ *
198
+ * Nothing but the window is retained: the decoder carries a partial character
199
+ * across a chunk boundary and the extractor carries its parse state, so the
200
+ * live set stays near the window's own size however large the document is.
201
+ * Transient allocation still scales with the body — peak RSS is higher than a
202
+ * buffered read of the same document — but it is garbage, not live, so it is
203
+ * concurrent reads rather than one large read that the ceiling has to survive.
197
204
  */
198
- async readBounded(response, ctx) {
205
+ async readWindow(response, params, ctx) {
199
206
  const reader = response.body?.getReader();
200
- const chunks = [];
207
+ const decoder = new TextDecoder('utf-8');
208
+ const extractor = createStreamingExtractor({
209
+ characterLimit: params.characterLimit,
210
+ characterOffset: params.characterOffset,
211
+ });
201
212
  let bytes = 0;
202
213
  if (reader) {
203
214
  for (;;) {
204
- const { done, value } = await reader.read();
215
+ const { done, value } = await this.readChunk(reader, ctx);
205
216
  if (done)
206
217
  break;
207
218
  if (!value)
@@ -211,7 +222,7 @@ export class CongressDocumentsService {
211
222
  await reader.cancel().catch(() => undefined);
212
223
  throw this.tooLarge(ctx, { bytesRead: bytes });
213
224
  }
214
- chunks.push(value);
225
+ extractor.push(decoder.decode(value, { stream: true }));
215
226
  }
216
227
  }
217
228
  if (bytes === 0) {
@@ -221,13 +232,20 @@ export class CongressDocumentsService {
221
232
  retryable: false,
222
233
  });
223
234
  }
224
- const merged = new Uint8Array(bytes);
225
- let at = 0;
226
- for (const chunk of chunks) {
227
- merged.set(chunk, at);
228
- at += chunk.byteLength;
235
+ extractor.push(decoder.decode());
236
+ return extractor.finish();
237
+ }
238
+ /**
239
+ * A body that dies partway through is the transport failing, not a malformed
240
+ * document — the same classification a connection that never opened gets.
241
+ */
242
+ async readChunk(reader, ctx) {
243
+ try {
244
+ return await reader.read();
245
+ }
246
+ catch (error) {
247
+ throw serviceUnavailable('The document body from Congress.gov ended before it was complete.', { reason: DOCUMENT_FETCH_FAILED, ...ctx.recoveryFor(DOCUMENT_FETCH_FAILED) }, { cause: error });
229
248
  }
230
- return new TextDecoder('utf-8').decode(merged);
231
249
  }
232
250
  tooLarge(ctx, data) {
233
251
  return invalidParams(`This document exceeds the ${this.maxDocumentBytes.toLocaleString('en-US')}-byte ceiling this server retrieves.`, {
@@ -1 +1 @@
1
- {"version":3,"file":"congress-documents-service.js","sourceRoot":"","sources":["../../../src/services/congress-documents/congress-documents-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAE5C,0FAA0F;AAC1F,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,iFAAiF;AACjF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAEpD,sFAAsF;AACtF,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;AAElG;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AACpD,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AACtD,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAChD,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAQ1C,SAAS,mBAAmB,CAAC,KAAc;IACzC,IACE,OAAO,WAA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,GACb,OAAO,SAAS,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC3F,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IAC7C,CAAC;IAEO,cAAc,CAAC,GAAY;QACjC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1B,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,CAAC;CACF;AAED,IAAI,QAA8C,CAAC;AAEnD,MAAM,UAAU,qBAAqB;IACnC,QAAQ,GAAG,IAAI,wBAAwB,EAAE,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"congress-documents-service.js","sourceRoot":"","sources":["../../../src/services/congress-documents/congress-documents-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAwB,MAAM,0BAA0B,CAAC;AAG1F;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAE7C,0FAA0F;AAC1F,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5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UAAU,oBAAoB;IAClC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @fileoverview Incremental form of {@link extractDocumentText} — consumes a
3
+ * document body chunk by chunk and retains only the requested character window.
4
+ *
5
+ * `extract-text.ts` is the normative definition of the extraction: every
6
+ * character offset in the `content` contract indexes into the string it
7
+ * produces. This module reproduces that string exactly while holding constant
8
+ * memory, so a document is bounded by how long it takes to stream rather than by
9
+ * how much of it fits in a buffer. The two are pinned against each other by a
10
+ * differential test — if this file drifts, that test fails, not production.
11
+ *
12
+ * The whole-string pipeline is `normalize newlines → strip comments → unwrap
13
+ * <pre> → strip tags → decode entities → trim`, and three of those stages are
14
+ * decided by content that arrives arbitrarily late:
15
+ *
16
+ * - **Is there a `<pre>` at all?** Only a body with none is read whole. Both
17
+ * readings run at once, in two sinks; the losing one is dropped the moment a
18
+ * `<pre>` open tag settles the question.
19
+ * - **Where is the last `</pre>`?** Every close is a candidate, so each one
20
+ * records a mark on the `<pre>` sink and the last mark standing is restored at
21
+ * end of stream.
22
+ * - **Does this `<!--` (or this `<`) ever close?** An unterminated one is not a
23
+ * comment or a tag at all — the regexes leave it in the text. Its content is
24
+ * therefore written through as literal text and rolled back if the closing
25
+ * delimiter turns up.
26
+ *
27
+ * Every one of those rewinds is a mark: a handful of counters plus a length to
28
+ * truncate the captured window to. Nothing rewindable grows with the document.
29
+ *
30
+ * @module services/congress-documents/extract-text-stream
31
+ */
32
+ /** The character window to retain while streaming. */
33
+ export interface TextWindowRequest {
34
+ /** Maximum characters to keep, counted from `characterOffset`. */
35
+ characterLimit: number;
36
+ /** First character of the extracted text to keep, 0-based. */
37
+ characterOffset: number;
38
+ }
39
+ /** The retained window plus the length of the whole extracted text. */
40
+ export interface ExtractedWindow {
41
+ /** The requested window of the extracted text. */
42
+ text: string;
43
+ /** Characters in the whole extracted document, not this window. */
44
+ totalCharacters: number;
45
+ }
46
+ /** Consumes a document body in chunks and yields one character window. */
47
+ export interface StreamingExtractor {
48
+ /** Finish the document and return its window. Call once, after the last push. */
49
+ finish(): ExtractedWindow;
50
+ /** Feed the next decoded chunk of the body. */
51
+ push(chunk: string): void;
52
+ }
53
+ /**
54
+ * Create an extractor that reproduces {@link extractDocumentText} over a chunked
55
+ * body while retaining only `characterLimit` characters of it.
56
+ */
57
+ export declare function createStreamingExtractor(request: TextWindowRequest): StreamingExtractor;
58
+ //# sourceMappingURL=extract-text-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-text-stream.d.ts","sourceRoot":"","sources":["../../../src/services/congress-documents/extract-text-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAIH,sDAAsD;AACtD,MAAM,WAAW,iBAAiB;IAChC,kEAAkE;IAClE,cAAc,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,uEAAuE;AACvE,MAAM,WAAW,eAAe;IAC9B,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,0EAA0E;AAC1E,MAAM,WAAW,kBAAkB;IACjC,iFAAiF;IACjF,MAAM,IAAI,eAAe,CAAC;IAC1B,+CAA+C;IAC/C,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAuqBD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,kBAAkB,CAEvF"}