@cyanheads/congressgov-mcp-server 0.4.2 → 0.5.0
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 +19 -5
- package/CLAUDE.md +19 -5
- package/README.md +3 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/prompts/definitions/legislative-research.prompt.d.ts +9 -0
- package/dist/mcp-server/prompts/definitions/legislative-research.prompt.d.ts.map +1 -1
- package/dist/mcp-server/prompts/definitions/legislative-research.prompt.js +46 -15
- package/dist/mcp-server/prompts/definitions/legislative-research.prompt.js.map +1 -1
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts +38 -0
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.js +72 -4
- package/dist/mcp-server/tools/definitions/bill-lookup.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts +37 -0
- package/dist/mcp-server/tools/definitions/committee-reports.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/committee-reports.tool.js +66 -7
- package/dist/mcp-server/tools/definitions/committee-reports.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/daily-record.tool.d.ts +41 -3
- package/dist/mcp-server/tools/definitions/daily-record.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/daily-record.tool.js +61 -8
- package/dist/mcp-server/tools/definitions/daily-record.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/enacted-laws.tool.d.ts +1 -1
- package/dist/mcp-server/tools/definitions/enacted-laws.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/enacted-laws.tool.js +7 -5
- package/dist/mcp-server/tools/definitions/enacted-laws.tool.js.map +1 -1
- package/dist/mcp-server/tools/format-helpers.d.ts +16 -0
- package/dist/mcp-server/tools/format-helpers.d.ts.map +1 -1
- package/dist/mcp-server/tools/format-helpers.js +597 -130
- package/dist/mcp-server/tools/format-helpers.js.map +1 -1
- package/dist/mcp-server/tools/tool-helpers.d.ts +88 -0
- package/dist/mcp-server/tools/tool-helpers.d.ts.map +1 -1
- package/dist/mcp-server/tools/tool-helpers.js +133 -0
- package/dist/mcp-server/tools/tool-helpers.js.map +1 -1
- package/dist/services/congress-api/congress-api-service.d.ts +6 -0
- package/dist/services/congress-api/congress-api-service.d.ts.map +1 -1
- package/dist/services/congress-api/congress-api-service.js +41 -6
- package/dist/services/congress-api/congress-api-service.js.map +1 -1
- package/dist/services/congress-documents/congress-documents-service.d.ts +71 -0
- package/dist/services/congress-documents/congress-documents-service.d.ts.map +1 -0
- package/dist/services/congress-documents/congress-documents-service.js +271 -0
- package/dist/services/congress-documents/congress-documents-service.js.map +1 -0
- package/dist/services/congress-documents/document-formats.d.ts +29 -0
- package/dist/services/congress-documents/document-formats.d.ts.map +1 -0
- package/dist/services/congress-documents/document-formats.js +51 -0
- package/dist/services/congress-documents/document-formats.js.map +1 -0
- package/dist/services/congress-documents/extract-text.d.ts +21 -0
- package/dist/services/congress-documents/extract-text.d.ts.map +1 -0
- package/dist/services/congress-documents/extract-text.js +81 -0
- package/dist/services/congress-documents/extract-text.js.map +1 -0
- package/dist/services/congress-documents/types.d.ts +45 -0
- package/dist/services/congress-documents/types.d.ts.map +1 -0
- package/dist/services/congress-documents/types.js +6 -0
- package/dist/services/congress-documents/types.js.map +1 -0
- package/package.json +1 -1
- package/server.json +3 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Resolve a requested document format to its upstream URL.
|
|
3
|
+
* @module services/congress-documents/document-formats
|
|
4
|
+
*/
|
|
5
|
+
import type { DocumentFormat } from './types.js';
|
|
6
|
+
export declare const DOCUMENT_FORMATS: readonly ['text', 'xml'];
|
|
7
|
+
/**
|
|
8
|
+
* Upstream `type` labels for each supported format, in preference order.
|
|
9
|
+
*
|
|
10
|
+
* `Formatted Text` is GPO's `<pre>`-wrapped print output and is the only format
|
|
11
|
+
* present on every document checked — bills back to 1999, committee reports, and
|
|
12
|
+
* Daily Record articles. XML is inconsistent: `United States Legislative Markup`
|
|
13
|
+
* ships on some newer bill versions, the legacy `Formatted XML` on many more, and
|
|
14
|
+
* neither on committee reports or the Daily Record. PDF is not offered.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DOCUMENT_FORMAT_LABELS: Record<DocumentFormat, readonly string[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Pick the URL for `format` from an upstream format list.
|
|
19
|
+
*
|
|
20
|
+
* Labels are tried in preference order, and within one label a non-errata entry
|
|
21
|
+
* wins over an errata reprint — committee reports publish both under the same
|
|
22
|
+
* `Formatted Text` label and the errata is the correction, not the report.
|
|
23
|
+
* Returns `undefined` when the document publishes nothing in this format, which
|
|
24
|
+
* callers surface as the `format_unavailable` contract failure.
|
|
25
|
+
*/
|
|
26
|
+
export declare function selectDocumentUrl(entries: unknown, format: DocumentFormat): string | undefined;
|
|
27
|
+
/** The upstream labels a format resolves to, for error messages that name what was searched. */
|
|
28
|
+
export declare function describeFormat(format: DocumentFormat): string;
|
|
29
|
+
//# sourceMappingURL=document-formats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-formats.d.ts","sourceRoot":"","sources":["../../../src/services/congress-documents/document-formats.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,YAAY,CAAC;AAEpE,eAAO,MAAM,gBAAgB,YAAI,MAAM,EAAE,KAAK,CAAU,CAAC;AAEzD;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAG5E,CAAC;AAUF;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS,CAa9F;AAED,gGAAgG;AAChG,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAE7D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Resolve a requested document format to its upstream URL.
|
|
3
|
+
* @module services/congress-documents/document-formats
|
|
4
|
+
*/
|
|
5
|
+
export const DOCUMENT_FORMATS = ['text', 'xml'];
|
|
6
|
+
/**
|
|
7
|
+
* Upstream `type` labels for each supported format, in preference order.
|
|
8
|
+
*
|
|
9
|
+
* `Formatted Text` is GPO's `<pre>`-wrapped print output and is the only format
|
|
10
|
+
* present on every document checked — bills back to 1999, committee reports, and
|
|
11
|
+
* Daily Record articles. XML is inconsistent: `United States Legislative Markup`
|
|
12
|
+
* ships on some newer bill versions, the legacy `Formatted XML` on many more, and
|
|
13
|
+
* neither on committee reports or the Daily Record. PDF is not offered.
|
|
14
|
+
*/
|
|
15
|
+
export const DOCUMENT_FORMAT_LABELS = {
|
|
16
|
+
text: ['Formatted Text'],
|
|
17
|
+
xml: ['United States Legislative Markup', 'Formatted XML'],
|
|
18
|
+
};
|
|
19
|
+
function refUrl(ref) {
|
|
20
|
+
return typeof ref.url === 'string' && ref.url.trim() !== '' ? ref.url.trim() : undefined;
|
|
21
|
+
}
|
|
22
|
+
function matchesLabel(ref, label) {
|
|
23
|
+
return typeof ref.type === 'string' && ref.type.trim().toLowerCase() === label.toLowerCase();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Pick the URL for `format` from an upstream format list.
|
|
27
|
+
*
|
|
28
|
+
* Labels are tried in preference order, and within one label a non-errata entry
|
|
29
|
+
* wins over an errata reprint — committee reports publish both under the same
|
|
30
|
+
* `Formatted Text` label and the errata is the correction, not the report.
|
|
31
|
+
* Returns `undefined` when the document publishes nothing in this format, which
|
|
32
|
+
* callers surface as the `format_unavailable` contract failure.
|
|
33
|
+
*/
|
|
34
|
+
export function selectDocumentUrl(entries, format) {
|
|
35
|
+
if (!Array.isArray(entries))
|
|
36
|
+
return;
|
|
37
|
+
const refs = entries.filter((entry) => typeof entry === 'object' && entry !== null);
|
|
38
|
+
for (const label of DOCUMENT_FORMAT_LABELS[format]) {
|
|
39
|
+
const matched = refs.filter((ref) => matchesLabel(ref, label) && refUrl(ref) !== undefined);
|
|
40
|
+
const preferred = matched.find((ref) => ref.isErrata !== 'Y') ?? matched[0];
|
|
41
|
+
const url = preferred ? refUrl(preferred) : undefined;
|
|
42
|
+
if (url)
|
|
43
|
+
return url;
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
/** The upstream labels a format resolves to, for error messages that name what was searched. */
|
|
48
|
+
export function describeFormat(format) {
|
|
49
|
+
return DOCUMENT_FORMAT_LABELS[format].join(' / ');
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=document-formats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-formats.js","sourceRoot":"","sources":["../../../src/services/congress-documents/document-formats.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,KAAK,CAAU,CAAC;AAEzD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAA8C;IAC/E,IAAI,EAAE,CAAC,gBAAgB,CAAC;IACxB,GAAG,EAAE,CAAC,kCAAkC,EAAE,eAAe,CAAC;CAC3D,CAAC;AAEF,SAAS,MAAM,CAAC,GAAsB;IACpC,OAAO,OAAO,GAAG,CAAC,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3F,CAAC;AAED,SAAS,YAAY,CAAC,GAAsB,EAAE,KAAa;IACzD,OAAO,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC;AAC/F,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAgB,EAAE,MAAsB;IACxE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO;IACpC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CACzB,CAAC,KAAK,EAA8B,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CACnF,CAAC;IAEF,KAAK,MAAM,KAAK,IAAI,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC;QAC5F,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;QAC5E,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtD,IAAI,GAAG;YAAE,OAAO,GAAG,CAAC;IACtB,CAAC;IACD,OAAO;AACT,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,cAAc,CAAC,MAAsB;IACnD,OAAO,sBAAsB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Turn a Congress.gov document body into the plain text offsets index into.
|
|
3
|
+
* @module services/congress-documents/extract-text
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Extract the readable plain text of a Congress.gov document body.
|
|
7
|
+
*
|
|
8
|
+
* "Formatted Text" is not semantic HTML — it is GPO's monospace print output
|
|
9
|
+
* wrapped in `<pre>`, sometimes inside `<html><body>` and sometimes bare, with
|
|
10
|
+
* the occasional inline anchor and HTML-escaped entities. The pre-formatted
|
|
11
|
+
* layout (column alignment, indentation, blank-line structure) is the document's
|
|
12
|
+
* real structure, so whitespace is preserved verbatim rather than collapsed the
|
|
13
|
+
* way `htmlToMarkdown` collapses narrative prose. XML bodies run through the same
|
|
14
|
+
* pipeline minus the `<pre>` unwrap.
|
|
15
|
+
*
|
|
16
|
+
* The result is the string every character offset indexes into, so it has to be
|
|
17
|
+
* deterministic: line endings are normalized to `\n` before anything else, and
|
|
18
|
+
* the transform is applied once per fetch.
|
|
19
|
+
*/
|
|
20
|
+
export declare function extractDocumentText(body: string): string;
|
|
21
|
+
//# sourceMappingURL=extract-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-text.d.ts","sourceRoot":"","sources":["../../../src/services/congress-documents/extract-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4DH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKxD"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Turn a Congress.gov document body into the plain text offsets index into.
|
|
3
|
+
* @module services/congress-documents/extract-text
|
|
4
|
+
*/
|
|
5
|
+
/** Entities GPO emits by name. Numeric references are decoded generically. */
|
|
6
|
+
const NAMED_ENTITIES = {
|
|
7
|
+
amp: '&',
|
|
8
|
+
apos: "'",
|
|
9
|
+
gt: '>',
|
|
10
|
+
lt: '<',
|
|
11
|
+
nbsp: ' ',
|
|
12
|
+
quot: '"',
|
|
13
|
+
};
|
|
14
|
+
const COMMENT_RE = /<!--[\s\S]*?-->/g;
|
|
15
|
+
const TAG_RE = /<[^>]*>/g;
|
|
16
|
+
const ENTITY_RE = /&(#[xX][0-9a-fA-F]+|#\d+|[a-zA-Z]+);/g;
|
|
17
|
+
/**
|
|
18
|
+
* Decode HTML/XML character references in one pass.
|
|
19
|
+
*
|
|
20
|
+
* A single pass is the point: decoding `&` in its own sweep would turn the
|
|
21
|
+
* literal `&lt;` into `<` instead of the `<` the document actually says.
|
|
22
|
+
* An unrecognized reference is left verbatim rather than guessed at.
|
|
23
|
+
*/
|
|
24
|
+
function decodeEntities(text) {
|
|
25
|
+
return text.replace(ENTITY_RE, (match, ref) => {
|
|
26
|
+
if (ref.startsWith('#')) {
|
|
27
|
+
const hex = ref[1] === 'x' || ref[1] === 'X';
|
|
28
|
+
const codePoint = Number.parseInt(hex ? ref.slice(2) : ref.slice(1), hex ? 16 : 10);
|
|
29
|
+
if (!Number.isInteger(codePoint) || codePoint < 0 || codePoint > 0x10ffff)
|
|
30
|
+
return match;
|
|
31
|
+
return String.fromCodePoint(codePoint);
|
|
32
|
+
}
|
|
33
|
+
return NAMED_ENTITIES[ref.toLowerCase()] ?? match;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The tag name has to end at the `>` or at whitespace. A loose `<\s*pre[^>]*>`
|
|
38
|
+
* also matches USLM's `<preamble>` — which truncated a 2.6 MB bill to its
|
|
39
|
+
* 223-character preamble, and reported that as the document's full length.
|
|
40
|
+
*/
|
|
41
|
+
const PRE_OPEN_RE = /<\s*pre(?:\s[^>]*)?\/?>/i;
|
|
42
|
+
const PRE_CLOSE_RE = /<\s*\/\s*pre\s*>/gi;
|
|
43
|
+
/**
|
|
44
|
+
* The content between the first `<pre>` and the last `</pre>`, or `undefined`
|
|
45
|
+
* when the body carries no `<pre>` block at all (every XML body, and any future
|
|
46
|
+
* shape that is not GPO print output).
|
|
47
|
+
*/
|
|
48
|
+
function unwrapPre(body) {
|
|
49
|
+
const open = PRE_OPEN_RE.exec(body);
|
|
50
|
+
if (!open)
|
|
51
|
+
return;
|
|
52
|
+
const start = open.index + open[0].length;
|
|
53
|
+
let closeAt = -1;
|
|
54
|
+
for (const close of body.matchAll(PRE_CLOSE_RE)) {
|
|
55
|
+
if (close.index > start)
|
|
56
|
+
closeAt = close.index;
|
|
57
|
+
}
|
|
58
|
+
return closeAt > start ? body.slice(start, closeAt) : body.slice(start);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Extract the readable plain text of a Congress.gov document body.
|
|
62
|
+
*
|
|
63
|
+
* "Formatted Text" is not semantic HTML — it is GPO's monospace print output
|
|
64
|
+
* wrapped in `<pre>`, sometimes inside `<html><body>` and sometimes bare, with
|
|
65
|
+
* the occasional inline anchor and HTML-escaped entities. The pre-formatted
|
|
66
|
+
* layout (column alignment, indentation, blank-line structure) is the document's
|
|
67
|
+
* real structure, so whitespace is preserved verbatim rather than collapsed the
|
|
68
|
+
* way `htmlToMarkdown` collapses narrative prose. XML bodies run through the same
|
|
69
|
+
* pipeline minus the `<pre>` unwrap.
|
|
70
|
+
*
|
|
71
|
+
* The result is the string every character offset indexes into, so it has to be
|
|
72
|
+
* deterministic: line endings are normalized to `\n` before anything else, and
|
|
73
|
+
* the transform is applied once per fetch.
|
|
74
|
+
*/
|
|
75
|
+
export function extractDocumentText(body) {
|
|
76
|
+
const normalized = body.replace(/\r\n?/g, '\n');
|
|
77
|
+
const stripped = normalized.replace(COMMENT_RE, '');
|
|
78
|
+
const inner = unwrapPre(stripped) ?? stripped;
|
|
79
|
+
return decodeEntities(inner.replace(TAG_RE, '')).trim();
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=extract-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-text.js","sourceRoot":"","sources":["../../../src/services/congress-documents/extract-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,8EAA8E;AAC9E,MAAM,cAAc,GAA2B;IAC7C,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,GAAG;IACT,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;CACV,CAAC;AAEF,MAAM,UAAU,GAAG,kBAAkB,CAAC;AACtC,MAAM,MAAM,GAAG,UAAU,CAAC;AAC1B,MAAM,SAAS,GAAG,uCAAuC,CAAC;AAE1D;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,GAAW,EAAE,EAAE;QACpD,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;YAC7C,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACpF,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC,IAAI,SAAS,GAAG,QAAQ;gBAAE,OAAO,KAAK,CAAC;YACxF,OAAO,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,KAAK,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,WAAW,GAAG,0BAA0B,CAAC;AAC/C,MAAM,YAAY,GAAG,oBAAoB,CAAC;AAE1C;;;;GAIG;AACH,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,IAAI;QAAE,OAAO;IAClB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAE1C,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC;IACjB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAChD,IAAI,KAAK,CAAC,KAAK,GAAG,KAAK;YAAE,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC;IACjD,CAAC;IACD,OAAO,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC;IAC9C,OAAO,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Domain types for bounded retrieval of Congress.gov document text.
|
|
3
|
+
* @module services/congress-documents/types
|
|
4
|
+
*/
|
|
5
|
+
/** The document formats this server retrieves. PDF is deliberately absent — extraction cost. */
|
|
6
|
+
export type DocumentFormat = 'text' | 'xml';
|
|
7
|
+
/**
|
|
8
|
+
* One entry of an upstream format list. Bill text versions and committee reports
|
|
9
|
+
* carry these under `formats[]`; Daily Congressional Record articles carry the
|
|
10
|
+
* same `{type, url}` pairs under `text[]`. Every field is optional — upstream
|
|
11
|
+
* rows are sparse and untyped at this boundary.
|
|
12
|
+
*/
|
|
13
|
+
export interface DocumentFormatRef {
|
|
14
|
+
isErrata?: unknown;
|
|
15
|
+
type?: unknown;
|
|
16
|
+
url?: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** Parameters for a single bounded document read. */
|
|
19
|
+
export interface FetchDocumentParams {
|
|
20
|
+
/** Maximum characters to return. */
|
|
21
|
+
characterLimit: number;
|
|
22
|
+
/** First character of the document to return, 0-based. */
|
|
23
|
+
characterOffset: number;
|
|
24
|
+
/** Absolute URL resolved from upstream metadata — never caller-supplied. */
|
|
25
|
+
url: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A bounded window onto one document's plain text.
|
|
29
|
+
*
|
|
30
|
+
* `offset` + `text.length` is exactly `nextOffset` when more remains, so feeding
|
|
31
|
+
* `nextOffset` back walks the document with no overlap and no gap.
|
|
32
|
+
*/
|
|
33
|
+
export interface DocumentContent {
|
|
34
|
+
/** Offset to pass next, or null at the end of the document. */
|
|
35
|
+
nextOffset: number | null;
|
|
36
|
+
/** Echo of the requested start offset. */
|
|
37
|
+
offset: number;
|
|
38
|
+
/** The requested character window, verbatim. */
|
|
39
|
+
text: string;
|
|
40
|
+
/** Characters in the whole document, not this window. */
|
|
41
|
+
totalCharacters: number;
|
|
42
|
+
/** True when characters remain past this window. */
|
|
43
|
+
truncated: boolean;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/congress-documents/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,gGAAgG;AAChG,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,qDAAqD;AACrD,MAAM,WAAW,mBAAmB;IAClC,oCAAoC;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,0DAA0D;IAC1D,eAAe,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,+DAA+D;IAC/D,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,eAAe,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,SAAS,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/congress-documents/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyanheads/congressgov-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Access U.S. congressional data - bills, votes, members, committees - through MCP. STDIO & Streamable HTTP.",
|
|
5
5
|
"mcpName": "io.github.cyanheads/congressgov-mcp-server",
|
|
6
6
|
"type": "module",
|
package/server.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/cyanheads/congressgov-mcp-server",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.5.0",
|
|
10
10
|
"remotes": [
|
|
11
11
|
{
|
|
12
12
|
"type": "streamable-http",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
20
20
|
"identifier": "@cyanheads/congressgov-mcp-server",
|
|
21
21
|
"runtimeHint": "bun",
|
|
22
|
-
"version": "0.
|
|
22
|
+
"version": "0.5.0",
|
|
23
23
|
"packageArguments": [
|
|
24
24
|
{
|
|
25
25
|
"type": "positional",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
55
55
|
"identifier": "@cyanheads/congressgov-mcp-server",
|
|
56
56
|
"runtimeHint": "bun",
|
|
57
|
-
"version": "0.
|
|
57
|
+
"version": "0.5.0",
|
|
58
58
|
"packageArguments": [
|
|
59
59
|
{
|
|
60
60
|
"type": "positional",
|