usaspending-mcp-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@usaspending-mcp-serversearch for federal awards related to cybersecurity"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Public Hosted Server: https://usaspending.caseyjhand.com/mcp
Overview
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.
Tools
Tool | Description |
| List every top-tier federal agency with its toptier code, slug, and current-year budget totals |
| Look up NAICS, PSC, CFDA, agency, or recipient codes from a free-text description |
| Search awards by keyword, recipient, agency, award type, NAICS code, assistance listing, location, or date range |
| Fetch one award's full record: amounts, recipient, agencies, codes, 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, parent, and award totals |
| Fetch an agency's mission, latest-year budget totals, sub-agencies, and DEF codes |
| Aggregate spending by state, county, or congressional district |
| Aggregate spending by NAICS, PSC, agency, CFDA program, or recipient |
| 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 |
Related MCP server: USASpending MCP Server
Capability reference
usaspending_list_agencies tool
Takes only
sort(agency_name,budget_authority_amount,obligated_amount,outlay_amount) andorder; returns every agency in one unpaginated responseRows carry
toptier_codeandagency_slug, both accepted byusaspending_get_agency, plus current-yearbudget_authority_amount,obligated_amount, andoutlay_amount
usaspending_autocomplete_filters tool
type(naics,psc,cfda,awarding_agency,recipient) plussearch_text;limit1–500, default 10Rows carry
codeandname, withidfor agencies anduei/dunsfor recipients; no match fails asno_match. Acfdacode is whatusaspending_search_awardstakes inassistance_listingsnaicsmatches official NAICS title text: "software" resolves, "cybersecurity" does not, so search with the industry term a title would use
usaspending_search_awards tool
Filters:
keyword,agency_name,recipient_name,naics_codes,assistance_listings,time_period, andlocation_filter(country, state, FIPS county, city);award_type_codesdefaults 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, or other assistance09/11/-1/F005/F008/F009/F010.limitup to 100assistance_listingstakes Assistance Listing (CFDA) numbers such as93.866or11.67A— look them up withusaspending_autocomplete_filterstype: cfda— and matches awards carrying any of them. It needs an assistance group inaward_type_codes; with contract or IDV codes, or the contract default, it fails asassistance_listings_type_mismatchsortdepends on the award type group: loans sort byLoan Value(default),Subsidy Cost,Issued Date,Recipient Name, orAwarding Agency; every other group byAward Amount(default),Total Outlays,Start Date,End Date,Recipient Name, orAwarding Agency, except that IDVs have noEnd Date. Any other pairing fails asunsupported_sortwith the group's listDates are
YYYY-MM-DDfrom 2007-10-01 on (month and day may be unpadded). Either end may be given alone, on the nestedfilters.time_period_start/time_period_endor by leaving one side oftime_periodblank ("") — a lone start runs through today (UTC), a lone end from 2007-10-01 — and the response echoes the range sent with anoticenaming the filled field. A fully blanktime_periodmeans no date filter. A start after the end fails asdate_range_invertedRows carry
generated_internal_idforusaspending_get_awardandagency_slugforusaspending_get_agency; loan rows carryloan_value,subsidy_cost, andissued_datein place of amounts and dates. There is no total, andpage_metadata.has_nextis true on any full pagePage numbers stop at a 50,000-result offset (
pagination_limit_exceeded); go further with thelast_record_sort_value+last_record_unique_idcursor, which is only returned below a 10,000-result offset
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,subaward_count, NAICS / PSC or CFDA codes, andaccount_obligations_by_defcrecipient.recipient_idchains 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);limitup to 100Rows carry
action_date,modification_number,action_type, and a signedfederal_action_obligation(negative is a deobligation)
usaspending_get_award_subawards tool
award_idplussort(subaward_number,description,action_date,amount,recipient_name);limitup to 100Rows carry
subaward_number,amount,action_date,recipient_name,recipient_uei, and place of performance;subaward_countonusaspending_get_awardsays whether any exist
usaspending_get_award_federal_accounts tool
award_idis agenerated_unique_award_id;limitup to 100, 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;limitup to 100Rows 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
keywordmatches names, UEI, or DUNS, partial matches included; optionalaward_typescopes the totals;limitup to 100Rows carry
id(a hash suffixed-Pparent,-Cchild, or-Rstandalone) forusaspending_get_recipient, plusuei,duns,recipient_level, andamount;page_metadata.totalis the full match count
usaspending_get_recipient tool
recipient_idfromusaspending_search_recipientsorusaspending_get_award; optionalfiscal_year(2001–2030) andaward_typescope the totals; an unknown ID fails asrecipient_not_foundReturns address,
business_types,parent_name/parent_uei,alternate_names,total_transaction_amount,total_transactions, and loan face-value totals
usaspending_get_agency tool
One of
toptier_code(e.g.097) oragency_slug(e.g.department-of-defense);pagewalks the sub-agency list 10 at a time. Failures aremissing_inputandagency_not_foundReturns
mission, plusbudgetary_resources_amount,obligated_amount, andoutlay_amountfor the latestfiscal_year,sub_agencieswith obligations and transaction and new-award counts, anddef_codes
usaspending_spending_by_geography tool
scope(place_of_performance,recipient_location) andgeo_layer(state,county,district) are required;filterstakeskeywords,award_type_codes,agency_name,recipient_id,naics_codes, 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);limit1–500, default 50Rows carry
shape_code,display_name,aggregated_amount,population,per_capita, andaward_count, ranked by amount;total_areas_availablecounts every match before the capWith 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, orrecipient_parent_duns; takes the samefiltersobject asusaspending_spending_by_geography;limitup to 100Rows carry
id,code,name, andamount, ranked by obligation
usaspending_spending_over_time tool
groupisfiscal_year,quarter, ormonth(fiscal month, where 1 is October); the samefiltersobject, withaward_type_codesdefaulting to contracts and limited to one group;subawards: trueswitches to subaward dataRows carry
time_period,aggregated_amount, and per-typecontracts,grants,direct_payments,idvs,loans, andother
usaspending_disaster_spending tool
dimensionisoverview,agency,cfda,recipient, orgeography; every dimension exceptoverviewrequiresfilters.def_codes(e.g.["L", "M", "N", "O", "P"]for COVID-19);limitup to 100 on agency, cfda, and recipientRows carry
obligation,outlay, andaward_count, plustotal_budgetary_resourceson agency rows underspending_type: total;overviewreturns totals andfunding_by_def_code. A recipient row'sidis one recipient hash forusaspending_get_recipient— the recipient-level-RID when USAspending lists several. The recipient total tops out at 10,000, and a response at that cap is flaggedtruncatedAgency, cfda, and recipient also return
totalsfor every matching row, as USAspending reports them:obligation,outlay, and eithertotal_budgetary_resources(agency,total) oraward_count. When the overview endpoint outlasts the request budget, the agency breakdown withspending_type: totalstill reports obligations, outlays, and budgetary resourcesspending_type(award, the default, ortotal) applies to the agency dimension only — USAspending returns the same recipient breakdown for either value; geography takesfilters.geo_layer(state,county) and always reports obligations
usaspending_search_federal_accounts tool
Optional
keywordand 3-digitagency_identifier;sort_fieldisaccount_name,account_number,budgetary_resources(default), ormanaging_agency;limitup to 100Rows carry
account_number(e.g.097-8097) for the federal-account tools,managing_agency, andbudgetary_resources;page_metadata.countis the total
usaspending_get_federal_account tool
account_codein AGENCY-MAIN format, fromaccount_numberin search results orfederal_accounton an award; an unknown code fails asaccount_not_foundReturns
total_obligated_amount,total_gross_outlay_amount, andtotal_budgetary_resourcesforfiscal_year, pluschildren: one entry per Treasury Account Symbol with its own amounts
usaspending_get_federal_account_breakdown tool
account_codeplusdimension(program_activityorobject_class);limitup to 100, withpage_metadata.totalas the row countRows carry
code,name, andobligations;program_activityrows addtype, eitherPAC/PANorPARK
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 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 daysusaspending_spending_by_categoryputs nine category sub-routes behind onecategoryenum, andusaspending_disaster_spendingputs five disaster endpoints behinddimensionEach request runs under a per-attempt timeout and a wall-clock retry budget; 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:
Chaining IDs as explicit fields:
generated_internal_id,agency_slug,recipient.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/capwhen a response is cappedEmpty results are notices, not errors: an empty page carries a
noticeechoing 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 failingTyped 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
Getting started
Public Hosted Instance
A public instance is available at https://usaspending.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"usaspending-mcp-server": {
"type": "streamable-http",
"url": "https://usaspending.caseyjhand.com/mcp"
}
}
}Self-Hosted / Local
Add the following to your MCP client configuration file. No API key is required.
{
"mcpServers": {
"usaspending-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/usaspending-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with npx (no Bun required):
{
"mcpServers": {
"usaspending-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/usaspending-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with Docker:
{
"mcpServers": {
"usaspending-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"ghcr.io/cyanheads/usaspending-mcp-server:latest"
]
}
}
}For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcpPrerequisites
Bun v1.4.0 or higher (or Node.js v24+).
No API key or account: USAspending.gov is open to anonymous requests.
Installation
Clone the repository:
git clone https://github.com/cyanheads/usaspending-mcp-server.gitNavigate into the directory:
cd usaspending-mcp-serverInstall dependencies:
bun installConfigure environment (optional):
cp .env.example .env
# edit .env if you need to override defaultsConfiguration
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). |
|
| Wall-clock budget for one request across all retry attempts, in ms (1000–300000). | 1.5 × |
| Transport: |
|
| HTTP server port. |
|
| HTTP session mode: |
|
| Authentication: |
|
| Log level ( |
|
| Directory for log files (Node.js only). |
|
| Storage backend: |
|
| Enable OpenTelemetry. |
|
See .env.example for the full list of optional overrides.
Running the server
Local development
Build 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 build -t usaspending-mcp-server .
docker run --rm -p 3010:3010 usaspending-mcp-serverThe Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/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.
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.
US federal contracts, grants, and spending awards
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
- AlicenseAqualityAmaintenanceThe 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.6153484 npm9MIT
- 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