USA Spending MCP Server
OfficialClick 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., "@USA Spending MCP Servershow me total spending by NASA in fiscal year 2024"
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.
USA Spending MCP Server
⚠️ DISCLAIMER: This is a proof of concept and is not intended for production use.
An MCP server for interacting with the USAspending.gov API, with optional login.gov authentication for cloud deployment.
Requirements
Python 3.11+
Related MCP server: federal-compass-mcp
Installation
Quick Install
uv tool install git+https://github.com/GSA-TTS/usa-spending-mcp-serverDevelopment Setup
git clone https://github.com/GSA-TTS/usa-spending-mcp-server
cd usa-spending-mcp-server
uv sync --devRunning Modes
The server supports two modes:
Mode | Command | Use Case |
stdio |
| Local use with Claude Desktop |
HTTP |
| Cloud deployment with login.gov auth |
Local Setup (Claude Desktop)
Get the installed tool path:
which usa-spending-mcp-serverAdd to your Claude MCP config (
~/.claude/claude_desktop_config.json):{ "mcpServers": { "usa-spending": { "command": "/path/to/usa-spending-mcp-server" } } }
HTTP Server with Login.gov Authentication
The HTTP server uses login.gov OIDC with PKCE for authentication, suitable for cloud.gov deployment.
Environment Variables
Variable | Required | Description |
| No | Set to |
| If auth enabled | Public URL of the server (e.g., |
| If auth enabled | Your login.gov application client ID |
| If auth enabled | Secret key for signing JWTs (generate with |
| No | OIDC discovery URL (defaults to login.gov sandbox) |
| No | Server port (default: |
Login.gov Setup
Register at partners.login.gov
Create a new OIDC application:
Protocol: OpenID Connect with PKCE (public client)
Redirect URI:
{BASE_URL}/auth/callback
Note your client ID for
LOGINGOV_CLIENT_ID
Running Locally
Without authentication (development):
uv run task devWith authentication:
export BASE_URL=http://localhost:8080
export LOGINGOV_CLIENT_ID=your-client-id
export JWT_SIGNING_KEY=$(python -c "import secrets; print(secrets.token_hex(32))")
uv run task dev-authCloud.gov Deployment
Set environment variables:
cf set-env usa-spending-mcp-server BASE_URL https://usa-spending-mcp.app.cloud.gov cf set-env usa-spending-mcp-server LOGINGOV_CLIENT_ID your-client-id cf set-env usa-spending-mcp-server JWT_SIGNING_KEY your-signing-keyDeploy:
cf push
Development
Available Tasks
uv run task dev # Run HTTP server without auth
uv run task dev-auth # Run HTTP server with auth
uv run task lint # Check code with ruff
uv run task lint-fix # Fix linting issues
uv run task format # Format code with ruff
uv run task test # Run tests
uv run task test-cov # Run tests with coverage
uv run task ci # Run all CI checksCode Quality
This project uses ruff for linting and formatting.
LLM-Based Evals (Optional)
For local testing of tool behavior using mcp-evals:
cd evals
npm install
ANTHROPIC_API_KEY=your-key npm run evalSee evals/README.md for details.
Project Structure
src/
usa_spending_mcp_server/
server.py # stdio MCP server (Claude Desktop)
server_http.py # HTTP server with auth (cloud.gov)
auth.py # login.gov OIDC authentication
tests/ # Python unit tests
evals/ # LLM-based evals (optional)
manifest.yml # cloud.gov deployment config
pyproject.tomlAvailable Tools
3 toolsexecuteB
Chain await call_tool(...) calls in one Python block; prefer returning the final answer from a single block.
Use return to produce output.
Only call_tool(tool_name: str, params: dict) -> Any is available in scope.
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python async code to execute tool calls via call_tool(name, arguments) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description must fully disclose behavior. It mentions that only `call_tool` is available and that `return` produces output, but it omits critical details like execution environment, side effects, timeout, error handling, and security restrictions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three concise sentences with no extraneous content, front-loaded with the core purpose, and every sentence adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite low complexity (one parameter), the description is insufficient for safe usage of arbitrary code execution. It lacks details on output handling, variable scope, error propagation, and security constraints, making it incomplete for an agent to reliably invoke this tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description adds minimal value by detailing the `call_tool` signature and return usage, but it essentially repeats the schema's code description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description explicitly states that the tool executes Python code to chain asynchronous tool calls via the `call_tool` function, distinguishing it from siblings like `get_schema` and `search` which are for single operations or queries.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description advises to 'prefer returning the final answer from a single block' implying a pattern, but it does not explicitly state when to use this tool versus making individual calls or using alternatives, nor does it provide exclusion criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_schemaA
Get parameter schemas for specific tools.
Use after searching to get the detail needed to call a tool.
| Name | Required | Description | Default |
|---|---|---|---|
| tools | Yes | List of tool names to get schemas for | |
| detail | No | 'brief' for names and descriptions, 'detailed' for parameter schemas as markdown, 'full' for complete JSON schemas | detailed |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, and the description does not disclose any behavioral traits such as side effects, authorization needs, or rate limits. For a read-only tool, the description could mention that it is non-destructive, but it remains silent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, no wasted words. Essential information is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Tool is simple, output schema exists, so description doesn't need to explain return values. The description covers the essential usage flow, but slight improvement could mention that it returns JSON schemas.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. Description adds context about using after searching, which helps understand the purpose of the 'tools' parameter, but doesn't add extra meaning beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states the tool gets parameter schemas for specific tools. Verb 'get' and resource 'parameter schemas for specific tools' are specific and distinct from sibling tools like execute, search, and tags.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly states 'Use after searching to get the detail needed to call a tool.' This gives clear context for when to use it, though it doesn't mention when not to use or alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
searchA
Search for available tools by query.
Returns matching tools ranked by relevance.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query to find available tools | |
| tags | No | Filter to tools with any of these tags before searching | |
| detail | No | 'brief' for names and descriptions, 'detailed' for parameter schemas as markdown, 'full' for complete JSON schemas | brief |
| limit | No | Maximum number of results to return |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries full burden. It mentions 'ranked by relevance' but lacks details on read-only nature, authentication, or limits. Basic transparency, but not rich.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, directly states purpose and output. No wasted words; front-loaded with key information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the output schema exists and sibling tools are few, the description is adequate but could clarify what 'available tools' refers to (e.g., tools in this service).
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, baseline 3. The description adds no extra meaning beyond the schema's parameter descriptions (e.g., query, tags, detail, limit).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Search for available tools by query' with a specific verb and resource. It distinguishes well from sibling tools (execute, get_schema) which have different purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit when-to-use or when-not-to-use guidance, but the context of sibling tools implies search is for discovery, not execution or schema retrieval.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.1.0- First observed
execute - First observed
get_schema - First observed
search
TDQS
Scored across 3 tools
The three tools (execute, get_schema, search) have clearly distinct purposes: search finds tools, get_schema retrieves parameter details, and execute runs tools. No overlap.
All tools use lowercase verbs, which is consistent. However, the pattern varies: 'execute' is a standalone verb, while 'get_schema' and 'search' combine verb and noun. Minor deviation from a strict pattern.
With only 3 generic meta-tools and no domain-specific tools for USA Spending, the tool count is extremely insufficient for the server's purported purpose. It should have at least basic query tools for spending data.
The server claims to be about USA Spending but provides no tools to access spending data. The entire domain surface is missing, making it severely incomplete.
Maintenance
Related MCP Connectors
USAspending MCP — Federal spending data from USAspending.gov API
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
MCP server for Modern Treasury — payment orders, transactions, counterparties and ledgers.
Related MCP Servers
- AlicenseBqualityBmaintenanceMCP server for integrating Actual Budget with Claude and other LLM assistants.17610 npm234TypeScriptMIT
- AlicenseAqualityBmaintenanceAn MCP server that connects Claude to the USAJobs API, enabling natural language search for federal jobs, translation of government jargon, CV qualification analysis, and explanation of federal concepts like GS grades and clearances.1068 npm12MIT
- 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
- AlicenseNot gradedqualityDmaintenanceA free, key-less MCP server for querying U.S. federal spending data from USAspending.gov, including contracts, grants, loans, recipients, agencies, and geographic breakdowns.MIT