@cliwant/mcp-sam-gov 0.3.0 → 1.0.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 (228) hide show
  1. package/LICENSE +21 -21
  2. package/README.ja.md +48 -16
  3. package/README.ko.md +48 -16
  4. package/README.md +226 -64
  5. package/dist/attachments.d.ts +63 -0
  6. package/dist/attachments.d.ts.map +1 -0
  7. package/dist/attachments.js +576 -0
  8. package/dist/attachments.js.map +1 -0
  9. package/dist/bls.d.ts +267 -0
  10. package/dist/bls.d.ts.map +1 -0
  11. package/dist/bls.js +1549 -0
  12. package/dist/bls.js.map +1 -0
  13. package/dist/cache.d.ts +2 -0
  14. package/dist/cache.d.ts.map +1 -1
  15. package/dist/cache.js +4 -0
  16. package/dist/cache.js.map +1 -1
  17. package/dist/census.d.ts +182 -0
  18. package/dist/census.d.ts.map +1 -0
  19. package/dist/census.js +576 -0
  20. package/dist/census.js.map +1 -0
  21. package/dist/ckan.d.ts +141 -0
  22. package/dist/ckan.d.ts.map +1 -0
  23. package/dist/ckan.js +393 -0
  24. package/dist/ckan.js.map +1 -0
  25. package/dist/clinicaltrials.d.ts +180 -0
  26. package/dist/clinicaltrials.d.ts.map +1 -0
  27. package/dist/clinicaltrials.js +730 -0
  28. package/dist/clinicaltrials.js.map +1 -0
  29. package/dist/cms.d.ts +140 -0
  30. package/dist/cms.d.ts.map +1 -0
  31. package/dist/cms.js +482 -0
  32. package/dist/cms.js.map +1 -0
  33. package/dist/coerce.d.ts +32 -0
  34. package/dist/coerce.d.ts.map +1 -0
  35. package/dist/coerce.js +50 -0
  36. package/dist/coerce.js.map +1 -0
  37. package/dist/datagov-catalog.d.ts +84 -0
  38. package/dist/datagov-catalog.d.ts.map +1 -0
  39. package/dist/datagov-catalog.js +233 -0
  40. package/dist/datagov-catalog.js.map +1 -0
  41. package/dist/datagov.d.ts +146 -0
  42. package/dist/datagov.d.ts.map +1 -0
  43. package/dist/datagov.js +689 -0
  44. package/dist/datagov.js.map +1 -0
  45. package/dist/datagovKey.d.ts +36 -0
  46. package/dist/datagovKey.d.ts.map +1 -0
  47. package/dist/datagovKey.js +60 -0
  48. package/dist/datagovKey.js.map +1 -0
  49. package/dist/datasource.d.ts +313 -0
  50. package/dist/datasource.d.ts.map +1 -0
  51. package/dist/datasource.js +551 -0
  52. package/dist/datasource.js.map +1 -0
  53. package/dist/disclosure.d.ts +55 -0
  54. package/dist/disclosure.d.ts.map +1 -0
  55. package/dist/disclosure.js +57 -0
  56. package/dist/disclosure.js.map +1 -0
  57. package/dist/ecfr.d.ts +4 -2
  58. package/dist/ecfr.d.ts.map +1 -1
  59. package/dist/ecfr.js +74 -1
  60. package/dist/ecfr.js.map +1 -1
  61. package/dist/echo.d.ts +143 -0
  62. package/dist/echo.d.ts.map +1 -0
  63. package/dist/echo.js +424 -0
  64. package/dist/echo.js.map +1 -0
  65. package/dist/edgar.d.ts +377 -0
  66. package/dist/edgar.d.ts.map +1 -0
  67. package/dist/edgar.js +2418 -0
  68. package/dist/edgar.js.map +1 -0
  69. package/dist/errors.d.ts +26 -0
  70. package/dist/errors.d.ts.map +1 -1
  71. package/dist/errors.js +69 -1
  72. package/dist/errors.js.map +1 -1
  73. package/dist/fac.d.ts +180 -0
  74. package/dist/fac.d.ts.map +1 -0
  75. package/dist/fac.js +416 -0
  76. package/dist/fac.js.map +1 -0
  77. package/dist/far.d.ts +170 -0
  78. package/dist/far.d.ts.map +1 -0
  79. package/dist/far.js +804 -0
  80. package/dist/far.js.map +1 -0
  81. package/dist/fdic.d.ts +599 -0
  82. package/dist/fdic.d.ts.map +1 -0
  83. package/dist/fdic.js +1624 -0
  84. package/dist/fdic.js.map +1 -0
  85. package/dist/federal-register.d.ts +139 -2
  86. package/dist/federal-register.d.ts.map +1 -1
  87. package/dist/federal-register.js +419 -3
  88. package/dist/federal-register.js.map +1 -1
  89. package/dist/fema.d.ts +181 -0
  90. package/dist/fema.d.ts.map +1 -0
  91. package/dist/fema.js +436 -0
  92. package/dist/fema.js.map +1 -0
  93. package/dist/fpds.d.ts +108 -0
  94. package/dist/fpds.d.ts.map +1 -0
  95. package/dist/fpds.js +519 -0
  96. package/dist/fpds.js.map +1 -0
  97. package/dist/gao.d.ts +64 -0
  98. package/dist/gao.d.ts.map +1 -0
  99. package/dist/gao.js +640 -0
  100. package/dist/gao.js.map +1 -0
  101. package/dist/govinfo.d.ts +111 -0
  102. package/dist/govinfo.d.ts.map +1 -0
  103. package/dist/govinfo.js +422 -0
  104. package/dist/govinfo.js.map +1 -0
  105. package/dist/grants.d.ts +27 -4
  106. package/dist/grants.d.ts.map +1 -1
  107. package/dist/grants.js +111 -6
  108. package/dist/grants.js.map +1 -1
  109. package/dist/gsa-csv.d.ts +249 -0
  110. package/dist/gsa-csv.d.ts.map +1 -0
  111. package/dist/gsa-csv.js +784 -0
  112. package/dist/gsa-csv.js.map +1 -0
  113. package/dist/integrity.d.ts +212 -0
  114. package/dist/integrity.d.ts.map +1 -0
  115. package/dist/integrity.js +707 -0
  116. package/dist/integrity.js.map +1 -0
  117. package/dist/meta.d.ts +165 -0
  118. package/dist/meta.d.ts.map +1 -0
  119. package/dist/meta.js +162 -0
  120. package/dist/meta.js.map +1 -0
  121. package/dist/nih.d.ts +117 -0
  122. package/dist/nih.d.ts.map +1 -0
  123. package/dist/nih.js +291 -0
  124. package/dist/nih.js.map +1 -0
  125. package/dist/nppes.d.ts +157 -0
  126. package/dist/nppes.d.ts.map +1 -0
  127. package/dist/nppes.js +648 -0
  128. package/dist/nppes.js.map +1 -0
  129. package/dist/nsf.d.ts +176 -0
  130. package/dist/nsf.d.ts.map +1 -0
  131. package/dist/nsf.js +554 -0
  132. package/dist/nsf.js.map +1 -0
  133. package/dist/nvd.d.ts +176 -0
  134. package/dist/nvd.d.ts.map +1 -0
  135. package/dist/nvd.js +912 -0
  136. package/dist/nvd.js.map +1 -0
  137. package/dist/ofac.d.ts +205 -0
  138. package/dist/ofac.d.ts.map +1 -0
  139. package/dist/ofac.js +919 -0
  140. package/dist/ofac.js.map +1 -0
  141. package/dist/pricing.d.ts +110 -0
  142. package/dist/pricing.d.ts.map +1 -0
  143. package/dist/pricing.js +843 -0
  144. package/dist/pricing.js.map +1 -0
  145. package/dist/sam-gov/client.d.ts +60 -2
  146. package/dist/sam-gov/client.d.ts.map +1 -1
  147. package/dist/sam-gov/client.js +320 -54
  148. package/dist/sam-gov/client.js.map +1 -1
  149. package/dist/sam-gov/index.d.ts +1 -1
  150. package/dist/sam-gov/index.d.ts.map +1 -1
  151. package/dist/sam-gov/index.js +1 -1
  152. package/dist/sam-gov/index.js.map +1 -1
  153. package/dist/sam-gov/types.d.ts +24 -0
  154. package/dist/sam-gov/types.d.ts.map +1 -1
  155. package/dist/sba.d.ts +72 -0
  156. package/dist/sba.d.ts.map +1 -0
  157. package/dist/sba.js +281 -0
  158. package/dist/sba.js.map +1 -0
  159. package/dist/server.d.ts +14 -2
  160. package/dist/server.d.ts.map +1 -1
  161. package/dist/server.js +3889 -296
  162. package/dist/server.js.map +1 -1
  163. package/dist/snapshot.d.ts +98 -0
  164. package/dist/snapshot.d.ts.map +1 -0
  165. package/dist/snapshot.js +146 -0
  166. package/dist/snapshot.js.map +1 -0
  167. package/dist/socrata.d.ts +157 -0
  168. package/dist/socrata.d.ts.map +1 -0
  169. package/dist/socrata.js +448 -0
  170. package/dist/socrata.js.map +1 -0
  171. package/dist/treasury.d.ts +143 -0
  172. package/dist/treasury.d.ts.map +1 -0
  173. package/dist/treasury.js +436 -0
  174. package/dist/treasury.js.map +1 -0
  175. package/dist/usaspending.d.ts +260 -65
  176. package/dist/usaspending.d.ts.map +1 -1
  177. package/dist/usaspending.js +1629 -201
  178. package/dist/usaspending.js.map +1 -1
  179. package/dist/usitc.d.ts +142 -0
  180. package/dist/usitc.d.ts.map +1 -0
  181. package/dist/usitc.js +339 -0
  182. package/dist/usitc.js.map +1 -0
  183. package/package.json +24 -2
  184. package/src/attachments.ts +652 -0
  185. package/src/bls.ts +1943 -0
  186. package/src/cache.ts +5 -0
  187. package/src/census.ts +735 -0
  188. package/src/ckan.ts +495 -0
  189. package/src/clinicaltrials.ts +923 -0
  190. package/src/cms.ts +634 -0
  191. package/src/coerce.ts +47 -0
  192. package/src/datagov-catalog.ts +296 -0
  193. package/src/datagov.ts +907 -0
  194. package/src/datagovKey.ts +68 -0
  195. package/src/datasource.ts +721 -0
  196. package/src/disclosure.ts +61 -0
  197. package/src/ecfr.ts +98 -1
  198. package/src/echo.ts +496 -0
  199. package/src/edgar.ts +3014 -0
  200. package/src/errors.ts +84 -1
  201. package/src/fac.ts +529 -0
  202. package/src/far.ts +1007 -0
  203. package/src/fdic.ts +2052 -0
  204. package/src/federal-register.ts +512 -3
  205. package/src/fema.ts +541 -0
  206. package/src/fpds.ts +620 -0
  207. package/src/gao.ts +744 -0
  208. package/src/govinfo.ts +497 -0
  209. package/src/grants.ts +139 -7
  210. package/src/gsa-csv.ts +992 -0
  211. package/src/integrity.ts +928 -0
  212. package/src/meta.ts +292 -0
  213. package/src/nih.ts +375 -0
  214. package/src/nppes.ts +834 -0
  215. package/src/nsf.ts +706 -0
  216. package/src/nvd.ts +1124 -0
  217. package/src/ofac.ts +1166 -0
  218. package/src/pricing.ts +1075 -0
  219. package/src/sam-gov/client.ts +345 -63
  220. package/src/sam-gov/index.ts +5 -1
  221. package/src/sam-gov/types.ts +22 -0
  222. package/src/sba.ts +357 -0
  223. package/src/server.ts +4551 -328
  224. package/src/snapshot.ts +192 -0
  225. package/src/socrata.ts +532 -0
  226. package/src/treasury.ts +575 -0
  227. package/src/usaspending.ts +1946 -214
  228. package/src/usitc.ts +420 -0
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ### **$4 trillion of public federal data, one `npm install` away.**
6
6
 
