Skip to main content

This is an MCP server to interact with the USASPENDING.gov API

Project description

USA Spending MCP Server

This is a stateless streamable HTTP MCP server for interacting with USASPENDING.gov, the official source of government spending data. You can track government spending over time, search government spending by agency, explore government spending to communities, and much more. USASPENDING.gov provides this neat dashboard which shows some of the powers of the API should you want a high level overview of what you can achieve with this API. The API docs can be viewed at this URL.

Running Locally

uv run server.py

Using with Claude Desktop

Update your claude_desktop_config.json with the following configuration.

{
  "mcpServers": {
    "usaspending": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:8000/mcp"
      ]
    }
  }
}

Using with Cursor

Update the mcp.json file with the following configuration.

{
  "mcpServers": {
    "usaspending": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

Tools

Name Description Example prompts
federal_accounts This returns a list of federal accounts, their number, name, managing agency, and budgetary resources - How many federal accounts are there?
list_budget_functions This retrieves a list of all Budget Functions ordered by their title - What are the budget functions?
major_object_class This data can be used to better understand the different ways that a specific agency spends money - What are the various ways the Department of Education spends money?
recipient This can be used to visualize the government spending that pertains to a specific recipient. This returns a list of recipients, their level, DUNS, UEI, and amount. - What are some companies that received funding from the NSA?
spending This data can be used to drill down into specific subsets of data by level of detail. This data represents all government spending in the specified time period, grouped by the data type of your choice. - What was some spending related to International Affairs?
spending_by_award This allows for complex filtering for specific subsets of spending data. This accepts filters and fields, and returns the fields of the filtered awards. - What was the largest award in 2025?
- What are some companies that received major federal contracts in Lindsey Graham's district?
subawards This returns a filtered set of subawards - Describe some of the subawards for CONT_AWD_FA870221C0001_9700_-NONE-_-NONE- and provide a rationale for them.
total_budgetary_resources This is used to provide information on the federal budgetary resources of the government - What was the government budget in 2025 vs 2024?
- How much money does the federal government provide in total to various government agencies?
toptier_agencies This data can be used to better understand the different ways that a specific agency spends money - Which federal agency receives the most money?

tools directory explained

This is a big API with a lot of routes so all tools are organized in the tools directory. There is a md file for each tool so it is convenient to reference the documentation used to create the tool. Currently, all contracts (aka API documentation) are referenced from commit dv551d0 of the usaspending-api. At the moment, each tool is manually created using the contract documentation as a reference. The current plan is to make all API routes available to this MCP server. In the future, the process of copying a contract over and using it to create a new tool will be automated.

Testing

MCP Inspector is a good way to test the input and output schema without connecting to a LLM. There is also a sample MCP Client to test the application using OpenAI.

Contributing

Please see the testing section as a starting point to test your changes before submitting a PR. If you are adding a new tool, please also add a copy of the respective contract used as a reference to create the inputSchema and outputSchema. Please add the tool to the same path that it exists in the usaspending_api contacts directory. For file naming convention refer to the contract file name and name the tool this as well. For example, if you are creating a tool for the v2/disaster/spending_by_geography.md API route this tool should be added with under the path tools/v2/disaster/spending_by_geography.py and the tool should be named disaster_spending_by_geography. Should there be any objections to this please explain why in the PR as it is not bullet proof!

License

USA Spending MCP Server is licensed under GNU AGPLv3.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

usaspending_mcp_server-0.1.0.tar.gz (70.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

usaspending_mcp_server-0.1.0-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

Details for the file usaspending_mcp_server-0.1.0.tar.gz.

File metadata

File hashes

Hashes for usaspending_mcp_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 517f21d0a6f58a7bac2f606fe422e9e9b14e42973b6e6df2d669dc998d5b4dd0
MD5 35ed5683844fe2e8bfd3021b8e52a842
BLAKE2b-256 3fb8cfe8069db597eeb6ecbc48c521f5a6ad4759e454eb0caee673e897b6ada0

See more details on using hashes here.

File details

Details for the file usaspending_mcp_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for usaspending_mcp_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08c43ad76ffef638ddc975a2a279d0f931d44afd41e4280cb421f80b5cd5ae3f
MD5 05ccfdbce822d11fb1e1d93123614ce6
BLAKE2b-256 45f424000673c4827a320280960150b12b0c45322b9585e7609a9e91180af3e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page