@cliwant/mcp-sam-gov 1.5.0 → 1.7.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.
Files changed (89) hide show
  1. package/LICENSE +21 -21
  2. package/README.ja.md +248 -231
  3. package/README.ko.md +248 -231
  4. package/README.md +733 -714
  5. package/dist/errors.d.ts +10 -0
  6. package/dist/errors.d.ts.map +1 -1
  7. package/dist/errors.js.map +1 -1
  8. package/dist/feedback.d.ts +64 -0
  9. package/dist/feedback.d.ts.map +1 -0
  10. package/dist/feedback.js +131 -0
  11. package/dist/feedback.js.map +1 -0
  12. package/dist/server.d.ts.map +1 -1
  13. package/dist/server.js +48 -2
  14. package/dist/server.js.map +1 -1
  15. package/dist/update-check.d.ts +38 -0
  16. package/dist/update-check.d.ts.map +1 -0
  17. package/dist/update-check.js +85 -0
  18. package/dist/update-check.js.map +1 -0
  19. package/package.json +111 -111
  20. package/src/attachments.ts +652 -652
  21. package/src/bea.ts +372 -372
  22. package/src/bls.ts +1943 -1943
  23. package/src/cache.ts +73 -73
  24. package/src/cbp-border.ts +177 -177
  25. package/src/census-economic.ts +431 -431
  26. package/src/census.ts +735 -735
  27. package/src/ckan.ts +495 -495
  28. package/src/clinicaltrials.ts +923 -923
  29. package/src/cms-facility.ts +379 -379
  30. package/src/cms-hospital.ts +344 -344
  31. package/src/cms-supplier.ts +527 -527
  32. package/src/cms-utilization.ts +389 -389
  33. package/src/cms.ts +634 -634
  34. package/src/coerce.ts +47 -47
  35. package/src/courtlistener.ts +465 -465
  36. package/src/cpsc.ts +333 -333
  37. package/src/datagov-catalog.ts +312 -312
  38. package/src/datagov.ts +907 -907
  39. package/src/datagovKey.ts +68 -68
  40. package/src/datasource.ts +721 -721
  41. package/src/disclosure.ts +61 -61
  42. package/src/dol.ts +515 -515
  43. package/src/ecfr.ts +248 -248
  44. package/src/echo.ts +496 -496
  45. package/src/edgar.ts +3046 -3046
  46. package/src/epa-envirofacts.ts +358 -358
  47. package/src/errors.ts +324 -314
  48. package/src/fac.ts +529 -529
  49. package/src/far.ts +1009 -1009
  50. package/src/fdic.ts +2052 -2052
  51. package/src/federal-register.ts +725 -725
  52. package/src/feedback.ts +160 -0
  53. package/src/fema.ts +680 -680
  54. package/src/fpds.ts +620 -620
  55. package/src/fred.ts +464 -464
  56. package/src/gao.ts +744 -744
  57. package/src/gov-domains.ts +237 -237
  58. package/src/govinfo.ts +497 -497
  59. package/src/grants.ts +290 -290
  60. package/src/gsa-csv.ts +992 -992
  61. package/src/gsa-perdiem.ts +361 -361
  62. package/src/integrity.ts +928 -928
  63. package/src/keys.ts +268 -268
  64. package/src/lda.ts +385 -385
  65. package/src/meta.ts +292 -292
  66. package/src/nhtsa.ts +352 -352
  67. package/src/nih.ts +375 -375
  68. package/src/nist-controls.ts +219 -219
  69. package/src/nonprofit.ts +460 -460
  70. package/src/nppes.ts +834 -834
  71. package/src/nsf.ts +706 -706
  72. package/src/nvd.ts +1124 -1124
  73. package/src/nws-weather.ts +167 -167
  74. package/src/ofac.ts +1166 -1166
  75. package/src/openfda-device.ts +356 -356
  76. package/src/openfda-drugsfda.ts +313 -313
  77. package/src/openfda.ts +518 -518
  78. package/src/pricing.ts +1075 -1075
  79. package/src/sam-gov/client.ts +774 -774
  80. package/src/sam-gov/index.ts +32 -32
  81. package/src/sam-gov/types.ts +152 -152
  82. package/src/sba.ts +357 -357
  83. package/src/server.ts +6692 -6639
  84. package/src/snapshot.ts +223 -223
  85. package/src/socrata.ts +532 -532
  86. package/src/treasury.ts +582 -582
  87. package/src/update-check.ts +88 -0
  88. package/src/usaspending.ts +2852 -2852
  89. package/src/usitc.ts +420 -420