7
- The most comprehensive **keyless** MCP server for US federal contracting + spending + regulation. **36 tools** that work today, in any AI agent.
7
+ The most comprehensive **keyless** MCP server for US federal contracting + spending + regulation + partner vetting. **111 tools across 31 keyless federal data sources** that work today, in any AI agent.
8
8
 
9
9
  [![npm](https://img.shields.io/npm/v/@cliwant/mcp-sam-gov?color=cb3837&label=%40cliwant%2Fmcp-sam-gov&logo=npm)](https://www.npmjs.com/package/@cliwant/mcp-sam-gov)
10
10
  [![mcp-registry](https://img.shields.io/badge/MCP%20Registry-active-2ea44f?logo=anthropic)](https://registry.modelcontextprotocol.io/v0/servers?search=cliwant)
@@ -50,7 +50,7 @@ The most comprehensive **keyless** MCP server for US federal contracting + spend
50
50
  |---|---|
51
51
  | GovWin: $30K-$100K/yr per seat | Free, MIT license |
52
52
  | API key registration → wait 24h → quota tier shopping | `npm install` → working in 60s |
53
- | 5 separate vendor APIs / scrapers | 1 unified surface, 36 tools |
53
+ | 5+ separate vendor APIs / scrapers | 1 unified surface, 111 tools across 31 sources |
54
54
  | LLMs hallucinate NAICS codes / agency names | Anti-hallucination autocomplete guards built-in |
55
55
  | Brittle scraping breaks weekly | Daily live smoke test ([badge above](#)) |
56
56
  | Procurement officer → IT ticket → 3-week wait | Claude Desktop double-click install |
@@ -61,19 +61,20 @@ The federal data this wraps is **public domain**. There is no good reason it sho
61
61
 
62
62
  ## What this gives Claude (and other AI agents)
63
63
 
64
- | Domain | What you can ask | Tools |
64
+ | Domain | What you can ask | Sources |
65
65
  |---|---|---|
66
- | 🔍 **Active opportunities** | "Find SAM.gov solicitations under NAICS 541512 closing this month" | 5 SAM.gov tools |
67
- | 💰 **Awards & recipients** | "Show me Booz Allen wins at VA last fiscal year" | 8 USAspending tools |
68
- | 📊 **Aggregate analysis** | "Top 10 PSC categories at DoD by spending FY26" | 6 USAspending tools |
69
- | 🏛 **Agency profiles** | "What's VA's mission? FY25 budget breakdown?" | 3 USAspending tools |
70
- | 🏢 **Recipient profiles** | "Pull Booz Allen's full recipient profile + alternate names" | 2 USAspending tools |
71
- | 🧠 **Anti-hallucination** | NAICS / recipient / agency autocomplete + glossary | 5 USAspending tools |
72
- | 📜 **Federal Register** | "What VA cybersecurity rules were published this quarter?" | 3 tools |
73
- | ⚖️ **Regulations (FAR/CFR)** | "Find FAR sections about SDVOSB set-aside" | 2 eCFR tools |
74
- | 🎓 **Federal grants** | "Cybersecurity grants posted in the last 30 days" | 2 Grants.gov tools |
75
-
76
- **36 tools total. Zero API keys. p50 latency 257ms, p95 766ms** (live benchmarks against federal APIs).
66
+ | 🔍 **Opportunities & solicitations** | "Find SAM.gov solicitations under NAICS 541512 closing this month" — read the SOW, POCs, attachments | SAM.gov, Grants.gov |
67
+ | 💰 **Spending, awards & competition** | "Show me Booz Allen wins at VA last fiscal year; top 10 PSC categories at DoD" | USAspending, FPDS, GAO |
68
+ | 🕵️ **Entity & partner vetting** | "Screen this firm: OFAC sanctions, SAM exclusions, single-audit findings, bank health, EPA compliance" | OFAC, SAM, FAC, FDIC, EPA ECHO |
69
+ | 📈 **Financial disclosure (SEC)** | "Pull this public company's revenue trend and latest 10-K filings" | SEC EDGAR |
70
+ | ⚖️ **Regulatory & legislative** | "What VA cybersecurity rules were published this quarter? Any open Regulations.gov dockets?" | Federal Register, Regulations.gov, eCFR, FAR/DFARS, Congress.gov, GovInfo |
71
+ | 💲 **Pricing, labor & fiscal** | "GSA CALC labor-rate band for a systems analyst; SCA wage determination for this county; CPI escalation" | GSA CALC, SAM WDs, BLS, US Treasury |
72
+ | 🏥 **Health & research funding** | "NIH/NSF grants on this topic; recruiting clinical trials; industry payments to this physician" | NIH RePORTER, NSF, ClinicalTrials.gov, CMS Open Payments, NPPES |
73
+ | 🛡 **Cyber compliance** | "Is this CVE on the CISA KEV must-patch list?" | NVD, CISA KEV |
74
+ | 🌐 **Trade, geo & disaster** | "HTS tariff for this product; Census tract for this address; FEMA declarations in this state" | USITC HTS, US Census, FEMA, Socrata, CKAN |
75
+ | 🎓 **Grants & datasets** | "Cybersecurity grants posted in the last 30 days; discover federal open datasets" | Grants.gov, data.gov |
76
+
77
+ **111 tools across 31 keyless federal data sources. Zero API keys.** (An earlier 52-tool build measured roughly p50 ~0.25s / p95 ~0.8s against production federal APIs; latency varies by source and upstream load — treat it as fast, not a benchmarked guarantee.)
77
78
 
78
79
  ---
79
80
 
@@ -100,7 +101,7 @@ If you already use Claude Code (the CLI):
100
101
  /plugin install cliwant/mcp-sam-gov
101
102
  ```
102
103
 
103
- This installs the MCP server **plus** a [SKILL.md](./skills/sam-gov/SKILL.md) workflow guide that teaches Claude when + how to use each of the 36 tools.
104
+ This installs the MCP server **plus** a [SKILL.md](./skills/sam-gov/SKILL.md) workflow guide that teaches Claude when + how to use each of the 111 tools.
104
105
 
105
106
  ### 🔵 Path 3 — Manual install for any MCP host (Codex, Cursor, Continue, Gemini)
106
107
 
@@ -168,7 +169,7 @@ Then point your host config at the absolute path:
168
169
 
169
170
  (Or skip this entirely — use Path 1's `.mcpb` and it auto-configures.)
170
171
 
171
- Restart Claude Desktop fully (system tray quit on Windows / Quit menu on macOS), then look for the 🔨 icon. You should see "sam-gov (36 tools)".
172
+ Restart Claude Desktop fully (system tray quit on Windows / Quit menu on macOS), then look for the 🔨 icon. You should see "sam-gov (111 tools)".
172
173
 
173
174
  ### Claude Code
174
175
 
@@ -263,11 +264,42 @@ Once installed, you can ask in natural language. The agent picks the right tool
263
264
  - "VA 541512 contracts expiring in next 12 months over $1M"
264
265
  - "Pull period of performance for award CONT_AWD_..."
265
266
 
266
- ### Regulatory
267
+ ### Regulatory & legislative
267
268
  - "Find FAR sections about SDVOSB set-aside requirements"
269
+ - "Turn this RFP's cited FAR/DFARS clause list into a Section L/M compliance matrix"
268
270
  - "What new VA cybersecurity rules were published this quarter?"
271
+ - "Any Federal Register documents on the public-inspection desk from DoD today?"
272
+ - "Search Regulations.gov dockets on 'contractor cybersecurity' and pull the public comments"
273
+ - "Discover federal open datasets about 'wildfire' on data.gov"
269
274
  - "Is there a Federal Register doc number 2026-08333? Pull the citation."
270
275
 
276
+ ### Partner & entity vetting
277
+ - "Screen 'Acme Defense LLC' against the OFAC sanctions list and SAM exclusions"
278
+ - "Look up NPI 1234567890 in NPPES — is this provider active?"
279
+ - "Does this subcontractor have adverse Single Audit findings in the Federal Audit Clearinghouse?"
280
+ - "How healthy is the bank on cert #3510 — risk ratios and quarterly financials?"
281
+ - "Pull this public company's revenue trend and latest 10-K from SEC EDGAR"
282
+ - "Any EPA compliance/enforcement flags for this facility?"
283
+
284
+ ### Compliance & eligibility
285
+ - "What's the SBA small-business size standard for NAICS 541512?"
286
+ - "Search the eCFR for the exact text of a rule"
287
+ - "What's the US import duty rate (HTS) for lithium-ion batteries?"
288
+
289
+ ### Pricing, labor & fiscal
290
+ - "GSA CALC ceiling-rate band for a senior systems analyst"
291
+ - "Find the SCA wage determination for Baltimore County, MD and give me the fringe rates"
292
+ - "How much has CPI-U risen over the last 3 years for an escalation clause?"
293
+ - "What's the current total US public debt (Debt to the Penny)?"
294
+
295
+ ### Cyber
296
+ - "Is CVE-2021-44228 (Log4Shell) on the CISA KEV must-patch list, and what's the due date?"
297
+
298
+ ### Health & research funding
299
+ - "NIH RePORTER projects on mRNA vaccines funded last year"
300
+ - "Recruiting clinical trials for diabetes sponsored by industry"
301
+ - "Industry payments to physicians in CA from the CMS Open Payments Research dataset"
302
+
271
303
  ### Grants
272
304
  - "Cybersecurity grants posted in the last 30 days"
273
305
  - "Pull grant id 361238"
@@ -291,93 +323,223 @@ The MCP server runs **keyless** by default. For higher SAM.gov rate limits + the
291
323
 
292
324
  Get a free key at [sam.gov/SAM/pages/public/searchKeyData.jsf](https://sam.gov/SAM/pages/public/searchKeyData.jsf). The agent doesn't need to know — the key path is transparent.
293
325
 
326
+ ### `DATA_GOV_API_KEY` — the api.data.gov / api.gsa.gov family
327
+
328
+ A handful of sources ride the shared **api.data.gov** gateway — Congress.gov, GovInfo, Regulations.gov, FAC, NPPES, and the data.gov v4 dataset catalog. They work **keyless** out of the box via the public `DEMO_KEY` (a low shared hourly quota). Set `DATA_GOV_API_KEY` to raise those limits substantially:
329
+
330
+ ```json
331
+ {
332
+ "mcpServers": {
333
+ "sam-gov": {
334
+ "command": "mcp-sam-gov",
335
+ "env": { "DATA_GOV_API_KEY": "your-key-here" }
336
+ }
337
+ }
338
+ }
339
+ ```
340
+
341
+ Get one free (instant, no wait) at [api.data.gov/signup](https://api.data.gov/signup). The same key is accepted across all api.data.gov / api.gsa.gov sources. Like the SAM key, it is sent only on the wire (never logged); unset simply means `DEMO_KEY`. BLS sources similarly accept an optional free `BLS_API_KEY` to lift their daily quota.
342
+
294
343
  ---
295
344
 
296
- ## Tool catalog (36 tools)
345
+ ## Tool catalog (111 tools)
346
+
347
+ Grouped by workflow. Every tool is keyless by default; a handful gain higher limits from an optional free key (noted above). Descriptions are condensed — each tool's own `inputSchema` carries the full contract and honesty caveats.
297
348
 
298
349
  <details>
299
- <summary><b>SAM.gov — opportunities + attachments (5 tools)</b></summary>
350
+ <summary><b>Opportunities & solicitations — SAM.gov + Grants.gov (10 tools)</b></summary>
300
351
 
301
- - `sam_search_opportunities` — keyless HAL search (~47K active)
352
+ - `sam_search_opportunities` — keyless HAL search of active SAM.gov contracting opportunities
353
+ - `sam_search_shaping` — pre-solicitation radar (Sources Sought / Presol / Special Notices before the RFP exists)
302
354
  - `sam_get_opportunity` — full detail by 32-char hex noticeId (POCs + attachments + body)
303
355
  - `sam_fetch_description` — full RFP body as plain text
304
- - `sam_attachment_url` — public download URL for resourceId
305
- - `sam_lookup_organization` — federal-organization id fullParentPathName
356
+ - `sam_fetch_attachment_text` — extract attachment text (RFP / SOW / Q&A / wage tables) from PDF + DOCX + text/HTML
357
+ - `sam_attachment_url` — build the public download URL for an attachment resourceId
358
+ - `sam_lookup_organization` — federal-organization id → canonical fullParentPathName
359
+ - `sam_lookup_notice_fields` — batch-fill nulled naics/set-aside/PoP/deadline for 1–100 noticeIds from the opt-in GSA daily CSV
360
+ - `grants_search` — Grants.gov federal grant opportunities (financial assistance, distinct from SAM contracts)
361
+ - `grants_get_opportunity` — full detail for a single grant opportunity by id
306
362
  </details>
307
363
 
308
364
  <details>
309
- <summary><b>USAspendingawards + recipients (8 tools)</b></summary>
310
-
311
- - `usas_search_awards` — share-of-wallet at agency × NAICS
312
- - `usas_search_individual_awards` — line items (returns generatedInternalId)
313
- - `usas_search_subagency_spending` — buyer-office breakdown
314
- - `usas_lookup_agency` — abbreviation canonical name
315
- - `usas_search_awards_by_recipient` — recipient win history
316
- - `usas_search_subawards` — supply-chain / teaming
317
- - `usas_search_expiring_contracts` — recompete radar
318
- - `usas_get_award_detail` — period of performance, options, set-aside, competition
365
+ <summary><b>Spending, awards & competition USAspending + FPDS + GAO (29 tools)</b></summary>
366
+
367
+ - `usas_search_awards` — aggregate share-of-wallet at agency × NAICS
368
+ - `usas_search_individual_awards` — line-item federal contracts (returns generatedInternalId)
369
+ - `usas_get_award_detail` — full award detail: period of performance, options, set-aside, competition
370
+ - `usas_search_awards_by_recipient` — every contract a recipient won in an agency × NAICS slice
371
+ - `usas_search_subawards` — enumerate subcontracts on prime awards (supply chain / teaming)
372
+ - `usas_search_recompetes` — recompete radar (PoP ending in a window, soonest-first, no silent drops)
373
+ - `usas_search_expiring_contracts` — **deprecated** alias of `usas_search_recompetes` (legacy shape)
374
+ - `usas_analyze_incumbent` — per-award incumbent + public recompete-pressure hints (labels, not a score)
375
+ - `usas_search_teaming_partners` — small-business teaming discovery by cert × NAICS × agency, exclusion-screened
376
+ - `usas_spending_over_time` — contract-spending time series (fiscal_year / quarter / month)
377
+ - `usas_search_agency_spending` — spending broken down by awarding agency
378
+ - `usas_search_subagency_spending` — break a parent agency down by sub-agency / office
379
+ - `usas_search_psc_spending` — spending by Product Service Code (PSC)
380
+ - `usas_search_cfda_spending` — spending by CFDA grant-program code
381
+ - `usas_search_state_spending` — spending by state / territory
382
+ - `usas_search_federal_account_spending` — spending by federal account / Treasury Account Symbol (TAS)
383
+ - `usas_search_recipients` — recipient list with parent/child hierarchy
384
+ - `usas_get_recipient_profile` — full recipient detail (UEI, alternate names, totals)
385
+ - `usas_get_agency_profile` — agency profile by toptier code (mission, abbreviation, website)
386
+ - `usas_get_agency_awards_summary` — award activity for a fiscal year (transaction count + obligations)
387
+ - `usas_get_agency_budget_function` — budget-function breakdown for an agency × fiscal year
388
+ - `usas_list_toptier_agencies` — all toptier agencies + current-FY obligations
389
+ - `usas_lookup_agency` — resolve 'VA' / 'DHS' → canonical toptier name + 4-digit code
390
+ - `usas_autocomplete_naics` — anti-hallucination NAICS guard
391
+ - `usas_autocomplete_recipient` — anti-hallucination recipient guard
392
+ - `usas_naics_hierarchy` — navigate the NAICS tree (2→4→6) + active-contract count per code
393
+ - `usas_glossary` — 151 federal-spending terms
394
+ - `fpds_search_awards` — FPDS-NG federal contract award actions (the authoritative award-action feed)
395
+ - `gao_protest_lookup` — recent GAO bid-protest decisions from the public Legal-Products RSS feed (recent window only)
319
396
  </details>
320
397
 
321
398
  <details>
322
- <summary><b>USAspendingaggregate analysis (6 tools)</b></summary>
323
-
324
- - `usas_spending_over_time` — fiscal_year / quarter / month time series
325
- - `usas_search_psc_spending` — PSC market structure
326
- - `usas_search_state_spending` — geographic distribution
327
- - `usas_search_cfda_spending` — grant programs
328
- - `usas_search_federal_account_spending` — Treasury Account Symbols (TAS)
329
- - `usas_search_agency_spending` — top buying agencies for NAICS / set-aside
399
+ <summary><b>Entity & partner vetting OFAC · SAM · FAC · FDIC · EPA (14 tools)</b></summary>
400
+
401
+ - `ofac_screen_entity` — keyless OFAC denied-party / sanctions screening
402
+ - `sam_check_exclusions` — keyless SAM debarment/exclusion screening by name and/or UEI/CAGE
403
+ - `sam_integrity_lookup` — one-call integrity screen (exclusion verdict + honest FAPIIS pointer)
404
+ - `fac_search_audits` — Single Audit summaries from the Federal Audit Clearinghouse
405
+ - `fac_get_findings` — drill into the audit-RISK findings for an entity
406
+ - `fdic_search_institutions` — search the FDIC-insured-institution directory
407
+ - `fdic_institution_financials` — quarterly financial time-series for one institution (by cert #)
408
+ - `fdic_risk_ratios` — counterparty risk ratios for one institution
409
+ - `fdic_institution_history` — structural-change event log (mergers, charter changes)
410
+ - `fdic_branch_deposits` — branch-deposit footprint
411
+ - `fdic_bank_failures` — historical bank failures & assistance transactions
412
+ - `fdic_industry_summary` — industry & state banking-sector annual aggregates
413
+ - `echo_search_facilities` — search EPA-regulated facilities by state with compliance/enforcement screening
414
+ - `echo_facility_report` — EPA ECHO Detailed Facility Report for one facility (by FRS RegistryID)
330
415
  </details>
331
416
 
332
417
  <details>
333
- <summary><b>USAspendingagency profile (3 tools)</b></summary>
418
+ <summary><b>Financial disclosure SEC EDGAR (8 tools)</b></summary>
419
+
420
+ - `edgar_lookup_cik` — resolve a company ticker or name to its 10-digit SEC CIK
421
+ - `edgar_company_filings` — a company's SEC filings
422
+ - `edgar_company_facts` — curated XBRL financial facts for a filer
423
+ - `edgar_company_concept` — one filer × one XBRL concept × the complete reported time-series
424
+ - `edgar_xbrl_frames` — cross-filer XBRL cross-section (one concept across all filers for a period)
425
+ - `edgar_full_text_search` — full-text search across EDGAR filings, 2001–present
426
+ - `edgar_filing_index` — bulk cross-filer filing index for a quarter
427
+ - `edgar_daily_filing_index` — per-day cross-filer filing index
428
+ </details>
334
429
 
335
- - `usas_get_agency_profile` — mission, abbreviation, website
336
- - `usas_get_agency_awards_summary`transaction count + obligations
337
- - `usas_get_agency_budget_function` — budget breakdown by program area
430
+ <details>
431
+ <summary><b>Regulatory & legislative Federal Register · Regulations.gov · eCFR · FAR · Congress · GovInfo (18 tools)</b></summary>
432
+
433
+ - `fed_register_search_documents` — search Federal Register documents by query / agency / type / date
434
+ - `fed_register_get_document` — full detail for a document by number (citation, body URL, CFR refs)
435
+ - `fed_register_public_inspection` — the Federal Register public-inspection desk (pre-publication)
436
+ - `fed_register_list_agencies` — Federal Register agency slugs reference
437
+ - `regulations_search_dockets` — search Regulations.gov rulemaking dockets
438
+ - `regulations_search_documents` — search Regulations.gov rulemaking documents (rules, proposed rules, notices)
439
+ - `regulations_search_comments` — search public comments on rulemakings
440
+ - `regulations_get_docket` — fetch one Regulations.gov docket by id
441
+ - `ecfr_search` — full-text search across the entire CFR (titleNumber=48 for FAR)
442
+ - `ecfr_list_titles` — all 50 CFR titles + last-amended dates
443
+ - `far_clause_lookup` — authoritative FAR/DFARS clause text + its prescription (exact clause number)
444
+ - `far_search` — FAR/DFARS-scoped search (excludes GSAM, collapses to current in-force version)
445
+ - `far_compliance_matrix` — cited-clause list → proposal-ready Section L/M compliance matrix (eligibility gates flagged)
446
+ - `congress_search_bills` — search Congress.gov bills / legislation
447
+ - `congress_get_bill` — one bill by congress / type / number
448
+ - `govinfo_search_packages` — search GovInfo (GPO-authoritative) packages in a collection
449
+ - `govinfo_get_package` — one GovInfo package summary + download links (txt/xml/pdf/mods)
450
+ - `govinfo_list_collections` — the GovInfo collection catalog
338
451
  </details>
339
452
 
340
453
  <details>
341
- <summary><b>USAspendingrecipient profile (2 tools)</b></summary>
454
+ <summary><b>Pricing, labor & fiscal GSA CALC · SAM WDs · BLS · US Treasury (10 tools)</b></summary>
455
+
456
+ - `gsa_benchmark_labor_rates` — GSA CALC awarded ceiling-rate market band for a labor category (a distribution, not one price)
457
+ - `sam_search_wage_determinations` — find SCA / Davis-Bacon wage determinations for a locality
458
+ - `sam_get_wage_rates` — prevailing-wage + fringe / H&W rate table parsed from a WD, plus the EO minimum-wage floor
459
+ - `bls_timeseries` — BLS time series (CPI-U / ECI escalation, PPI, employment) — the pricing/escalation layer
460
+ - `bls_oews_wages` — benchmark occupational wages & employment (BLS OEWS) by area × occupation
461
+ - `bls_qcew` — county × NAICS market size / wages / location quotient (competition density)
462
+ - `treasury_debt_to_penny` — daily total US public debt outstanding (Treasury Fiscal Data)
463
+ - `treasury_avg_interest_rates` — average interest rate the Treasury pays by security type
464
+ - `treasury_monthly_statement` — Monthly Treasury Statement: receipts, outlays, deficit/surplus by month
465
+ - `treasury_query_dataset` — escape-hatch query over 5 confirmed Treasury Fiscal Data datasets
466
+ </details>
342
467
 
343
- - `usas_search_recipients` — list with parent/child hierarchy
344
- - `usas_get_recipient_profile`full detail (DUNS, UEI, alternate names, totals)
468
+ <details>
469
+ <summary><b>Health & research funding NIH · NSF · ClinicalTrials · CMS · NPPES (9 tools)</b></summary>
470
+
471
+ - `nih_reporter_search_projects` — awarded NIH RePORTER research-grant projects
472
+ - `nsf_search_awards` — awarded NSF research-grant awards
473
+ - `nsf_get_award` — one NSF award by its numeric award id
474
+ - `clinicaltrials_search_studies` — federally-registered clinical studies with sponsor/funder enrichment
475
+ - `clinicaltrials_get_study` — one clinical study by NCT id (incl. brief summary)
476
+ - `clinicaltrials_facet_counts` — exact per-value study-count distribution over the whole registry
477
+ - `cms_search_datasets` — discover CMS Open Payments (Sunshine Act) datasets
478
+ - `cms_query_dataset` — query a CMS Open Payments datastore distribution (industry→physician payments)
479
+ - `nppes_lookup_provider` — CMS/HHS NPPES NPI Registry provider lookup
345
480
  </details>
346
481
 
347
482
  <details>
348
- <summary><b>USAspendingreference / autocomplete (5 tools)</b></summary>
483
+ <summary><b>Cyber compliance NVD + CISA KEV (2 tools)</b></summary>
349
484
 
350
- - `usas_autocomplete_naics` — anti-hallucination NAICS guard
351
- - `usas_autocomplete_recipient` — anti-hallucination recipient guard
352
- - `usas_naics_hierarchy` — navigate NAICS tree
353
- - `usas_glossary` — 151 federal-spending terms
354
- - `usas_list_toptier_agencies` — list all toptier agencies + obligations
485
+ - `cve_lookup` — look up NIST NVD CVE records
486
+ - `cisa_kev_lookup` — filter the CISA Known Exploited Vulnerabilities catalog (binding BOD 22-01 remediation due-dates)
355
487
  </details>
356
488
 
357
489
  <details>
358
- <summary><b>Federal Registerrules + notices (3 tools)</b></summary>
490
+ <summary><b>Trade & tariffs USITC (1 tool)</b></summary>
359
491
 
360
- - `fed_register_search_documents` — search by query / agency / type / date
361
- - `fed_register_get_document` — citation, body URL, CFR refs
362
- - `fed_register_list_agencies` — agency slugs reference
492
+ - `hts_lookup` — US import-tariff classification + duty rates from the USITC Harmonized Tariff Schedule
363
493
  </details>
364
494
 
365
495
  <details>
366
- <summary><b>eCFRCode of Federal Regulations (2 tools)</b></summary>
496
+ <summary><b>Geo, disaster & state/local open data Census · FEMA · Socrata · CKAN (8 tools)</b></summary>
497
+
498
+ - `census_geocode_address` — resolve a one-line US address → matched address + Census geographies (tract, CD, place)
499
+ - `census_geographies_by_coordinates` — resolve a longitude/latitude point → Census geographies
500
+ - `fema_disaster_declarations` — FEMA disaster / emergency declarations by state, type, incident, year
501
+ - `fema_search_public_assistance` — FEMA Public Assistance funded projects
502
+ - `socrata_discover_datasets` — find Socrata dataset 4x4 ids by keyword
503
+ - `socrata_query` — query rows from an allowlisted Socrata/SODA open-data portal
504
+ - `ckan_discover_datasets` — find CKAN datastore resource ids by keyword
505
+ - `ckan_query` — query rows from an allowlisted CKAN datastore resource (state/city spend/checkbook)
506
+ </details>
367
507
 
368
- - `ecfr_search` — full-text search (titleNumber=48 for FAR)
369
- - `ecfr_list_titles`all 50 CFR titles + last-amended dates
508
+ <details>
509
+ <summary><b>Dataset discoverydata.gov (1 tool)</b></summary>
510
+
511
+ - `datagov_search_datasets` — search the data.gov v4 catalog for federal open datasets across all publishing agencies
370
512
  </details>
371
513
 
372
514
  <details>
373
- <summary><b>Grants.govfederal grants (2 tools)</b></summary>
515
+ <summary><b>Small business SBA (1 tool)</b></summary>
374
516
 
375
- - `grants_search` — opportunity search
376
- - `grants_get_opportunity` — full grant detail
517
+ - `sba_size_standard` — SBA small-business size standard for a 6-digit NAICS (set-aside eligibility gate)
377
518
  </details>
378
519
 
379
520
  ---
380
521
 
522
+ ## Reliability & offline snapshots
523
+
524
+ This server is built around one rule: **honest failure over confident fabrication.** Everything below is about *availability* of public data — none of it bypasses access controls.
525
+
526
+ **Keyless-first, and a down source *throws*.** Every source works with no API key. When a source is rate-limited, blocked, or down, the tool returns a **typed error** (`rate_limited` / `upstream_unavailable` / `schema_drift` / …) — it never invents rows and never reports a DOWN service as "0 results" or "not found". A genuine empty result and an outage are always distinguishable.
527
+
528
+ **Optional offline snapshots (off by default).** Some reference data changes slowly — the toptier-agency list, the top-level NAICS tree, the USAspending glossary, SBA size standards, the latest Treasury "Debt to the Penny." For those, you can optionally host a **snapshot mirror**: a static, public-data cache the server reads *only* when the live source is unreachable from your egress. A served snapshot is **never presented as live** — the response carries `_meta.dataPath: "snapshot"` plus an `asOf` timestamp, and `complete` is forced off, so an AI agent (and you) always see the staleness. Unset ⇒ pure live, byte-for-byte identical to today's behavior.
529
+
530
+ - **Enable it:** set `SAMGOV_SNAPSHOT_BASE_URL` to the base URL where you host the snapshots. Unset (the default) = live-only, no snapshot path is ever added.
531
+
532
+ ```json
533
+ { "mcpServers": { "sam-gov": { "command": "mcp-sam-gov",
534
+ "env": { "SAMGOV_SNAPSHOT_BASE_URL": "https://your-cdn.example.com/snapshots" } } } }
535
+ ```
536
+
537
+ - **Build the snapshots:** run `node scripts/build-snapshots.mjs` from any clean, non-blocked egress (a laptop / home / clean CI runner). It **self-diagnoses per-source reachability**, prints a reachability table, and writes a `manifest.json`. On partial coverage it refreshes only the sources it can reach and **leaves the last-good file in place** for the rest (stale-but-honest, never blanked). It exits non-zero only when *zero* sources were reachable (a fully blocked egress — the signal to re-run from a cleaner one).
538
+
539
+ - **The honest boundary.** This covers **public-data availability only.** The snapshot builder ingests only public, redistributable (public-domain / CC0) data, and the reader refuses to serve any envelope not marked `accessLevel: "public"`. It **honors rate limits** (a 429 is never routed around), uses **no proxies, no IP rotation, no auth/paywall/CAPTCHA bypass**, and refuses off-host redirects. If a source is blocked, the honest remedy is to build from a cleaner egress — not to evade the block.
540
+
541
+ ---
542
+
381
543
  ## Troubleshooting
382
544
 
383
545
  | Symptom | Fix |
@@ -412,7 +574,7 @@ const opp = await sam.getOpportunity("5ef3db5daeb54099a96d487783a38bd0");
412
574
  ```
413
575
 
414
576
  ```ts
415
- // USAspending wrappers (22 functions)
577
+ // USAspending wrappers
416
578
  import * as usas from "@cliwant/mcp-sam-gov/usaspending";
417
579
 
418
580
  const recompete = await usas.searchExpiringContracts({
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @cliwant/mcp-sam-gov/attachments — read the ACTUAL solicitation document.
3
+ *
4
+ * Why this exists
5
+ * ----------------
6
+ * An AI doing procurement research needs the real RFP/SOW/Q&A/wage-table TEXT,
7
+ * not just the synopsis (`sam_fetch_description`) or metadata. A SAM notice
8
+ * carries ATTACHMENTS (`resourceLinks` → keyless download URLs) that hold the
9
+ * true requirements. The rest of the server exposes those URLs but cannot read
10
+ * them; this module fetches one keyless and returns its extracted text so the
11
+ * agent can analyze the buy.
12
+ *
13
+ * SAM attachments are predominantly PDF (compressed streams / CID fonts — not
14
+ * hand-rollable), so PDF text extraction uses `unpdf` (a single self-contained
15
+ * package that bundles pdfjs; no transitive deps). text/HTML also occur and are
16
+ * decoded/stripped locally. DOCX is a ZIP whose `word/document.xml` holds the
17
+ * body text (deflate-compressed); we parse the ZIP container by hand and inflate
18
+ * that entry with Node's built-in `node:zlib` — NO new dependency. Other
19
+ * binaries are NOT half-parsed — they return `text:null` with an honest note.
20
+ *
21
+ * Truthfulness invariants (a reviewer WILL attack these):
22
+ * - A DOWN fetch (5xx / network / timeout) THROWS `upstream_unavailable`
23
+ * (retryable). A down service is NOT an empty attachment — never `text:""`.
24
+ * - A 404 THROWS `not_found` (the attachment id is gone).
25
+ * - A PDF that fails to parse (encrypted/corrupt) → `text:null` +
26
+ * `extractionError` note — NEVER a crash, NEVER a fake "".
27
+ * - A DOCX that fails to parse (corrupt/not-a-zip/no `word/document.xml`) →
28
+ * `text:null` + a disclosed note — NEVER a crash, NEVER a fake "".
29
+ * - A non-extractable format (binary) → `text:null` + honest note.
30
+ * - SSRF: only sam.gov / api.sam.gov hosts are fetched; anything else →
31
+ * `invalid_input` with NO network call.
32
+ * - `truncated`/`pages` are honest.
33
+ */
34
+ import { type MetaBundle } from "./meta.js";
35
+ /** The detected document family. */
36
+ export type AttachmentFormat = "pdf" | "docx" | "html" | "text" | "binary";
37
+ /** The tool's success payload (rides in a MetaBundle). */
38
+ export type AttachmentTextData = {
39
+ url: string;
40
+ filename: string | null;
41
+ contentType: string | null;
42
+ format: AttachmentFormat;
43
+ sizeBytes: number;
44
+ pages: number | null;
45
+ text: string | null;
46
+ truncated: boolean;
47
+ extracted: boolean;
48
+ };
49
+ export type FetchAttachmentTextArgs = {
50
+ url: string;
51
+ maxChars?: number;
52
+ };
53
+ /**
54
+ * Fetch a SAM attachment keyless and return its extracted TEXT.
55
+ *
56
+ * See the module header for the truthfulness invariants. Throws a
57
+ * `ToolErrorCarrier` for: bad/non-SAM URL (`invalid_input`, no fetch), a 404
58
+ * (`not_found`), or a down fetch (`upstream_unavailable`, retryable). Otherwise
59
+ * ALWAYS returns a payload — a document we cannot extract yields `text:null` +
60
+ * a disclosed note, never an exception and never a fabricated string.
61
+ */
62
+ export declare function fetchAttachmentText(args: FetchAttachmentTextArgs): Promise<MetaBundle<AttachmentTextData>>;
63
+ //# sourceMappingURL=attachments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../src/attachments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAKH,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AA0FtD,oCAAoC;AACpC,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AA8Q3E,0DAA0D;AAC1D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAgOzC"}