usaspending-mcp-server
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
Public Hosted Server: https://usaspending.caseyjhand.com/mcp
Overview
Where federal money goes, from USAspending.gov: awards, recipients, agencies, and spending. 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.
Tools
Tool | Description |
| List top-tier federal agencies with codes, slugs, and budget totals labelled by reporting year and quarter |
| Look up NAICS, PSC, CFDA, DEF, agency, recipient, or state, county, and district location codes from a free-text description |
| Search awards by keyword, recipient, agency, award type, NAICS code, assistance listing, PSC, DEF code, extent competed, set-aside, contract pricing, location, or date range |
| Fetch one award's full record: amounts, recipient, agencies, codes, competition, parent IDV, DEF-code funding |
| List the transactions (modifications, amendments) on an award |
| List the subcontracts or subgrants under a prime award |
| List the Treasury federal accounts that funded an award, with the amount from each |
| List the child orders and sub-IDVs placed under an IDV |
| Search recipients by name, UEI, or DUNS |
| Fetch a recipient's profile: address, business types, parents, child recipients, and award totals |
| Fetch an agency's mission, latest-year budget totals, budget history by fiscal year, sub-agencies, and DEF codes |
| Aggregate spending by state, county, or congressional district |
| Aggregate spending by NAICS, PSC, agency, CFDA program, recipient, federal account, or DEF code |
| Aggregate spending by fiscal year, quarter, or month |
| Break down disaster and emergency supplemental spending by agency, program, recipient, or geography |
| Search federal accounts by title keyword or agency identifier |
| Fetch a federal account's budget totals and its Treasury Account Symbol components |
| Break a federal account's obligations down by program activity or object class |
Research guide
The usaspending-guide covers recipient research, award-to-account funding traces, and spending comparisons across periods and emergency appropriations. Plugin installs discover it in skills/; MCP clients can read skill://usaspending-guide/SKILL.md through the Skills extension. There are no domain-data resources.
Related MCP server: USASpending MCP Server
Capability reference
usaspending_list_agencies tool
Takes
sort(agency_name,budget_authority_amount,obligated_amount,outlay_amount) andorder; returns every agency unless an optional positivelimitis supplied. Withlimit,pagedefaults to 1; without it,pageis ignored.totalalways counts the full directory andhas_nextappears only when paginatingRows carry
toptier_codeandagency_slug, both accepted byusaspending_get_agency, plusbudget_authority_amount,obligated_amount, andoutlay_amountfor the latest reported period.fiscal_yearandfiscal_quarterpreserve the provider's reporting labels when present
usaspending_autocomplete_filters tool
type(naics,psc,cfda,def_code,awarding_agency,funding_agency,recipient,location) plussearch_text;limitdefault 10, at most 500 per calldef_codematches an exact code or text in the appropriation title or public law, case-insensitively. Rows carrycode,name, andpublic_law/disaster_groupwhen supplied; exact code matches come first. Use the returned code in spending and disaster filtersRows carry
codeandname, anduei/dunsfor recipients; no match fails asno_match. Acfdacode goes inassistance_listingsand apsccode inpsc_codesonusaspending_search_awardsand the three spending analytics toolsawarding_agencyandfunding_agencyrows carry the matched agency's ownname,abbreviation, andtier(toptierorsubtier), its parent'stoptier_nameandtoptier_code, andsubtier_codewhen supplied. Each type searches its own role's directory, and neither directory contains the other: pass anawarding_agencyrow'snametoagency_nameand afunding_agencyrow'snametofunding_agency_nameon award search or spending analytics to match that agency; passtoptier_namefor the whole department. Agency results combine top-tier then sub-tier matches under onelimit; office matches are excludednaicsmatches official NAICS title text: "software" resolves, "cybersecurity" does not, so search with the industry term a title would uselocationmatches US states, then counties, then congressional districts by name. Rows carrykind(state,county, ordistrict), the upstream's uppercasename, andcode: a postal code for a state, the 5-digit state + county FIPS code for a county, the state FIPS + district number (e.g.5307) for a district; county and district rows add thestatepostal code. Upstream returns at most 100 rows of each kind, and a notice says when one hits it. Countries, cities, and ZIP codes are not returned;no_matchnames the three kinds. The freely associated states (FM,MH,PW) and the Minor Outlying Islands (UM) have no upstream state row and get no code. Pass a code tousaspending_search_awardsand the spending analytics location filters, or toshape_codesonusaspending_spending_by_geography
usaspending_search_awards tool
Filters:
keyword,agency_name(awarding),funding_agency_name,recipient_name,naics_codesassistance_listings: Assistance Listing numbers such as93.866, fromusaspending_autocomplete_filterstype: cfdapsc_codes: 1–4 characters, where a prefix such asY1covers the codes under it; contracts and IDVs onlydef_codes: Disaster Emergency Fund Codes such asZ(PSC and DEF codes are sent uppercased)extent_competed_type_codes,set_aside_type_codes,contract_pricing_type_codes: the FPDS codesusaspending_get_awardreturns incompetition.extent_competed.code,competition.type_set_aside.code, andcontract_pricing.code(e.g.C,SBA,J). Each takes 1–8 letters or digits, sent uppercased; several values match any of them, and an unknown code matches nothing. Contracts and IDVs only; award search alone takes them, and the spending analytics tools reject the keystime_period:YYYY-MM-DDfrom 2007-10-01 on; either end may be given alonelocation_filter(place of performance;filters.place_of_performance_locationoverrides it) andfilters.recipient_location(where the recipient is based), each taking:country(defaultUSA; a territory code such asPRIbecomesUSAplus its state),state(a postal or 2-digit FIPS code,FM/MH/PW/UMand armed-forcesAA/AE/APincluded, or under another country its own 2-letter subdivision code such asONwithCAN), andcounty(3 digits withstate, or the 5-digit FIPS code alone); echoed asapplied_locationandapplied_recipient_locationaward_type_codes: defaults to contracts (A–D) and must stay in one group — IDVsIDV_A–IDV_E; grants02–05/F001/F002; direct payments06/10/F006/F007; loans07/08/F003/F004; other assistance09/11/-1/F005/F008/F009/F010limit: default 10, at most 100 per call
Rows carry
generated_internal_idforusaspending_get_award,recipient_idforusaspending_get_recipientandueiwhen upstream has them, andagency_slugforusaspending_get_agency; loan rows carryloan_value,subsidy_cost, andissued_datein place of amounts and dates.page_metadata.total(alsototalCount) counts every match for the call's filters andaward_type_codes, from a best-effort count request; when it fails the total is omitted,unavailable_sectionsnamestotal, andhas_nextis true on any full page. A second best-effort count, sent the same filters withoutaward_type_codes, returnsmatches_by_group(contracts,idvs,grants,direct_payments,loans,other): what a search of each group would find, with a notice naming every other group that has matches, its count, and itsaward_type_codes. The selected group's entry counts the whole group, so it can exceedtotalwhenaward_type_codesname part of it, and a filter only some groups carry (naics_codes,psc_codes, the contract filters,assistance_listings) leaves the others at 0. Both counts run only when the codes resolve to one group, share one 10-second single-attempt deadline, and settle independently: a failure omits that value and namestotalormatches_by_groupinunavailable_sections. The group count is also cut, and named the same way, once it runs 2 seconds past the search and the total count.matches_by_groupis also absent, with nothing disclosed, whenaward_type_codesis the only filter. With a known total,has_nextis exact on page-number paging; a page fetched by cursor keeps the full-page rule. The nestedfiltersobject takes the analytics tools'filterskeys exceptrecipient_id, plusrecipient_nameand the three contract filters, and wins per field over the flat ones. The applied contract codes are echoed asapplied_extent_competed_type_codes,applied_set_aside_type_codes, andapplied_contract_pricing_type_codes. Failures areassistance_listings_type_mismatch(listings with a non-assistance group),psc_codes_type_mismatch(PSC codes with an assistance group),contract_filters_type_mismatch(a contract filter with an assistance group),unsupported_sort,date_range_inverted,date_before_earliest, andinvalid_location(an unknown state, a 3-digit county without a state, a county under an armed-forces code (AA/AE/AP), a county or FIPS-number state under another country, or parts naming different states)sortdepends on the group: loans takeLoan Value(default),Subsidy Cost,Issued Date,Recipient Name, orAwarding Agency; the othersAward Amount(default),Total Outlays,Start Date,End Date(not IDVs),Recipient Name, orAwarding Agency. Page numbers stop at a 50,000-result offset (pagination_limit_exceeded); past it, page with thelast_record_sort_value+last_record_unique_idcursor, returned below a 10,000-result offsetEffective keywords need at least three characters, with whitespace preserved. NAICS codes use 2, 4, or 6 digits; recognized numeric aliases such as
054,+54, and54_15_12are normalized and echoed. Validation runs after nested-filter precedence, so an overridden flat value does not reject the call; active invalid values fail asinvalid_keywordorinvalid_naics_code
usaspending_get_award tool
award_idis agenerated_unique_award_id, thegenerated_internal_idfrom search; an unknown ID fails asaward_not_foundReturns
category,total_obligation,total_outlays,total_account_obligation,total_account_outlay,base_exercised_options,subaward_count, NAICS / PSC codes,account_obligations_by_defc,account_outlays_by_defc, and, on loans,total_loan_valueandtotal_subsidy_cost, where suppliedassistance_listingslists every Assistance Listing on an assistance award, in upstream order, asnumber,title, andobligation; anumbergoes inusaspending_search_awardsassistance_listingsContracts and IDVs also return a
competitionblock (extent_competed,solicitation_procedures,type_set_aside,other_than_full_and_open,fair_opportunity_limited, each a{code, description}, plusnumber_of_offers_received) andcontract_pricing;total_subaward_amountsits besidesubaward_countrecipientcarriesuei,parent_uei,business_categories(category names, not thebusiness_typescodes ofusaspending_get_recipient), and a three-lettercountry_code,county_name,county_code,congressional_code, andzip5on itslocation.place_of_performancealso carries a country code, county name,county_code, and congressional code; a location with no fields upstream is omittedrecipient.executive_compensationlists the recipient's highest-compensated officers asnameandamount, in upstream order, with unreported officers dropped; it describes the recipient, so every award to that recipient carries the same list, and it is absent when none is reportedawarding_agencyandfunding_agencyeach carrytoptier_name,toptier_code,toptier_slug,subtier_name,subtier_code,subtier_abbreviation, andoffice_nameAssistance awards that report cost share also return
non_federal_funding(recipient cost share) andtotal_funding(total_obligationplusnon_federal_funding), zeros kept, and omitted on loans; andfunding_opportunity(number,goals), absent when upstream reports only its placeholdersrecipient.recipient_idandrecipient.parent_recipient_idchain tousaspending_get_recipientandparent_award.generated_unique_award_idto the parent IDV;category: "idv"awards list their children viausaspending_get_idv_awards
usaspending_get_award_transactions tool
award_idplussort(action_date,federal_action_obligation,modification_number);limitdefault 10, at most 5,000 per callRows carry a string
id(ASST_TXorCONT_TX),action_date,modification_number,action_type, and a signedfederal_action_obligation(negative is a deobligation). Loan transactions also carryface_value_loan_guaranteeandoriginal_loan_subsidy_cost; assistance transactions carrycfda_numberwhen supplied
usaspending_get_award_subawards tool
award_idplussort(subaward_number,description,action_date,amount,recipient_name);limitat most 100 per callRows carry
id,subaward_number,description,amount,action_date, andrecipient_name; the upstream listing supplies no recipient UEI or location.subaward_countonusaspending_get_awardsays whether any exist
usaspending_get_award_federal_accounts tool
award_idis agenerated_unique_award_id;limitat most 100 per call, withpage_metadata.countas the totalRows carry
federal_account(AGENCY-MAIN, e.g.080-0120) forusaspending_get_federal_account,total_transaction_obligated_amount, and the funding agency with itsfunding_agency_slug
usaspending_get_idv_awards tool
Parent IDV
award_id;typeischild_awards(task and delivery orders, the default),child_idvs, orgrandchild_awards;limitat most 100 per callsortisobligated_amount(default),award_type,description,funding_agency,awarding_agency,last_date_to_order,period_of_performance_current_end_date,period_of_performance_start_date, orpiidRows carry
generated_unique_award_idforusaspending_get_award,obligated_amount, and performance dates; there is no total, andhas_nextis true on any full page
usaspending_search_recipients tool
keyword(also accepted asname,recipient_name, orsearch_text; an alias sent withkeywordis rejected) matches names, UEI, or DUNS, partial matches included; surrounding whitespace is trimmed, and blank text applies no keyword filter with a notice. Optionalaward_typestill scopes the totals;limitat most 1,000 per callRows carry
id(a hash suffixed-Pparent,-Cchild, or-Rstandalone) forusaspending_get_recipient, plusuei,duns,recipient_level, andamount;page_metadata.totalis the full match countamountis the selected award types' precomputed trailing-12-month obligations;period: "trailing 12 months"labels every page. Snapshot totals can differ from the profile's live trailing-12-month totals
usaspending_get_recipient tool
recipient_idfromusaspending_search_recipientsorusaspending_get_award; optionalfiscal_year(2001–2030 or"all") selects one fiscal year or all available fiscal years. Omission covers the trailing 12 months; an unknown ID fails asrecipient_not_foundReturns address,
business_types,parent_id,parents(parent_id,parent_name,parent_uei,parent_dunsfor each;parent_name/parent_ueidescribe the first),alternate_names,total_transaction_amount,total_transactions, and loan face-value totals, withperiodnaming the window (FY2020,all fiscal years, ortrailing 12 months). Totals span every award type; for totals by type, useusaspending_spending_over_timewithfilters.recipient_idandaward_type_codesA
-Pparent also returnschildren(recipient_id,name,uei,duns,amount,state_province) over the same period, highest amount first, withchildren_total;children_limitdefaults to 50, at most 500 per call. Children come from a best-effort second request: if it fails the profile still returns andunavailable_sectionsnameschildren
usaspending_get_agency tool
One of directory
toptier_code(e.g.097or1601) oragency_slug(e.g.department-of-defense); one- and two-digit numeric codes are padded (80becomes080), while three- and four-digit codes are preserved.pagewalks the sub-agency list 10 at a time. Failures aremissing_input,conflicting_input(both identifiers sent), andagency_not_foundReturns
mission, plusbudgetary_resources_amount,obligated_amount, andoutlay_amountfor the most recentfiscal_yearwith reported budget data (a newly opened year with no amounts yet is skipped),sub_agencieswith obligations and transaction and new-award counts for that same year (sub_agency_fiscal_yearnames it; without a budget year within 5 seconds the breakdown covers the current fiscal year), anddef_codesbudget_by_fiscal_yearlistsbudgetary_resources_amount,obligated_amount,outlay_amount, andreported_through_periodfor every fiscal year with reported data since FY2017, newest first; areported_through_periodbelow 12 is a year to datedef_codes_fiscal_yearidentifies the DEF list's year, aligned with the returned budget year when available. A failed year-specific lookup omits the DEF data and namesdef_codesinunavailable_sections; without a budget year, the overview's DEF year is usedA failed budget or sub-agency request still returns the overview: the missing fields are omitted and
unavailable_sectionsnames each section with itsreason(api_unavailable,api_timeout, orupstream_error) and whether a retry may load it
usaspending_spending_by_geography tool
scope(place_of_performance,recipient_location) andgeo_layer(state,county,district) are required;filterstakeskeywords,award_type_codes,agency_name,funding_agency_name,recipient_id,naics_codes,assistance_listings,psc_codes,def_codes(the same code filters asusaspending_search_awards, echoed asapplied_*),place_of_performance_locationandrecipient_location(the location filters of award search, echoed asapplied_locationandapplied_recipient_location), andtime_period_start/time_period_end(YYYY-MM-DD; either alone fills the other, as inusaspending_search_awards,applied_time_period_*echoes the range sent, a start after the end fails asdate_range_inverted, and a range starting before 2007-10-01 fails asdate_before_earliest);limitdefault 50, no maximumAward types may mix groups. When every one named is a contract or IDV,
assistance_listingsfails asassistance_listings_type_mismatch; when every one is assistance,psc_codesfails aspsc_codes_type_mismatch. Code-filtered amounts cover whole matching awards, and DEF-filtered totals can be negativeAll three analytics tools apply the same keyword and NAICS rules as award search.
recipient_idis a hexadecimal 8-4-4-4-12 hash with uppercase-P,-C, or-R; malformed active IDs fail asinvalid_recipient_id, blank IDs remain unset, and hexadecimal case is normalized inapplied_recipient_id. A well-formed unknown ID returns an empty resultRows carry
shape_code,display_name,aggregated_amount,population, andper_capita, ranked by amount;total_areas_availablecounts every match before the capshape_codes(1–500) returns only the listed areas, in theshape_codeform of the layer: postal code forstate(NY), 5-digit state + county FIPS forcounty(36117), 4-digit state FIPS + district fordistrict(3623). Selection runs over every matched area, so it reaches areas ranked pastlimit; the codes are echoed asapplied_shape_codes, and a code that matches no area is named in thenoticeWith no filters, every award type is aggregated and
applied_award_type_defaultsays so;subawards: trueswitches to subaward data
usaspending_spending_by_category tool
categoryisnaics,psc,awarding_agency,awarding_subagency,funding_agency,funding_subagency,cfda,recipient_duns,federal_account, ordefc; takes the samefiltersobject asusaspending_spending_by_geography;limitat most 100 per callRows carry
id,code,name, andamount, ranked by obligation, with ranks continuing across pages;recipient_dunsrows carry the DUNS ascodeplusrecipient_idandueiwhen upstream has them, andrecipient_idchains tousaspending_get_recipient. The four agency categories addagency_slugforusaspending_get_agency(a subagency row carries its parent department's slug)federal_accountrows carry the AGENCY-MAIN account code ascode, which opensusaspending_get_federal_account;defcrows carry the DEF code ascodeand noid. Both count whole obligations under every account or DEF code an award carries, so rows overlap and never sum to a total, and ondefcdef_codesselects awards while rows still list every code those awards carry
usaspending_spending_over_time tool
groupisfiscal_year,quarter, ormonth(fiscal month, where 1 is October); the samefiltersobject, withaward_type_codesdefaulting to contracts, soassistance_listingsneeds an assistance group named;subawards: trueswitches to subaward dataRows carry
time_period,aggregated_amount, and per-typecontracts,grants,direct_payments,idvs,loans, andotherapplied_award_type_codesnames the scope of every total and breakdown; omitted or empty codes also setapplied_award_type_default: contracts. A zero in an excluded category does not describe that category's spending outside the selected scope
Shared spending scope
Award search and all three spending analytics tools accept funding_agency_name beside the awarding agency_name. Both roles together select their intersection, and each name matches either agency tier. Exact names and unambiguous abbreviations are resolved through agency discovery, each role against its own directory (type=awarding_agency for agency_name, type=funding_agency for funding_agency_name), with no fallback to the other; inconclusive or unavailable lookup preserves the supplied name with an unresolved-name notice naming the role's lookup type. Effective names are echoed as applied_agency_name and applied_funding_agency_name.
Award search, category, and geography disclose when no date filter was supplied and results use USAspending's available coverage. They echo the applied_award_type_codes actually sent; award search also echoes applied_recipient_name. Explicit date bounds retain their existing filling and validation rules.
Analytics using a -P recipient ID disclose that amounts cover awards attributed to that parent. Historical parent attribution can vary. For an entity's own awards, use returned -C or -R IDs; check both if search returns both rather than constructing a new ID by changing a suffix.
usaspending_disaster_spending tool
dimensionisoverview,agency,cfda,recipient, orgeography;filters.def_codesis optional foroverviewand required for every other dimension (missing_def_codeswhen absent/empty). Codes such as["L", "M", "N", "O", "P"]isolate COVID-19 funding and are echoed asapplied_def_codes.limitis at most 100 per call on every dimension butoverview, which ignores it;spending_type(award, the default, ortotal) applies to agency only, and geography takesfilters.geo_layer(state,county)Rows carry
obligation,outlay, andaward_count, plustotal_budgetary_resourceson agency rows underspending_type: total;overviewreturns totals andfunding_by_def_code. A recipient row'sidchains tousaspending_get_recipient. Recipientfilters.querynarrows by search text; it is trimmed and echoed asapplied_query, with blanks applying no query. A recipient total of 10,000 is a reachable ceiling and a lower bound on possible matches, flaggedtruncated; narrow withfilters.queryto reach the tail. Geography areas are ranked byaggregated_amountand paged withlimitandpage, with the full area count astotal; a page with areas below it is flaggedtruncated, andtruncationCeilingis the lowest amount shown. Spending with no recorded place of performance ranks as one unattributed areaAgency, cfda, and recipient also return
totalsacross every matching row:obligation,outlay, and eithertotal_budgetary_resources(agency,total) oraward_count. Overview can still time out with codes supplied: narrowfilters.def_codes, retry later, or use the agency breakdown withspending_type: totalfor obligations, outlays, and budgetary resourcesamount_coverage.statusiscomplete,partial,unavailable, orunknown, with requestedsupported_def_codesandunsupported_def_codeswhen known. Award breakdowns and geography use the provider's COVID-19 grouping for amounts; matching rows and counts may cover other codes. Overview and agencyspending_type: totalcover all requested codes. Retained zeros outside monetary coverage do not mean zero actual spending; an unavailable reference leaves coverageunknownwithout discarding the primary dataAgency, CFDA, and recipient rows rank by obligation before paging. Agency award queries without award-type filters collect the upstream result set before sorting because that upstream path sorts only within a page; the page walk and amount-coverage lookup share one deadline of at most 45 seconds
Notices preserve upstream messages, ignored filters, cap guidance, and empty-page recovery on both output surfaces.
queryis ignored outside recipient,geo_layeroutside geography, andaward_type_codeson overview. An empty page whose offset reaches a positive total directs callers to an earlier page with the same filters; an empty interior page reports the total without claiming exhaustion, and an absent total stays unknown
usaspending_search_federal_accounts tool
Optional
keywordandagency_identifier, using the directorytoptier_codefromusaspending_list_agencies(e.g.1601for Labor). This input differs from the account-prefixagency_identifierin returned rows (016for Labor).sort_fieldisaccount_name,account_number,budgetary_resources(default), ormanaging_agency;limitat most 100 per callRows carry
account_number(e.g.097-8097) for the federal-account tools,managing_agency, andbudgetary_resources;page_metadata.countis the total. Optionalfiscal_yearselects the reporting year; otherwise the provider uses its latest submission year. The returnedfiscal_yearidentifies that period
usaspending_get_federal_account tool
account_codein AGENCY-MAIN format, fromaccount_numberin search results orfederal_accounton an award; an unknown code fails asaccount_not_foundOptional
fiscal_yearselects the reporting year; otherwise the provider uses the current federal fiscal year. Returnstotal_obligated_amount,total_gross_outlay_amount, andtotal_budgetary_resourcesfor the returnedfiscal_year, pluschildren: one entry per Treasury Account Symbol with its own amounts. A year without financial data retains account metadata and a notice, without substituting another year
usaspending_get_federal_account_breakdown tool
account_codeplusdimension(program_activityorobject_class);limitat most 100 per call, withpage_metadata.totalas the row countRows carry
code,name, andobligations;program_activityrows addtype, eitherPAC/PANorPARKOptional
fiscal_yearscopes financial reporting periods to October 1 through September 30, echoed intime_periodandperiod. Omission coversall available periods
All three federal-account tools accept an integer fiscal_year from 2001 through the current federal fiscal year (which rolls over October 1); blank form values mean omitted. Search and detail budget totals use different upstream calculations and need not match even for the same year.
Features
Built on @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.
USAspending-specific:
USAspending.gov API v2, keyless: the data is public under the DATA Act
Award search and the spending analytics tools accept explicit action-date ranges from 2007-10-01 on (an earlier start fails as
date_before_earliest), and DoD contract data lags publication by 90 daysusaspending_spending_by_categoryputs ten category sub-routes behind onecategoryenum, andusaspending_disaster_spendingputs five disaster endpoints behinddimensionEach request runs under one wall-clock budget (45 s by default); a slow answer gets the whole budget in one attempt, and only fast failures are retried. Failures surface as
api_timeoutorapi_unavailablewith each tool's recovery hint, and a rejected request carries USAspending's own explanation in the error message
Agent-friendly output:
Count limits clamp instead of failing: a
limitabove a tool's per-call cap is reduced to the cap and disclosed aslimitClampplus a notice (USASPENDING_CLAMP_LIMITS)Chaining IDs as explicit fields:
generated_internal_id,agency_slug,recipient_id(on award search rows andrecipient.recipient_id),federal_account, andaccount_number, so agents follow the money without parsing display stringsHonest pagination:
page_metadata.has_nexton every list, atotalorcountwhere the upstream publishes one, andtruncated/shown/caponly when rows are known to exist beyond those returned. A full page with no such evidence keepshas_nextwithout claiming truncationEmpty results are notices, not errors: account funding, account breakdown, and recipient search distinguish a known zero total from an empty page past the total, which directs callers to an earlier page with the same filters. Without a total, notices describe only the page; award search supplies one through a best-effort count request and discloses a failed count in
unavailable_sections. The ID-keyed list tools (transactions, subawards, funding accounts, IDV children, account breakdown) return an empty list for an unknown ID rather than failingTyped failures with recovery hints:
award_not_found,recipient_not_found,agency_not_found,account_not_found,no_match,conflicting_input,date_before_earliest,date_range_inverted,unsupported_sort,assistance_listings_type_mismatch,psc_codes_type_mismatch,contract_filters_type_mismatch,invalid_location,pagination_limit_exceeded,incomplete_cursor,missing_def_codes
Getting started
Connect to the hosted instance, no install:
claude mcp add --transport http usaspending-mcp-server https://usaspending.caseyjhand.com/mcpOr run it locally:
claude mcp add usaspending-mcp-server -- npx -y @cyanheads/usaspending-mcp-serverFor other clients, add this to the MCP config file:
{
"mcpServers": {
"usaspending-mcp-server": {
"command": "npx",
"args": ["-y", "@cyanheads/usaspending-mcp-server"]
}
}
}No API key or account is required. For Docker or a source build, see Running the server.
Configuration
No variable is required; the defaults work out of the box.
Variable | Description | Default |
| USAspending.gov API v2 base URL. |
|
| Per-attempt HTTP timeout, in ms (1000–120000). Each attempt is cut at this or at the time left in the request budget, whichever is smaller; a timed-out attempt is not retried. |
|
| Wall-clock budget for one request, every attempt and backoff included, in ms (1000–300000). Fast failures such as a 503 retry inside it. |
|
| A result-count |
|
| Transport: |
|
| HTTP server port. |
|
| HTTP session mode: |
|
| Authentication: |
|
| Log level ( |
|
| Log each failed tool call's arguments and result, redacted by key name and capped at |
|
| Directory for log files (Node.js only). |
|
| Storage backend: |
|
| Enable OpenTelemetry. |
|
| Opt-in OTLP log export endpoint; the base | — |
See .env.example for the full list of optional overrides.
Running the server
Local development
Requires Bun v1.4.4 or higher (or Node.js v24+). No API key or account is required.
git clone https://github.com/cyanheads/usaspending-mcp-server.git
cd usaspending-mcp-server && bun install
cp .env.example .env # optional overridesBuild and run:
# One-time build bun run rebuild # Run the built server bun run start:stdio # or bun run start:httpRun checks and tests:
bun run devcheck # Lint, format, typecheck, security bun run test # Vitest test suite bun run lint:mcp # Validate MCP definitions against spec
Docker
docker run --rm -p 3010:3010 ghcr.io/cyanheads/usaspending-mcp-server:latestThe image defaults to HTTP transport, stateless session mode, and logs to /var/log/usaspending-mcp-server. For stdio, use "command": "docker" with "args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/usaspending-mcp-server:latest"]. Build locally with docker build -t usaspending-mcp-server .; OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
Project structure
Directory | Purpose |
|
|
| Server-specific environment variable parsing and validation with Zod. |
| Tool definitions ( |
| USAspending.gov API client: request timeouts, retry budget, raw response types. |
| Unit tests for tools, the service, config, and scripts. |
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
Handlers throw, framework catches — no
try/catchin tool logicUse
ctx.logfor request-scoped logging,ctx.statefor tenant-scoped storageRegister new tools via the barrel in
src/mcp-server/tools/definitions/index.tsWrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
USAspending MCP — Federal spending data from USAspending.gov API
MCP access to the U.S. federal procurement graph: contracts, opportunities, entities, and more.
Grants.gov search and USAspending grant data. 4 MCP tools for grant discovery.
Query USASpending.gov federal contract awards, grants, and government contractor recipients.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables research of federal contract awards and competitive landscape analysis using the USASpending.gov API. Supports searching for contracts, analyzing recipients, tracking spending trends, and identifying market opportunities in government contracting.2MIT
- AlicenseNot gradedqualityDmaintenanceEnables research of federal contract awards, market opportunities, and competitive landscapes using the USASpending.gov API. It provides specialized tools for AI agents to analyze government spending trends, identify incumbents, and search contractor details.MIT
- AlicenseAqualityBmaintenanceThe most comprehensive keyless federal-data MCP server. 36 tools for SAM.gov + USAspending + Federal Register + eCFR + Grants.gov. No API key, no registration, no signup. Works in Claude Desktop, Claude Code, Codex CLI, Cursor, Continue, Gemini CLI, and any MCP-aware host.153264 npm19MIT
- AlicenseAqualityDmaintenanceRead-only MCP server for exploring US federal spending data via the USAspending.gov API, enabling natural language queries on awards, agencies, recipients, and spending trends.12MIT