package/src/datagovKey.ts CHANGED
@@ -1,68 +1,68 @@
1
- /**
2
- * datagovKey.ts — the SHARED api.data.gov KEY seam (ADR-0010 §2).
3
- *
4
- * These api.data.gov key helpers were originally module-private in `datagov.ts`
5
- * (ADR-0007, the FIRST keyed source). GovInfo (ADR-0010) is the SECOND consumer
6
- * of the identical DATA_GOV_API_KEY / DEMO_KEY / X-Api-Key discipline, which is
7
- * the trigger to promote the helper to a single audited home — the exact
8
- * `coerce.ts` precedent applied to a SECRET: a leak-discipline regression must now
9
- * fail BOTH consumers' key-never-leaks tests at once, not hide in one of two
10
- * drifting copies. `datagov.ts` AND `govinfo.ts` each import from here; NEITHER
11
- * imports the other.
12
- *
13
- * This extraction is BEHAVIOR BYTE-IDENTICAL to the prior inlined `datagov.ts`
14
- * code — these are pure functions that read `process.env` at CALL time, so moving
15
- * them changes nothing (datagov's key handling, `_meta`, tools/list snapshot, and
16
- * its key-never-leaks K-test all stay green; the K-test spies on the GLOBAL
17
- * `fetch`, which is unaffected by this move).
18
- *
19
- * ★ THE KEY-SECURITY DISCIPLINE (ADR-0007 §2 — the load-bearing rules):
20
- * 1. The key travels in `headers:{ "X-Api-Key": <key> }` ONLY — NEVER in the
21
- * URL/query (no `?api_key=`).
22
- * 2. `_meta.source`/`notes` are host + key-MODE only ("…(DEMO_KEY)" /
23
- * "…(DATA_GOV_API_KEY)") — never the URL, never the key value, never the
24
- * `X-Api-Key` header.
25
- * 3. Never commit the key — read from env only; the DEMO_KEY fallback is a
26
- * literal public constant (safe in source), the real key never is.
27
- */
28
-
29
- // ─── Key resolver (the load-bearing secret discipline) ────────────
30
- // The key is read from env; if unset/empty it falls back to the public literal
31
- // "DEMO_KEY". `keyHeader()` is the ONLY place the value is used — it is placed in
32
- // the `X-Api-Key` request header and NOWHERE else (never the URL, never the label,
33
- // never `_meta`, never a log).
34
- const DEMO_KEY = "DEMO_KEY";
35
-
36
- function resolvedKey(): string {
37
- const raw = process.env.DATA_GOV_API_KEY;
38
- const trimmed = typeof raw === "string" ? raw.trim() : "";
39
- return trimmed ? trimmed : DEMO_KEY;
40
- }
41
-
42
- /** The X-Api-Key header — the ONLY carrier of the secret. Never logged/echoed. */
43
- export function keyHeader(): Record<string, string> {
44
- return { "X-Api-Key": resolvedKey() };
45
- }
46
-
47
- /** true when no real DATA_GOV_API_KEY is configured (drives the disclosure note). */
48
- export function usingDemoKey(): boolean {
49
- const raw = process.env.DATA_GOV_API_KEY;
50
- return !(typeof raw === "string" && raw.trim());
51
- }
52
-
53
- /** Key-MODE label for `_meta.source` — the MODE, never the value. */
54
- export function keyModeLabel(): string {
55
- return usingDemoKey() ? "DEMO_KEY" : "DATA_GOV_API_KEY";
56
- }
57
-
58
- // The DEMO_KEY disclosure (m4-note: NO hardcoded verification date — "approximately
59
- // 10 requests/hour", not a pinned date).
60
- const DEMO_KEY_NOTE =
61
- "Using the shared api.data.gov DEMO_KEY — approximately 10 requests/hour, shared across all DEMO_KEY callers (limits reached quickly). Set DATA_GOV_API_KEY for production; free key at https://api.data.gov/signup/.";
62
- const CONFIGURED_KEY_NOTE =
63
- "Using a configured DATA_GOV_API_KEY (value never logged).";
64
-
65
- /** Push the key-mode disclosure note (DEMO_KEY ceiling OR configured-key). */
66
- export function pushKeyNote(notes: string[]): void {
67
- notes.push(usingDemoKey() ? DEMO_KEY_NOTE : CONFIGURED_KEY_NOTE);
68
- }
1
+ /**
2
+ * datagovKey.ts — the SHARED api.data.gov KEY seam (ADR-0010 §2).
3
+ *
4
+ * These api.data.gov key helpers were originally module-private in `datagov.ts`
5
+ * (ADR-0007, the FIRST keyed source). GovInfo (ADR-0010) is the SECOND consumer
6
+ * of the identical DATA_GOV_API_KEY / DEMO_KEY / X-Api-Key discipline, which is
7
+ * the trigger to promote the helper to a single audited home — the exact
8
+ * `coerce.ts` precedent applied to a SECRET: a leak-discipline regression must now
9
+ * fail BOTH consumers' key-never-leaks tests at once, not hide in one of two
10
+ * drifting copies. `datagov.ts` AND `govinfo.ts` each import from here; NEITHER
11
+ * imports the other.
12
+ *
13
+ * This extraction is BEHAVIOR BYTE-IDENTICAL to the prior inlined `datagov.ts`
14
+ * code — these are pure functions that read `process.env` at CALL time, so moving
15
+ * them changes nothing (datagov's key handling, `_meta`, tools/list snapshot, and
16
+ * its key-never-leaks K-test all stay green; the K-test spies on the GLOBAL
17
+ * `fetch`, which is unaffected by this move).
18
+ *
19
+ * ★ THE KEY-SECURITY DISCIPLINE (ADR-0007 §2 — the load-bearing rules):
20
+ * 1. The key travels in `headers:{ "X-Api-Key": <key> }` ONLY — NEVER in the
21
+ * URL/query (no `?api_key=`).
22
+ * 2. `_meta.source`/`notes` are host + key-MODE only ("…(DEMO_KEY)" /
23
+ * "…(DATA_GOV_API_KEY)") — never the URL, never the key value, never the
24
+ * `X-Api-Key` header.
25
+ * 3. Never commit the key — read from env only; the DEMO_KEY fallback is a
26
+ * literal public constant (safe in source), the real key never is.
27
+ */
28
+
29
+ // ─── Key resolver (the load-bearing secret discipline) ────────────
30
+ // The key is read from env; if unset/empty it falls back to the public literal
31
+ // "DEMO_KEY". `keyHeader()` is the ONLY place the value is used — it is placed in
32
+ // the `X-Api-Key` request header and NOWHERE else (never the URL, never the label,
33
+ // never `_meta`, never a log).
34
+ const DEMO_KEY = "DEMO_KEY";
35
+
36
+ function resolvedKey(): string {
37
+ const raw = process.env.DATA_GOV_API_KEY;
38
+ const trimmed = typeof raw === "string" ? raw.trim() : "";
39
+ return trimmed ? trimmed : DEMO_KEY;
40
+ }
41
+
42
+ /** The X-Api-Key header — the ONLY carrier of the secret. Never logged/echoed. */
43
+ export function keyHeader(): Record<string, string> {
44
+ return { "X-Api-Key": resolvedKey() };
45
+ }
46
+
47
+ /** true when no real DATA_GOV_API_KEY is configured (drives the disclosure note). */
48
+ export function usingDemoKey(): boolean {
49
+ const raw = process.env.DATA_GOV_API_KEY;
50
+ return !(typeof raw === "string" && raw.trim());
51
+ }
52
+
53
+ /** Key-MODE label for `_meta.source` — the MODE, never the value. */
54
+ export function keyModeLabel(): string {
55
+ return usingDemoKey() ? "DEMO_KEY" : "DATA_GOV_API_KEY";
56
+ }
57
+
58
+ // The DEMO_KEY disclosure (m4-note: NO hardcoded verification date — "approximately
59
+ // 10 requests/hour", not a pinned date).
60
+ const DEMO_KEY_NOTE =
61
+ "Using the shared api.data.gov DEMO_KEY — approximately 10 requests/hour, shared across all DEMO_KEY callers (limits reached quickly). Set DATA_GOV_API_KEY for production; free key at https://api.data.gov/signup/.";
62
+ const CONFIGURED_KEY_NOTE =
63
+ "Using a configured DATA_GOV_API_KEY (value never logged).";
64
+
65
+ /** Push the key-mode disclosure note (DEMO_KEY ceiling OR configured-key). */
66
+ export function pushKeyNote(notes: string[]): void {
67
+ notes.push(usingDemoKey() ? DEMO_KEY_NOTE : CONFIGURED_KEY_NOTE);
68
+ }