Are you the author? Sign in to claim
usaspending-mcp-nextjs
A Model Context Protocol (MCP) server for researching federal contract awards and analyzing the competitive landscape using the USASpending.gov API. Built with Next.js and designed for AI agents to research government contracts, identify incumbents, and analyze market opportunities.
This MCP server provides 8 specialized tools for federal contracting research:
The codebase is organized into a modular structure for maintainability:
src/
├── builders/
│ ├── filter-builder.ts # Centralized filter building logic
│ └── field-mapper.ts # Field name mappings and transformers
├── clients/
│ └── usaspending.ts # API client with retry logic
├── tools/
│ ├── search-awards.ts
│ ├── search-new-awards.ts
│ ├── get-award-details.ts
│ ├── search-recipients.ts
│ ├── get-recipient-details.ts
│ ├── search-idv-awards.ts
│ ├── get-spending-over-time.ts
│ ├── analyze-competition.ts
│ └── index.ts # Tool registration
└── types/
├── award.ts
├── recipient.ts
└── tool-params.ts
npm install
The server requires no API keys - the USASpending.gov API is public. For production deployment on Vercel, you can optionally configure Redis for SSE transport:
KV_REST_API_URL=your-redis-url
npm run dev
The MCP server will be available at http://localhost:3000/mcp
npm run build
npm start
Deploy with:
npx vercel --prod
The repository is configured with:
See vercel.json for configuration details.
Search for federal contract awards with transaction activity during a date range.
Important: Date filtering searches for awards that had ANY transaction activity (modifications, obligations, payments) during the date range - this includes both new awards and existing awards with recent modifications. For finding only newly signed awards, use search_new_awards instead.
Parameters:
keywords - Keywords to search in award descriptionsrecipientName - Contractor/recipient nameagencyName - Awarding agency name (e.g., "Department of Veterans Affairs")naicsCodes - Array of NAICS codes (e.g., ["541511"] for Custom Computer Programming)pscCodes - Product Service Codes (e.g., ["D307"] for IT/Telecom)activityStartDate - Start date (YYYY-MM-DD) for transaction activityactivityEndDate - End date (YYYY-MM-DD) for transaction activityminAmount / maxAmount - Award amount rangestate - State code for place of performanceawardTypeCodes - Award type codes (default: ['A','B','C','D'] for contracts)setAsideTypes - Set aside types (e.g., 'SDVOSBC', '8A', 'WOSB')extentCompeted - Competition codes (e.g., 'A' for full and open)contractPricingTypes - Pricing types (e.g., 'FFPF', 'TM', 'CPFF')limit - Number of results (max 100, default 10)Search for newly awarded contracts by their award date (Action Date). Returns only BASE awards (Modification Number = 0), not modifications to existing awards.
Use this when you need to find contracts that were actually signed/awarded during a specific date range (e.g., "awards signed yesterday", "new contracts this week").
Parameters:
awardStartDate - Start date (YYYY-MM-DD) - earliest award signing dateawardEndDate - End date (YYYY-MM-DD) - defaults to awardStartDate if not providedsearch_awardsGet comprehensive details about a specific award including description, recipient, transactions, sub-awards, and more.
Parameters:
awardId - The generated_unique_award_id (internalId) from search resultsNote: Use the internalId field from search results, NOT the human-readable Award ID (PIID).
Search for contractors/recipients using autocomplete.
Parameters:
search - Search query stringlimit - Number of results (default 10)Get detailed information about a specific recipient including total awards, transaction history, and more.
Parameters:
recipientHash - The recipient hash ID from search resultsFind task orders and child awards under an Indefinite Delivery Vehicle (IDV). Useful for understanding who holds a contract vehicle and who is getting task orders.
Parameters:
awardId - The generated_unique_award_id (internalId) of the parent IDVlimit - Number of results (max 100, default 25)Background: IDVs are contract vehicles like GWACs, GSA Schedules, and BPAs that spawn individual task orders.
Analyze spending trends over time for transaction activity. Returns time-series data grouped by fiscal year, quarter, or month.
Parameters:
search_awardsgroup - How to group data: 'fiscal_year', 'quarter', or 'month' (default: 'fiscal_year')Note: Analyzes transaction activity (when money was obligated), not original award dates.
Analyze the competitive landscape based on transaction activity. Shows who's winning awards/modifications, market shares, and spending patterns.
Parameters:
keywords, agencyName, naicsCodes, pscCodes - Same as search_awardsactivityStartDate / activityEndDate - Date range (defaults to last year)minAmount - Minimum award size to analyzelimit - Number of top recipients to show (default 20)Note: Analyzes transaction activity, which includes both new awards and modifications to existing awards.
The USASpending API has different date concepts that are important to understand:
search_new_awards)search_awards (when any financial activity occurred)The USASpendingClient includes:
The transaction endpoint (search_new_awards) uses different field names than the award endpoint. All field names have been verified against the actual API:
Transaction Fields:
npm run type-check
npm run format
npm run lint:fix
This project is maintained by Agile Six Applications.
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots
Google's universal MCP server supporting PostgreSQL, MySQL, MongoDB, Redis, and 10+ databases
Official GitHub integration for repos, issues, PRs, and CI/CD workflows