@cyanheads/usaspending-mcp-server 0.4.2 → 0.4.4

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 (99) hide show
  1. package/AGENTS.md +428 -0
  2. package/CLAUDE.md +46 -19
  3. package/Dockerfile +10 -1
  4. package/README.md +118 -189
  5. package/changelog/0.4.x/0.4.3.md +33 -0
  6. package/changelog/0.4.x/0.4.4.md +31 -0
  7. package/changelog/template.md +9 -26
  8. package/dist/index.js +9 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.d.ts +2 -0
  11. package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.d.ts.map +1 -1
  12. package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.js +4 -2
  13. package/dist/mcp-server/tools/definitions/autocomplete-filters.tool.js.map +1 -1
  14. package/dist/mcp-server/tools/definitions/dates.d.ts +95 -0
  15. package/dist/mcp-server/tools/definitions/dates.d.ts.map +1 -0
  16. package/dist/mcp-server/tools/definitions/dates.js +145 -0
  17. package/dist/mcp-server/tools/definitions/dates.js.map +1 -0
  18. package/dist/mcp-server/tools/definitions/disaster-spending.tool.d.ts +10 -1
  19. package/dist/mcp-server/tools/definitions/disaster-spending.tool.d.ts.map +1 -1
  20. package/dist/mcp-server/tools/definitions/disaster-spending.tool.js +95 -14
  21. package/dist/mcp-server/tools/definitions/disaster-spending.tool.js.map +1 -1
  22. package/dist/mcp-server/tools/definitions/filters.d.ts +11 -2
  23. package/dist/mcp-server/tools/definitions/filters.d.ts.map +1 -1
  24. package/dist/mcp-server/tools/definitions/filters.js +12 -5
  25. package/dist/mcp-server/tools/definitions/filters.js.map +1 -1
  26. package/dist/mcp-server/tools/definitions/get-agency.tool.d.ts +3 -1
  27. package/dist/mcp-server/tools/definitions/get-agency.tool.d.ts.map +1 -1
  28. package/dist/mcp-server/tools/definitions/get-agency.tool.js +7 -21
  29. package/dist/mcp-server/tools/definitions/get-agency.tool.js.map +1 -1
  30. package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.d.ts +2 -0
  31. package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.d.ts.map +1 -1
  32. package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.js +2 -0
  33. package/dist/mcp-server/tools/definitions/get-award-federal-accounts.tool.js.map +1 -1
  34. package/dist/mcp-server/tools/definitions/get-award-subawards.tool.d.ts +2 -0
  35. package/dist/mcp-server/tools/definitions/get-award-subawards.tool.d.ts.map +1 -1
  36. package/dist/mcp-server/tools/definitions/get-award-subawards.tool.js +2 -0
  37. package/dist/mcp-server/tools/definitions/get-award-subawards.tool.js.map +1 -1
  38. package/dist/mcp-server/tools/definitions/get-award-transactions.tool.d.ts +2 -0
  39. package/dist/mcp-server/tools/definitions/get-award-transactions.tool.d.ts.map +1 -1
  40. package/dist/mcp-server/tools/definitions/get-award-transactions.tool.js +2 -0
  41. package/dist/mcp-server/tools/definitions/get-award-transactions.tool.js.map +1 -1
  42. package/dist/mcp-server/tools/definitions/get-award.tool.d.ts +2 -0
  43. package/dist/mcp-server/tools/definitions/get-award.tool.d.ts.map +1 -1
  44. package/dist/mcp-server/tools/definitions/get-award.tool.js +3 -5
  45. package/dist/mcp-server/tools/definitions/get-award.tool.js.map +1 -1
  46. package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.d.ts +2 -0
  47. package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.d.ts.map +1 -1
  48. package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.js +2 -0
  49. package/dist/mcp-server/tools/definitions/get-federal-account-breakdown.tool.js.map +1 -1
  50. package/dist/mcp-server/tools/definitions/get-federal-account.tool.d.ts +2 -0
  51. package/dist/mcp-server/tools/definitions/get-federal-account.tool.d.ts.map +1 -1
  52. package/dist/mcp-server/tools/definitions/get-federal-account.tool.js +3 -5
  53. package/dist/mcp-server/tools/definitions/get-federal-account.tool.js.map +1 -1
  54. package/dist/mcp-server/tools/definitions/get-idv-awards.tool.d.ts +2 -0
  55. package/dist/mcp-server/tools/definitions/get-idv-awards.tool.d.ts.map +1 -1
  56. package/dist/mcp-server/tools/definitions/get-idv-awards.tool.js +2 -0
  57. package/dist/mcp-server/tools/definitions/get-idv-awards.tool.js.map +1 -1
  58. package/dist/mcp-server/tools/definitions/get-recipient.tool.d.ts +2 -0
  59. package/dist/mcp-server/tools/definitions/get-recipient.tool.d.ts.map +1 -1
  60. package/dist/mcp-server/tools/definitions/get-recipient.tool.js +3 -5
  61. package/dist/mcp-server/tools/definitions/get-recipient.tool.js.map +1 -1
  62. package/dist/mcp-server/tools/definitions/index.d.ts +118 -13
  63. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
  64. package/dist/mcp-server/tools/definitions/list-agencies.tool.d.ts +2 -0
  65. package/dist/mcp-server/tools/definitions/list-agencies.tool.d.ts.map +1 -1
  66. package/dist/mcp-server/tools/definitions/list-agencies.tool.js +2 -0
  67. package/dist/mcp-server/tools/definitions/list-agencies.tool.js.map +1 -1
  68. package/dist/mcp-server/tools/definitions/search-awards.tool.d.ts +33 -5
  69. package/dist/mcp-server/tools/definitions/search-awards.tool.d.ts.map +1 -1
  70. package/dist/mcp-server/tools/definitions/search-awards.tool.js +215 -60
  71. package/dist/mcp-server/tools/definitions/search-awards.tool.js.map +1 -1
  72. package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.d.ts +2 -0
  73. package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.d.ts.map +1 -1
  74. package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.js +2 -0
  75. package/dist/mcp-server/tools/definitions/search-federal-accounts.tool.js.map +1 -1
  76. package/dist/mcp-server/tools/definitions/search-recipients.tool.d.ts +2 -0
  77. package/dist/mcp-server/tools/definitions/search-recipients.tool.d.ts.map +1 -1
  78. package/dist/mcp-server/tools/definitions/search-recipients.tool.js +2 -0
  79. package/dist/mcp-server/tools/definitions/search-recipients.tool.js.map +1 -1
  80. package/dist/mcp-server/tools/definitions/spending-by-category.tool.d.ts +16 -2
  81. package/dist/mcp-server/tools/definitions/spending-by-category.tool.d.ts.map +1 -1
  82. package/dist/mcp-server/tools/definitions/spending-by-category.tool.js +46 -12
  83. package/dist/mcp-server/tools/definitions/spending-by-category.tool.js.map +1 -1
  84. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.d.ts +16 -2
  85. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.d.ts.map +1 -1
  86. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.js +51 -19
  87. package/dist/mcp-server/tools/definitions/spending-by-geography.tool.js.map +1 -1
  88. package/dist/mcp-server/tools/definitions/spending-over-time.tool.d.ts +16 -2
  89. package/dist/mcp-server/tools/definitions/spending-over-time.tool.d.ts.map +1 -1
  90. package/dist/mcp-server/tools/definitions/spending-over-time.tool.js +46 -12
  91. package/dist/mcp-server/tools/definitions/spending-over-time.tool.js.map +1 -1
  92. package/dist/services/usaspending/types.d.ts +28 -2
  93. package/dist/services/usaspending/types.d.ts.map +1 -1
  94. package/dist/services/usaspending/usaspending-service.d.ts +10 -14
  95. package/dist/services/usaspending/usaspending-service.d.ts.map +1 -1
  96. package/dist/services/usaspending/usaspending-service.js +110 -4
  97. package/dist/services/usaspending/usaspending-service.js.map +1 -1
  98. package/package.json +12 -10
  99. package/server.json +3 -3
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.4.2-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/usaspending-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/usaspending-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/usaspending-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.4.0-blueviolet.svg?style=flat-square)](https://bun.sh/)
10
+ [![Version](https://img.shields.io/badge/Version-0.4.4-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/usaspending-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/usaspending-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/usaspending-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.4.0-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
11
 
12
12
  </div>
13
13
 
@@ -27,254 +27,185 @@
27
27
 
28
28
  ---
29
29
 
30
- ## Tools
30
+ ## Overview
31
31
 
32
- 18 tools covering the full USAspending.gov API surface — award discovery and detail, recipient and agency profiles, spending analytics (by geography, category, and time), disaster/emergency spending, and federal account data:
32
+ Federal award, recipient, agency, and spending data from USAspending.gov, the US Treasury's DATA Act transparency platform. Search and trace awards down to transactions, subawards, and funding accounts; profile recipients and agencies; and aggregate spending by geography, category, time, and disaster appropriation. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.
33
+
34
+ ### Tools
33
35
 
34
36
  | Tool | Description |
35
37
  |:---|:---|
36
- | `usaspending_search_awards` | Search federal awards by keyword, recipient, agency, award type, NAICS code, location, or date range. Returns ranked award summaries with recipient names, amounts, agencies, and award IDs for chaining. |
37
- | `usaspending_get_award` | Fetch full details of a federal award by its generated ID. Returns contract or assistance data, parent IDV info, subaward count, and funding account linkages. |
38
- | `usaspending_get_idv_awards` | List child contracts and task/delivery orders placed under an IDV award. Each row includes a `generated_unique_award_id` for chaining into `usaspending_get_award`. |
39
- | `usaspending_get_award_transactions` | List individual transactions (modifications, amendments) on an award. Reveals spending history and obligation changes over time. |
40
- | `usaspending_get_award_subawards` | List subaward contracts or grants under a prime award. Reveals the sub-contractor or sub-grantee layer — who actually does the work. |
41
- | `usaspending_get_award_federal_accounts` | List the Treasury federal accounts that funded an award, with the amount obligated from each. Returns `federal_account` for chaining into `usaspending_get_federal_account`. |
42
- | `usaspending_search_recipients` | Search for organizations receiving federal funds by name, UEI, or DUNS. Returns recipient hash IDs, UEI/DUNS, total award amounts, and hierarchy level. Paginated — page through with `page`; `page_metadata.total` reports the full match count. |
43
- | `usaspending_get_recipient` | Fetch a recipient's profile: address, business types, parent organization, alternate names, and total award amounts by type. |
44
- | `usaspending_get_agency` | Fetch an agency's fiscal year overview: mission, budget authority, obligation totals, sub-agency count, and DEF codes. Accepts a 3-digit `toptier_code` or an `agency_slug` from award search results. |
45
- | `usaspending_spending_by_geography` | Aggregate federal spending by state, county, or congressional district. Returns per-capita figures when combined with population data. |
46
- | `usaspending_spending_by_category` | Aggregate spending grouped by NAICS code, PSC code, awarding agency, funding agency, CFDA program, or recipient. Returns top items with amounts for trend and breakdown analysis. |
47
- | `usaspending_spending_over_time` | Fetch aggregated spending by fiscal year, fiscal quarter, or fiscal month. Filter by award type, agency, recipient, or keyword to trace trends in a specific area. |
48
- | `usaspending_disaster_spending` | Fetch disaster and emergency supplemental spending (COVID-19, hurricanes, etc.) broken down by agency, CFDA program, recipient, or geography. Filter by DEF codes to isolate a specific appropriation. |
49
- | `usaspending_get_federal_account` | Fetch a federal account's budget data: total obligations, outlays, budgetary resources, and the per-Treasury-Account-Symbol component breakdown. Account codes come from `usaspending_search_federal_accounts`. |
50
- | `usaspending_get_federal_account_breakdown` | Break a federal account's obligations down by program activity (what the money funds) or object class (what it buys). Paginated with a total count. |
51
- | `usaspending_search_federal_accounts` | List and keyword-search federal accounts by agency identifier or title keyword. Returns account numbers for chaining into `usaspending_get_federal_account`. |
52
- | `usaspending_list_agencies` | List all top-tier federal agencies with toptier codes, budget authority amounts, and obligation totals. Entry point for agency navigation. |
53
- | `usaspending_autocomplete_filters` | Look up valid code values for filter fields: NAICS, PSC, CFDA, recipient names, or agency names. Use before filtering to discover the right code from a description. |
54
-
55
- ### `usaspending_search_awards`
56
-
57
- Search for federal awards across contracts, grants, loans, direct payments, and IDVs.
58
-
59
- - Full-text keyword search across award descriptions, recipient names, and locations
60
- - Filter by award type codes (`A/B/C/D` = contracts, `02/03/04/05` = grants, `06/10` = direct payments, `07/08` = loans, `IDV_*` = IDVs)
61
- - Filter by awarding or funding agency (toptier or subtier), recipient name, NAICS code, and place of performance
62
- - Date range filtering — earliest 2007-10-01 via search API
63
- - Pagination via `limit` (max 100) and `page`; `page_metadata.has_next` signals more results and is `true` on any full page — the endpoint stops advertising continuation once `page` × `limit` reaches 10,000, so page fullness is the honest signal past that point. Page-number paging caps at a 50,000-result offset — beyond it, continue with keyset pagination using the `last_record_sort_value` + `last_record_unique_id` cursor, which is only returned below the 10,000-result offset and has to be captured before crossing it
64
- - Returns `generated_internal_id` for chaining to `usaspending_get_award` and `agency_slug` for chaining to `usaspending_get_agency`
38
+ | `usaspending_list_agencies` | List every top-tier federal agency with its toptier code, slug, and current-year budget totals |
39
+ | `usaspending_autocomplete_filters` | Look up NAICS, PSC, CFDA, agency, or recipient codes from a free-text description |
40
+ | `usaspending_search_awards` | Search awards by keyword, recipient, agency, award type, NAICS code, assistance listing, location, or date range |
41
+ | `usaspending_get_award` | Fetch one award's full record: amounts, recipient, agencies, codes, parent IDV, DEF-code funding |
42
+ | `usaspending_get_award_transactions` | List the transactions (modifications, amendments) on an award |
43
+ | `usaspending_get_award_subawards` | List the subcontracts or subgrants under a prime award |
44
+ | `usaspending_get_award_federal_accounts` | List the Treasury federal accounts that funded an award, with the amount from each |
45
+ | `usaspending_get_idv_awards` | List the child orders and sub-IDVs placed under an IDV |
46
+ | `usaspending_search_recipients` | Search recipients by name, UEI, or DUNS |
47
+ | `usaspending_get_recipient` | Fetch a recipient's profile: address, business types, parent, and award totals |
48
+ | `usaspending_get_agency` | Fetch an agency's mission, latest-year budget totals, sub-agencies, and DEF codes |
49
+ | `usaspending_spending_by_geography` | Aggregate spending by state, county, or congressional district |
50
+ | `usaspending_spending_by_category` | Aggregate spending by NAICS, PSC, agency, CFDA program, or recipient |
51
+ | `usaspending_spending_over_time` | Aggregate spending by fiscal year, quarter, or month |
52
+ | `usaspending_disaster_spending` | Break down disaster and emergency supplemental spending by agency, program, recipient, or geography |
53
+ | `usaspending_search_federal_accounts` | Search federal accounts by title keyword or agency identifier |
54
+ | `usaspending_get_federal_account` | Fetch a federal account's budget totals and its Treasury Account Symbol components |
55
+ | `usaspending_get_federal_account_breakdown` | Break a federal account's obligations down by program activity or object class |
56
+
57
+ ## Capability reference
58
+
59
+ ### `usaspending_list_agencies` <sub>tool</sub>
60
+
61
+ - Takes only `sort` (`agency_name`, `budget_authority_amount`, `obligated_amount`, `outlay_amount`) and `order`; returns every agency in one unpaginated response
62
+ - Rows carry `toptier_code` and `agency_slug`, both accepted by `usaspending_get_agency`, plus current-year `budget_authority_amount`, `obligated_amount`, and `outlay_amount`
65
63
 
66
64
  ---
67
65
 
68
- ### `usaspending_get_award`
69
-
70
- Fetch complete details for a single federal award by its generated ID.
66
+ ### `usaspending_autocomplete_filters` <sub>tool</sub>
71
67
 
72
- - Returns type, description, total obligation, date signed, and subaward count
73
- - Exposes `recipient.recipient_hash` for chaining to `usaspending_get_recipient`
74
- - Exposes `parent_award.generated_unique_award_id` for traversing IDV parent chains
75
- - Includes NAICS code and product/service code from the latest transaction
76
- - Returns `account_obligations_by_defc` linking the award to specific disaster/emergency appropriations
77
- - Award IDs use the `generated_unique_award_id` format (e.g., `CONT_AWD_FA862118F6251_9700_...`)
68
+ - `type` (`naics`, `psc`, `cfda`, `awarding_agency`, `recipient`) plus `search_text`; `limit` 1–500, default 10
69
+ - Rows carry `code` and `name`, with `id` for agencies and `uei` / `duns` for recipients; no match fails as `no_match`. A `cfda` code is what `usaspending_search_awards` takes in `assistance_listings`
70
+ - `naics` matches official NAICS title text: "software" resolves, "cybersecurity" does not, so search with the industry term a title would use
78
71
 
79
72
  ---
80
73
 
81
- ### `usaspending_get_idv_awards`
82
-
83
- List child contracts and orders placed under an IDV (Indefinite Delivery Vehicle) award.
74
+ ### `usaspending_search_awards` <sub>tool</sub>
84
75
 
85
- - `award_id` must be the `generated_unique_award_id` of the parent IDV — from `usaspending_search_awards` (`generated_internal_id` field) or from `usaspending_get_award`
86
- - `type` selects what to list: `child_awards` (task/delivery orders), `child_idvs` (sub-IDVs), or `grandchild_awards`
87
- - Each row returns `generated_unique_award_id` for chaining into `usaspending_get_award` for full detail
88
- - Pagination via `limit` and `page`; note: no `total` count is available from this endpoint
89
- - An invalid `award_id` or an IDV with no children of the requested type returns an empty result set
76
+ - Filters: `keyword`, `agency_name`, `recipient_name`, `naics_codes`, `assistance_listings`, `time_period`, and `location_filter` (country, state, FIPS county, city); `award_type_codes` defaults to contracts (`A`–`D`) and must stay in one group: IDVs `IDV_A`–`IDV_E`, grants `02`–`05`/`F001`/`F002`, direct payments `06`/`10`/`F006`/`F007`, loans `07`/`08`/`F003`/`F004`, or other assistance `09`/`11`/`-1`/`F005`/`F008`/`F009`/`F010`. `limit` up to 100
77
+ - `assistance_listings` takes Assistance Listing (CFDA) numbers such as `93.866` or `11.67A` — look them up with `usaspending_autocomplete_filters` `type: cfda` — and matches awards carrying any of them. It needs an assistance group in `award_type_codes`; with contract or IDV codes, or the contract default, it fails as `assistance_listings_type_mismatch`
78
+ - `sort` depends on the award type group: loans sort by `Loan Value` (default), `Subsidy Cost`, `Issued Date`, `Recipient Name`, or `Awarding Agency`; every other group by `Award Amount` (default), `Total Outlays`, `Start Date`, `End Date`, `Recipient Name`, or `Awarding Agency`, except that IDVs have no `End Date`. Any other pairing fails as `unsupported_sort` with the group's list
79
+ - Dates are `YYYY-MM-DD` from 2007-10-01 on (month and day may be unpadded). Either end may be given alone, on the nested `filters.time_period_start` / `time_period_end` or by leaving one side of `time_period` blank (`""`) — a lone start runs through today (UTC), a lone end from 2007-10-01 — and the response echoes the range sent with a `notice` naming the filled field. A fully blank `time_period` means no date filter. A start after the end fails as `date_range_inverted`
80
+ - Rows carry `generated_internal_id` for `usaspending_get_award` and `agency_slug` for `usaspending_get_agency`; loan rows carry `loan_value`, `subsidy_cost`, and `issued_date` in place of amounts and dates. There is no total, and `page_metadata.has_next` is true on any full page
81
+ - Page numbers stop at a 50,000-result offset (`pagination_limit_exceeded`); go further with the `last_record_sort_value` + `last_record_unique_id` cursor, which is only returned below a 10,000-result offset
90
82
 
91
83
  ---
92
84
 
93
- ### `usaspending_get_award_transactions`
85
+ ### `usaspending_get_award` <sub>tool</sub>
94
86
 
95
- List obligation history and modifications for an award.
96
-
97
- - Each row is one transaction: `action_date`, `federal_action_obligation`, `modification_number`, and description
98
- - Pagination via `limit` and `page`; configurable sort and order. No `total` count is available from this endpoint
87
+ - `award_id` is a `generated_unique_award_id`, the `generated_internal_id` from search; an unknown ID fails as `award_not_found`
88
+ - Returns `category`, `total_obligation`, `total_outlays`, `subaward_count`, NAICS / PSC or CFDA codes, and `account_obligations_by_defc`
89
+ - `recipient.recipient_id` chains to `usaspending_get_recipient` and `parent_award.generated_unique_award_id` to the parent IDV; `category: "idv"` awards list their children via `usaspending_get_idv_awards`
99
90
 
100
91
  ---
101
92
 
102
- ### `usaspending_get_award_subawards`
103
-
104
- List subawards under a prime contract or grant.
93
+ ### `usaspending_get_award_transactions` <sub>tool</sub>
105
94
 
106
- - Each row covers: subaward number, description, action date, amount, and recipient name
107
- - Reveals the supply chain below the prime — who actually performs the work
108
- - Pagination via `limit` and `page`; configurable sort and order. No `total` count is available from this endpoint
95
+ - `award_id` plus `sort` (`action_date`, `federal_action_obligation`, `modification_number`); `limit` up to 100
96
+ - Rows carry `action_date`, `modification_number`, `action_type`, and a signed `federal_action_obligation` (negative is a deobligation)
109
97
 
110
98
  ---
111
99
 
112
- ### `usaspending_get_award_federal_accounts`
100
+ ### `usaspending_get_award_subawards` <sub>tool</sub>
113
101
 
114
- List the Treasury federal accounts that funded an award — the award → appropriation link.
115
-
116
- - `award_id` must be a `generated_unique_award_id` — from `usaspending_search_awards` (`generated_internal_id` field) or `usaspending_get_award`
117
- - Each row returns `federal_account` (AGENCY-MAIN format, e.g. `080-0120`) for chaining into `usaspending_get_federal_account`, plus the amount obligated from that account and the funding agency behind it
118
- - Distinct from `usaspending_get_award` `account_obligations_by_defc`, which breaks funding down by Disaster/Emergency Funding code rather than by account
119
- - Pagination via `limit` (max 100) and `page`; `count` in `page_metadata` is the total across pages
120
- - An `award_id` that does not exist returns an empty list rather than an error — the upstream reports no not-found signal for this endpoint
102
+ - `award_id` plus `sort` (`subaward_number`, `description`, `action_date`, `amount`, `recipient_name`); `limit` up to 100
103
+ - Rows carry `subaward_number`, `amount`, `action_date`, `recipient_name`, `recipient_uei`, and place of performance; `subaward_count` on `usaspending_get_award` says whether any exist
121
104
 
122
105
  ---
123
106
 
124
- ### `usaspending_search_recipients`
125
-
126
- Search for organizations receiving federal funds by name, UEI, or DUNS.
107
+ ### `usaspending_get_award_federal_accounts` <sub>tool</sub>
127
108
 
128
- - Returns recipient IDs (UUID hashes with level suffix: `-P` parent, `-C` child, `-R` root), UEI, DUNS, name, recipient level, and total award amount
129
- - `results[].id` chains to `usaspending_get_recipient`; `uei` and `duns` chain to SAM.gov or SEC EDGAR
130
- - Paginated via `limit` (max 100) and `page`; `page_metadata` reports `total`, `page`, and `has_next` — page through to reach matches beyond the first page
109
+ - `award_id` is a `generated_unique_award_id`; `limit` up to 100, with `page_metadata.count` as the total
110
+ - Rows carry `federal_account` (AGENCY-MAIN, e.g. `080-0120`) for `usaspending_get_federal_account`, `total_transaction_obligated_amount`, and the funding agency with its `funding_agency_slug`
131
111
 
132
112
  ---
133
113
 
134
- ### `usaspending_get_recipient`
135
-
136
- Fetch a recipient's full profile.
114
+ ### `usaspending_get_idv_awards` <sub>tool</sub>
137
115
 
138
- - Returns address, business type classifications, parent organization, alternate names
139
- - Optionally scope to a specific fiscal year and award type
140
- - Requires the UUID-based recipient ID from `usaspending_search_recipients`
116
+ - Parent IDV `award_id`; `type` is `child_awards` (task and delivery orders, the default), `child_idvs`, or `grandchild_awards`; `limit` up to 100
117
+ - Rows carry `generated_unique_award_id` for `usaspending_get_award`, `obligated_amount`, and performance dates; there is no total, and `has_next` is true on any full page
141
118
 
142
119
  ---
143
120
 
144
- ### `usaspending_get_agency`
121
+ ### `usaspending_search_recipients` <sub>tool</sub>
145
122
 
146
- Fetch an agency's current fiscal year overview.
147
-
148
- - Returns mission, budget authority amount, obligation amount, sub-agency count, and DEF codes
149
- - Accepts either a 3-digit `toptier_code` (e.g., `097` for DoD) or an `agency_slug` (e.g., `department-of-defense`) — slugs appear in award search results, eliminating an intermediate lookup
150
- - Includes sub-agency breakdown with transaction counts
123
+ - `keyword` matches names, UEI, or DUNS, partial matches included; optional `award_type` scopes the totals; `limit` up to 100
124
+ - Rows carry `id` (a hash suffixed `-P` parent, `-C` child, or `-R` standalone) for `usaspending_get_recipient`, plus `uei`, `duns`, `recipient_level`, and `amount`; `page_metadata.total` is the full match count
151
125
 
152
126
  ---
153
127
 
154
- ### `usaspending_spending_by_geography`
155
-
156
- Aggregate federal spending by geographic unit.
128
+ ### `usaspending_get_recipient` <sub>tool</sub>
157
129
 
158
- - `scope`: `place_of_performance` or `recipient_location`
159
- - `geo_layer`: `state`, `county`, or `district`
160
- - Returns `shape_code`, `display_name`, `aggregated_amount`, and `per_capita` (when `population` is available)
161
- - `limit` accepts 1–500 (default 50). The upstream endpoint is not paginated — a nationwide county query matches over 3,000 areas — so areas are ranked by `aggregated_amount` descending and capped client-side; `total_areas_available` reports the full match count
162
- - Omitting `filters` entirely aggregates every award type (contracts, IDVs, grants, direct payments, loans, insurance, and unspecified); the substitution is disclosed on the response
163
- - Geographic filters require FIPS codes or 2-letter state abbreviations — use a geocoding server (e.g., Census or OpenStreetMap) to resolve place names first
130
+ - `recipient_id` from `usaspending_search_recipients` or `usaspending_get_award`; optional `fiscal_year` (2001–2030) and `award_type` scope the totals; an unknown ID fails as `recipient_not_found`
131
+ - Returns address, `business_types`, `parent_name` / `parent_uei`, `alternate_names`, `total_transaction_amount`, `total_transactions`, and loan face-value totals
164
132
 
165
133
  ---
166
134
 
167
- ### `usaspending_spending_by_category`
135
+ ### `usaspending_get_agency` <sub>tool</sub>
168
136
 
169
- Aggregate spending broken down by a single dimension.
170
-
171
- - `category` enum maps to the right sub-route: `naics`, `psc`, `awarding_agency`, `funding_agency`, `cfda`, or `recipient`
172
- - Returns top items with amounts and codes for trend analysis
173
- - Accepts the standard award filter object for scoping to a specific agency, time period, or keyword
174
- - Pagination via `limit` and `page`; no `total` count is available from this endpoint
137
+ - One of `toptier_code` (e.g. `097`) or `agency_slug` (e.g. `department-of-defense`); `page` walks the sub-agency list 10 at a time. Failures are `missing_input` and `agency_not_found`
138
+ - Returns `mission`, plus `budgetary_resources_amount`, `obligated_amount`, and `outlay_amount` for the latest `fiscal_year`, `sub_agencies` with obligations and transaction and new-award counts, and `def_codes`
175
139
 
176
140
  ---
177
141
 
178
- ### `usaspending_spending_over_time`
179
-
180
- Fetch aggregated spending grouped by time period.
142
+ ### `usaspending_spending_by_geography` <sub>tool</sub>
181
143
 
182
- - `group`: `fiscal_year`, `quarter`, or `month`
183
- - Filter by award type, agency, recipient, or keyword to trace trends in a specific area
184
- - `subawards: true` shifts aggregation to the subaward layer
144
+ - `scope` (`place_of_performance`, `recipient_location`) and `geo_layer` (`state`, `county`, `district`) are required; `filters` takes `keywords`, `award_type_codes`, `agency_name`, `recipient_id`, `naics_codes`, and `time_period_start` / `time_period_end` (`YYYY-MM-DD`; either alone fills the other, as in `usaspending_search_awards`, `applied_time_period_*` echoes the range sent, a start after the end fails as `date_range_inverted`, and a range starting before 2007-10-01 fails as `date_before_earliest`); `limit` 1–500, default 50
145
+ - Rows carry `shape_code`, `display_name`, `aggregated_amount`, `population`, `per_capita`, and `award_count`, ranked by amount; `total_areas_available` counts every match before the cap
146
+ - With no filters, every award type is aggregated and `applied_award_type_default` says so; `subawards: true` switches to subaward data
185
147
 
186
148
  ---
187
149
 
188
- ### `usaspending_disaster_spending`
189
-
190
- Fetch disaster and emergency supplemental spending consolidated from nine+ API endpoints.
150
+ ### `usaspending_spending_by_category` <sub>tool</sub>
191
151
 
192
- - `dimension` enum selects the breakdown axis: `overview`, `agency`, `cfda`, `recipient`, or `geography`
193
- - `spending_type` selects between award-level obligations and outlays (`award`) and total spending including direct non-award amounts (`total`, agency and recipient dimensions only)
194
- - Filter by `def_codes` to isolate a specific emergency appropriation (e.g., COVID-19 = `L`, `M`, `N`, `O`, `P`, `U`)
195
- - Returns obligation, outlay, and award count per row
152
+ - `category` is `naics`, `psc`, `awarding_agency`, `awarding_subagency`, `funding_agency`, `funding_subagency`, `cfda`, `recipient_duns`, or `recipient_parent_duns`; takes the same `filters` object as `usaspending_spending_by_geography`; `limit` up to 100
153
+ - Rows carry `id`, `code`, `name`, and `amount`, ranked by obligation
196
154
 
197
155
  ---
198
156
 
199
- ### `usaspending_get_federal_account`
157
+ ### `usaspending_spending_over_time` <sub>tool</sub>
200
158
 
201
- Fetch budget data for a federal account identified by its account code.
202
-
203
- - Returns account title, federal account code, agency identifier, parent agency, and bureau
204
- - Includes the fiscal year snapshot: total obligations, gross outlays, and budgetary resources
205
- - `children` breaks the account into its Treasury Account Symbol (TAS) components, each with its own obligated, outlay, and budgetary-resource amounts — one entry per availability period, bounded and returned in full
206
- - Account codes come from `account_number` in `usaspending_search_federal_accounts` results, or `federal_account` in `usaspending_get_award_federal_accounts` results
207
- - For obligations broken down by program activity or object class, use `usaspending_get_federal_account_breakdown`
159
+ - `group` is `fiscal_year`, `quarter`, or `month` (fiscal month, where 1 is October); the same `filters` object, with `award_type_codes` defaulting to contracts and limited to one group; `subawards: true` switches to subaward data
160
+ - Rows carry `time_period`, `aggregated_amount`, and per-type `contracts`, `grants`, `direct_payments`, `idvs`, `loans`, and `other`
208
161
 
209
162
  ---
210
163
 
211
- ### `usaspending_get_federal_account_breakdown`
212
-
213
- Break a federal account's obligations down by program activity or object class.
164
+ ### `usaspending_disaster_spending` <sub>tool</sub>
214
165
 
215
- - `dimension` enum selects the axis: `program_activity` (what the money funds) or `object_class` (what it buys — personnel, supplies, contracts)
216
- - Each row returns the code, name, and obligated amount; `program_activity` rows also carry `type` — `PAC/PAN` (legacy program activity code/name) or `PARK` (Program Activity Reporting Key), both of which can appear for the same account
217
- - Pagination via `limit` (max 100) and `page`; `total` in `page_metadata` is the true row count across pages
218
- - An account code that does not exist returns an empty list rather than an error — unlike `usaspending_get_federal_account`, these routes report no not-found signal
166
+ - `dimension` is `overview`, `agency`, `cfda`, `recipient`, or `geography`; every dimension except `overview` requires `filters.def_codes` (e.g. `["L", "M", "N", "O", "P"]` for COVID-19); `limit` up to 100 on agency, cfda, and recipient
167
+ - Rows carry `obligation`, `outlay`, and `award_count`, plus `total_budgetary_resources` on agency rows under `spending_type: total`; `overview` returns totals and `funding_by_def_code`. A recipient row's `id` is one recipient hash for `usaspending_get_recipient` — the recipient-level `-R` ID when USAspending lists several. The recipient total tops out at 10,000, and a response at that cap is flagged `truncated`
168
+ - Agency, cfda, and recipient also return `totals` for every matching row, as USAspending reports them: `obligation`, `outlay`, and either `total_budgetary_resources` (agency, `total`) or `award_count`. When the overview endpoint outlasts the request budget, the agency breakdown with `spending_type: total` still reports obligations, outlays, and budgetary resources
169
+ - `spending_type` (`award`, the default, or `total`) applies to the agency dimension only — USAspending returns the same recipient breakdown for either value; geography takes `filters.geo_layer` (`state`, `county`) and always reports obligations
219
170
 
220
171
  ---
221
172
 
222
- ### `usaspending_search_federal_accounts`
173
+ ### `usaspending_search_federal_accounts` <sub>tool</sub>
223
174
 
224
- List and keyword-search federal accounts by agency or title keyword.
225
-
226
- - `keyword` filters by account name/title (e.g., `"defense"`, `"transportation"`)
227
- - `agency_identifier` filters to a specific agency by 3-digit code (e.g., `"097"` for DoD) — use `usaspending_list_agencies` to look up codes
228
- - `sort_field` enum: `account_name`, `account_number`, `budgetary_resources` (default), `managing_agency`
229
- - Returns `account_number` (format `"097-8097"`) for chaining into `usaspending_get_federal_account` for full budget detail
230
- - Pagination via `limit` and `page`; `count` in `page_metadata` is the total matches
175
+ - Optional `keyword` and 3-digit `agency_identifier`; `sort_field` is `account_name`, `account_number`, `budgetary_resources` (default), or `managing_agency`; `limit` up to 100
176
+ - Rows carry `account_number` (e.g. `097-8097`) for the federal-account tools, `managing_agency`, and `budgetary_resources`; `page_metadata.count` is the total
231
177
 
232
178
  ---
233
179
 
234
- ### `usaspending_list_agencies`
235
-
236
- List all top-tier federal agencies.
180
+ ### `usaspending_get_federal_account` <sub>tool</sub>
237
181
 
238
- - Returns agency name, abbreviation, `toptier_code`, `agency_slug`, obligated amount, and budget authority amount for the current fiscal year
239
- - Entry point for agency navigation — `toptier_code` is required by `usaspending_get_agency` and agency filters
240
- - Configurable sort and order
182
+ - `account_code` in AGENCY-MAIN format, from `account_number` in search results or `federal_account` on an award; an unknown code fails as `account_not_found`
183
+ - Returns `total_obligated_amount`, `total_gross_outlay_amount`, and `total_budgetary_resources` for `fiscal_year`, plus `children`: one entry per Treasury Account Symbol with its own amounts
241
184
 
242
185
  ---
243
186
 
244
- ### `usaspending_autocomplete_filters`
245
-
246
- Discover valid code values for award filter fields.
187
+ ### `usaspending_get_federal_account_breakdown` <sub>tool</sub>
247
188
 
248
- - `type` enum selects the lookup: `naics`, `psc`, `cfda`, `awarding_agency`, or `recipient`
249
- - Returns matching codes and names — use before filtering to find the right code when you only know a description (e.g., "software" → NAICS codes); `recipient` matches also carry `uei`/`duns`
250
- - The `naics` lookup matches official NAICS title text, not colloquial industry language — "software" and "aircraft" resolve, "cybersecurity" and "aircraft maintenance" return nothing. Fall back to the broader industry term the NAICS title would use
251
- - Consolidates five autocomplete endpoints into one tool
252
- - `limit` accepts 1–500 and is enforced client-side — the `recipient` lookup unions three upstream match buckets (name, UEI, DUNS) and can return up to 3x the requested count, so its results are capped before returning; the other four honor `limit` exactly
189
+ - `account_code` plus `dimension` (`program_activity` or `object_class`); `limit` up to 100, with `page_metadata.total` as the row count
190
+ - Rows carry `code`, `name`, and `obligations`; `program_activity` rows add `type`, either `PAC/PAN` or `PARK`
253
191
 
254
192
  ## Features
255
193
 
256
- Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):
257
-
258
- - Declarative tool definitions — single file per tool, framework handles registration and validation
259
- - Unified error handling — handlers throw, framework catches, classifies, and formats
260
- - Pluggable auth: `none`, `jwt`, `oauth`
261
- - Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`
262
- - Structured logging with optional OpenTelemetry tracing
263
- - STDIO and Streamable HTTP transports
194
+ Built on [`@cyanheads/mcp-ts-core`](https://github.com/cyanheads/mcp-ts-core): stdio and Streamable HTTP transports, pluggable auth (`none` / `jwt` / `oauth`), swappable storage (`in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`), structured logging with optional OpenTelemetry tracing.
264
195
 
265
196
  USAspending-specific:
266
197
 
267
- - Full USAspending.gov API v2 coverage — award search, award detail, recipient and agency profiles, spending analytics, disaster spending, and federal accounts
268
- - No authentication required — all data is public domain under the DATA Act
269
- - `usaspending_spending_by_category` consolidates 14 category sub-routes behind a single `category` enum; `usaspending_disaster_spending` consolidates 9+ disaster endpoints behind `dimension` + `spending_type` enums
270
- - `usaspending_get_agency` accepts both `toptier_code` and `agency_slug`, eliminating the intermediate agency-list lookup that award search results would otherwise require
271
- - `usaspending_autocomplete_filters` serves as the code-discovery step before filtering — maps human-readable terms to NAICS, PSC, CFDA, and agency codes
198
+ - USAspending.gov API v2, keyless: the data is public under the DATA Act
199
+ - Award search and the spending analytics tools cover action dates from 2007-10-01 on (an earlier start date fails as `date_before_earliest`), and DoD contract data lags publication by 90 days
200
+ - `usaspending_spending_by_category` puts nine category sub-routes behind one `category` enum, and `usaspending_disaster_spending` puts five disaster endpoints behind `dimension`
201
+ - Each request runs under a per-attempt timeout and a wall-clock retry budget; failures surface as `api_timeout` or `api_unavailable` with each tool's recovery hint, and a rejected request carries USAspending's own explanation in the error message
272
202
 
273
203
  Agent-friendly output:
274
204
 
275
- - Chaining fields on every response — `generated_internal_id`, `agency_slug`, `recipient_hash`, and `account_code` fields are surfaced explicitly so agents can follow the money without parsing identifiers out of display strings
276
- - Pagination metadata on list responses — `page_metadata.has_next` and `page_metadata.page` let agents iterate large result sets without guessing. `page_metadata.total` is carried wherever the upstream endpoint publishes one; `usaspending_get_award_transactions`, `usaspending_get_award_subawards`, and `usaspending_spending_by_category` sit on endpoints that publish none, so `has_next` is the only continuation signal there
277
- - Structured geographic outputs — `shape_code`, `display_name`, `aggregated_amount`, and `per_capita` are typed consistently across state, county, and district views for composable analysis
205
+ - Chaining IDs as explicit fields: `generated_internal_id`, `agency_slug`, `recipient.recipient_id`, `federal_account`, and `account_number`, so agents follow the money without parsing display strings
206
+ - Honest pagination: `page_metadata.has_next` on every list, a `total` or `count` where the upstream publishes one, and `truncated` / `shown` / `cap` when a response is capped
207
+ - Empty results are notices, not errors: an empty page carries a `notice` echoing the filters and how to broaden them. The ID-keyed list tools (transactions, subawards, funding accounts, IDV children, account breakdown) return an empty list for an unknown ID rather than failing
208
+ - Typed failures with recovery hints: `award_not_found`, `recipient_not_found`, `agency_not_found`, `account_not_found`, `no_match`, `date_before_earliest`, `date_range_inverted`, `unsupported_sort`, `assistance_listings_type_mismatch`, `pagination_limit_exceeded`
278
209
 
279
210
  ## Getting started
280
211
 
@@ -295,7 +226,7 @@ A public instance is available at `https://usaspending.caseyjhand.com/mcp` — n
295
226
 
296
227
  ### Self-Hosted / Local
297
228
 
298
- Add the following to your MCP client configuration file. No API key is required — USAspending.gov data is public domain.
229
+ Add the following to your MCP client configuration file. No API key is required.
299
230
 
300
231
  ```json
301
232
  {
@@ -358,8 +289,8 @@ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
358
289
 
359
290
  ### Prerequisites
360
291
 
361
- - [Bun v1.3.0](https://bun.sh/) or higher (or Node.js v24+).
362
- - No API key required — USAspending.gov is a public data platform with no authentication requirement.
292
+ - [Bun v1.4.0](https://bun.sh/) or higher (or Node.js v24+).
293
+ - No API key or account: USAspending.gov is open to anonymous requests.
363
294
 
364
295
  ### Installation
365
296
 
@@ -390,23 +321,21 @@ cp .env.example .env
390
321
 
391
322
  ## Configuration
392
323
 
393
- All configuration is validated at startup via Zod schemas in `src/config/server-config.ts`. No environment variables are required — the defaults work out of the box.
324
+ No variable is required; the defaults work out of the box.
394
325
 
395
326
  | Variable | Description | Default |
396
- |:---------|:------------|:--------|
397
- | `USASPENDING_BASE_URL` | Base URL for the USAspending.gov API. | `https://api.usaspending.gov/api/v2/` |
398
- | `USASPENDING_TIMEOUT_MS` | HTTP timeout in milliseconds, applied per attempt. | `30000` |
399
- | `USASPENDING_RETRY_BUDGET_MS` | Wall-clock budget covering every retry attempt of one request, so a slow endpoint cannot re-pay the per-attempt timeout on each retry. Accepts 1000–300000. | `1.5 × USASPENDING_TIMEOUT_MS` |
327
+ |:---|:---|:---|
328
+ | `USASPENDING_BASE_URL` | USAspending.gov API v2 base URL. | `https://api.usaspending.gov/api/v2/` |
329
+ | `USASPENDING_TIMEOUT_MS` | Per-attempt HTTP timeout, in ms (1000–120000). | `30000` |
330
+ | `USASPENDING_RETRY_BUDGET_MS` | Wall-clock budget for one request across all retry attempts, in ms (1000–300000). | 1.5 × `USASPENDING_TIMEOUT_MS` |
400
331
  | `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |
401
- | `MCP_HTTP_PORT` | Port for the HTTP server. | `3010` |
402
- | `MCP_HTTP_ENDPOINT_PATH` | HTTP endpoint path. | `/mcp` |
403
- | `MCP_SESSION_MODE` | Session mode: `auto`, `stateful`, or `stateless`; `auto` resolves to `stateful`. Shipped as `stateless` in both `.env.example` and the Dockerfile — this server holds no per-session state. | `auto` |
404
- | `MCP_PUBLIC_URL` | Public origin override for TLS-terminating reverse-proxy deployments. | — |
405
- | `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |
332
+ | `MCP_HTTP_PORT` | HTTP server port. | `3010` |
333
+ | `MCP_SESSION_MODE` | HTTP session mode: `stateless`, `stateful`, or `auto`. | `stateless` |
334
+ | `MCP_AUTH_MODE` | Authentication: `none`, `jwt`, or `oauth`. | `none` |
406
335
  | `MCP_LOG_LEVEL` | Log level (`debug`, `info`, `warning`, `error`, etc.). | `info` |
407
336
  | `LOGS_DIR` | Directory for log files (Node.js only). | `<project-root>/logs` |
408
337
  | `STORAGE_PROVIDER_TYPE` | Storage backend: `in-memory`, `filesystem`, `supabase`, `cloudflare-kv/r2/d1`. | `in-memory` |
409
- | `OTEL_ENABLED` | Enable [OpenTelemetry instrumentation](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry). | `false` |
338
+ | `OTEL_ENABLED` | Enable [OpenTelemetry](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry). | `false` |
410
339
 
411
340
  See [`.env.example`](./.env.example) for the full list of optional overrides.
412
341
 
@@ -446,12 +375,12 @@ The Dockerfile defaults to HTTP transport, stateless session mode, and logs to `
446
375
  ## Project structure
447
376
 
448
377
  | Directory | Purpose |
449
- |:----------|:--------|
450
- | `src/index.ts` | `createApp()` entry point — registers tools and inits services. |
378
+ |:---|:---|
379
+ | `src/index.ts` | `createApp()` entry point: registers the tools and initializes the USAspending service. |
451
380
  | `src/config` | Server-specific environment variable parsing and validation with Zod. |
452
- | `src/mcp-server/tools` | Tool definitions (`*.tool.ts`). |
453
- | `src/services` | USAspending API client and service layer. |
454
- | `tests/` | Unit and integration tests mirroring `src/`. |
381
+ | `src/mcp-server/tools/definitions` | Tool definitions (`*.tool.ts`) plus shared filter, date, pagination, and formatting helpers. |
382
+ | `src/services/usaspending` | USAspending.gov API client: request timeouts, retry budget, raw response types. |
383
+ | `tests/` | Unit tests for tools, the service, config, and scripts. |
455
384
 
456
385
  ## Development guide
457
386
 
@@ -459,12 +388,12 @@ See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rule
459
388
 
460
389
  - Handlers throw, framework catches — no `try/catch` in tool logic
461
390
  - Use `ctx.log` for request-scoped logging, `ctx.state` for tenant-scoped storage
462
- - Register new tools via the barrels in `src/mcp-server/tools/definitions/index.ts`
391
+ - Register new tools via the barrel in `src/mcp-server/tools/definitions/index.ts`
463
392
  - Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
464
393
 
465
394
  ## Contributing
466
395
 
467
- Issues and pull requests are welcome. Run checks and tests before submitting:
396
+ Issues are welcome. Run checks and tests before submitting:
468
397
 
469
398
  ```sh
470
399
  bun run devcheck
@@ -0,0 +1,33 @@
1
+ ---
2
+ summary: "Adopts mcp-ts-core ^0.13.6: the framework skill tree moves to framework-skills/, the stateless session posture is declared in src/, and every error-contract entry the service layer throws is marked thrownBy: 'service' while handler-local throws forward their declared recovery hint."
3
+ breaking: false
4
+ security: false
5
+ ---
6
+
7
+ # 0.4.3 — 2026-09-20
8
+
9
+ ## Added
10
+
11
+ - **`AGENTS.md`** — the agent-protocol twin of `CLAUDE.md`, byte-identical and shipped in the npm package. Agents that read `AGENTS.md` were previously left without a protocol file.
12
+ - **`bun run audit:fix`** (`bun audit fix`) — the first step of transitive-advisory triage, ahead of `bun update <name>`, `bun dedupe`, and `audit:refresh`.
13
+
14
+ ## Changed
15
+
16
+ - **The framework skill tree moved from `skills/` to `framework-skills/`.** Claude Code and Codex auto-load a plugin's root `skills/`, so this server's `.claude-plugin/` and `.codex-plugin/` manifests handed its development skills to every agent that installed it. The `.claude/skills/` mirror keeps its name.
17
+ - **`createApp({ sessionMode: 'stateless' })` declares the session posture in `src/`**, where `.env.example`, the `Dockerfile`, and the README table already set it. `MCP_SESSION_MODE` still wins when it carries a meaningful value.
18
+ - **Every `errors[]` entry the service layer produces carries `thrownBy: 'service'`** — `api_unavailable` and `api_timeout` on all 18 tools, which `usaspending-service.ts` throws as `serviceUnavailable(...)` and `timeout(...)`.
19
+ - **Handler-local `ctx.fail` sites forward `ctx.recoveryFor(<reason>)`** instead of restating the declared `recovery` as a divergent inline hint, so one text reaches both the advertised contract and the wire. `usaspending_autocomplete_filters` keeps an explicit hint, which quotes the caller's own `search_text`.
20
+ - **`usaspending_get_agency`'s `missing_input` recovery names `usaspending_list_agencies`** alongside the two accepted argument shapes.
21
+ - **Tool error responses change on three points a client may branch on.** An argument the schema rejects returns `InvalidParams` (`-32602`) where it returned `ValidationError` (`-32007`), carrying `data.reason: "invalid_arguments"` and a hint naming the offending field. Any error whose data carries a `reason` or a boolean `retryable` closes its text with `(reason <reason> · not retryable)`. A USAspending 500 or 501 is `ServiceUnavailable` and is retried, where a 500 previously failed on the first attempt. Match error text by substring rather than byte-exact; `structuredContent` is otherwise unchanged.
22
+ - **Bun engines floor raised to `>=1.4.0`**, required by the framework since 0.12.9.
23
+ - Shipped skills resynced to the framework's current versions, including `add-tool` 2.20 → 2.29, `api-errors` 1.7 → 1.15, `api-linter` 1.12 → 1.17, `release-and-publish` 1.11 → 2.19, and the new `release-pr-review` 1.4.
24
+
25
+ ## Fixed
26
+
27
+ - **A caller-initiated abort classifies as `RequestCancelled` (`-32011`), not `InternalError`** — the framework stopped hand-building an `InternalError` on `fetchWithTimeout`'s external-abort path in 0.12.4. The service's own budget `Timeout` is unaffected; only a caller that went away changes code.
28
+
29
+ ## Dependencies
30
+
31
+ - `@cyanheads/mcp-ts-core` `^0.12.3` → `^0.13.6` — thirteen releases, including the skill-tree move (0.13.0), `sessionMode`/`teardown` on `createApp()` (0.13.1), argument rejections carrying `InvalidParams` with a synthesized recovery hint (0.12.7, 0.13.2, 0.13.3), and the `error-contract-unthrown` / `error-contract-recovery-unforwarded` lint rules (0.13.5, 0.13.6).
32
+ - `zod` `^4.4.3` → `^4.6.5`.
33
+ - `@biomejs/biome` `^2.5.10` → `^2.5.14`, `@types/node` `^26.2.0` → `^26.6.1`, `ignore` `^7.0.6` → `^7.0.9`, `tsc-alias` `^1.9.2` → `^1.9.5`, `vitest` `^4.1.11` → `^5.0.1`.
@@ -0,0 +1,31 @@
1
+ ---
2
+ summary: "Upstream timeouts and outages reach the caller as api_timeout / api_unavailable with each tool's recovery hint, 4xx errors quote upstream's detail, date inputs are validated and half ranges filled, award search sorts by award type group and filters by assistance listing, and disaster breakdowns carry upstream totals."
3
+ breaking: false
4
+ security: false
5
+ ---
6
+
7
+ # 0.4.4 — 2026-09-25
8
+
9
+ ## Changed
10
+
11
+ - **`usaspending_search_awards` `sort` follows the award type group** ([#60](https://github.com/cyanheads/usaspending-mcp-server/issues/60)). Loans sort by `Loan Value` (default), `Subsidy Cost`, `Issued Date`, `Recipient Name`, or `Awarding Agency`; other groups default to `Award Amount`, and IDVs have no `End Date`. Any other pairing fails as `unsupported_sort` before the request, listing the group's sorts.
12
+ - **Loan rows carry `loan_value`, `subsidy_cost`, and `issued_date`** on both `structuredContent` and the text output ([#60](https://github.com/cyanheads/usaspending-mcp-server/issues/60)).
13
+ - **`usaspending_search_awards` `assistance_listings`** filters by Assistance Listing (CFDA) number (`NN.NNN`, e.g. `93.866`, `11.67A`), sent as `program_numbers` and echoed as `applied_assistance_listings` ([#61](https://github.com/cyanheads/usaspending-mcp-server/issues/61)). Paired with contract or IDV codes, including the contract default, it fails as `assistance_listings_type_mismatch`.
14
+ - **`award_type_codes` descriptions list the full group partition** — IDV sub-codes, `F001`–`F010`, and the other-assistance group `09`/`11`/`-1`; an empty flat `award_type_codes` now fails schema validation ([#60](https://github.com/cyanheads/usaspending-mcp-server/issues/60)).
15
+ - **`usaspending_autocomplete_filters` `cfda` descriptions** point at `usaspending_search_awards` `assistance_listings` ([#61](https://github.com/cyanheads/usaspending-mcp-server/issues/61)).
16
+ - **`usaspending_disaster_spending` returns `totals`** — upstream's `obligation`, `outlay`, `total_budgetary_resources` or `award_count` for the whole result set on the agency, cfda, and recipient dimensions — plus per-row `total_budgetary_resources` on the agency dimension under `spending_type: total` ([#63](https://github.com/cyanheads/usaspending-mcp-server/issues/63)). Absent members stay absent; nothing is summed from the page.
17
+ - **Every date input advertises a `YYYY-MM-DD` pattern** on `usaspending_search_awards` and the three `usaspending_spending_*` tools, so a malformed date fails argument validation before any request ([#58](https://github.com/cyanheads/usaspending-mcp-server/issues/58)). Unpadded month and day are accepted and padded before sending; `""` still means no date, so a fully blank `time_period` applies none and one blank side is filled like a lone date.
18
+ - **The three `usaspending_spending_*` tools declare `date_before_earliest`** and reject a start before 2007-10-01 before the request, as `usaspending_search_awards` does. A lone end date before 2007-10-01, once dropped, now fails the same way on all four tools, as does a lone start on these three.
19
+ - **Docs:** the README tool reference and `docs/design.md` cover these changes, and `.env.example` lists `USASPENDING_BASE_URL`, `USASPENDING_TIMEOUT_MS`, and `USASPENDING_RETRY_BUDGET_MS`.
20
+ - **Dev dependencies:** `@socketsecurity/bun-security-scanner` `^1.1.2` → `^1.1.3`, `@types/node` `^26.6.1` → `^26.6.2`.
21
+
22
+ ## Fixed
23
+
24
+ - **Upstream timeouts and outages carry the tool contract on the wire** ([#57](https://github.com/cyanheads/usaspending-mcp-server/issues/57)). Every `Timeout` (budget expiry, exhausted per-attempt timeouts, a 504) is tagged `api_timeout` and every `ServiceUnavailable` (5xx, network, HTML or invalid-JSON body) `api_unavailable`, each with `retryable` and the calling tool's recovery hint.
25
+ - **`usaspending_disaster_spending`'s `api_timeout` recovery names a lever per dimension** — overview points at a later retry or the agency breakdown instead of narrowing it cannot apply, and geography drops `limit` ([#57](https://github.com/cyanheads/usaspending-mcp-server/issues/57)).
26
+ - **A 4xx error message quotes upstream's `detail`** (or `message`, when there is no `detail`), capped at 500 characters: `USAspending rejected <operation> (HTTP <status>): <detail>` ([#58](https://github.com/cyanheads/usaspending-mcp-server/issues/58)). Code and `data.status` are kept.
27
+ - **A US-style start date on `usaspending_search_awards` no longer fails as `date_before_earliest`** — the pattern rejects it by field name, and the floor check compares padded dates ([#58](https://github.com/cyanheads/usaspending-mcp-server/issues/58)).
28
+ - **A lone start or end date is applied, not dropped** ([#62](https://github.com/cyanheads/usaspending-mcp-server/issues/62)). A lone start runs through today (UTC), a lone end from 2007-10-01; `applied_time_period_*` echoes the range sent and a notice names the filled field. On `usaspending_spending_by_geography` a lone date no longer triggers the all-award-types default.
29
+ - **An inverted date range fails as `date_range_inverted` before any request**, naming both fields ([#64](https://github.com/cyanheads/usaspending-mcp-server/issues/64)). It had surfaced as `api_unavailable` from the analytics endpoints and been ignored by award search.
30
+ - **`usaspending_disaster_spending` recipient rows carry one usable `id`** — the recipient-level `-R` entry when upstream sends several, else the first — instead of a comma-joined string ([#65](https://github.com/cyanheads/usaspending-mcp-server/issues/65)).
31
+ - **`usaspending_disaster_spending` `spending_type` describes what upstream honors** — only the agency dimension varies with it.