USASpending MCP Server
Enables 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.
README
USASpending MCP Server
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.
Features
This MCP server provides 8 specialized tools for federal contracting research:
- search_awards - Search for federal contract awards with filters for agencies, NAICS/PSC codes, keywords, dates, and more
- search_new_awards - Find newly signed contracts by their award date (action date), excluding modifications
- get_award_details - Get comprehensive details about a specific award
- search_recipients - Search for contractors/recipients with autocomplete
- get_recipient_details - Get detailed information about a specific recipient
- search_idv_awards - Find task orders under Indefinite Delivery Vehicles (IDVs)
- get_spending_over_time - Analyze spending trends over time (by fiscal year, quarter, or month)
- analyze_competition - Analyze competitive landscape showing market shares and top recipients
Architecture
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
Key Design Features
- Centralized Filter Builder: Shared logic for building API filters across tools
- Field Mapper: Manages field name differences between API endpoints (verified against actual API)
- Type Safety: Comprehensive TypeScript types for API requests/responses
- Modular Tools: Each tool in its own file for easy maintenance
- Error Handling: Robust retry logic with exponential backoff for rate limiting
Installation
npm install
Configuration
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
Usage
Development
npm run dev
The MCP server will be available at http://localhost:3000/mcp
Building
npm run build
npm start
Deployment on Vercel
Deploy with:
npx vercel --prod
The repository is configured with:
- 300 second timeout for complex queries
- 1024MB memory allocation
- SSE transport support (requires Redis)
See vercel.json for configuration details.
Tool Reference
search_awards
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_new_awards
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 provided- All other parameters same as
search_awards
get_award_details
Get comprehensive details about a specific award including description, recipient, transactions, sub-awards, and more.
Parameters:
awardId- Thegenerated_unique_award_id(internalId) from search results
Note: Use the internalId field from search results, NOT the human-readable Award ID (PIID).
search_recipients
Search for contractors/recipients using autocomplete.
Parameters:
search- Search query stringlimit- Number of results (default 10)
get_recipient_details
Get detailed information about a specific recipient including total awards, transaction history, and more.
Parameters:
recipientHash- The recipient hash ID from search results
search_idv_awards
Find 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- Thegenerated_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.
get_spending_over_time
Analyze spending trends over time for transaction activity. Returns time-series data grouped by fiscal year, quarter, or month.
Parameters:
- All filter parameters from
search_awards group- 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_competition
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.
Understanding Date Fields
The USASpending API has different date concepts that are important to understand:
- Action Date - When a transaction was executed (used by
search_new_awards) - Activity Period - The time period filter for
search_awards(when any financial activity occurred) - Period of Performance - Start/End dates when the contract work is performed (NOT award dates)
API Client Features
The USASpendingClient includes:
- Rate Limiting Protection: Automatic throttling (100ms between requests)
- Retry Logic: Exponential backoff for 429 rate limit errors (up to 2 retries)
- Error Handling: Detailed logging and error messages
- Timeouts: 90 second timeout for complex queries
- Request Delay: Configurable delay between requests to avoid rate limits
Verified Field Names
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:
- "Award ID", "Recipient Name", "Action Date", "Transaction Amount"
- "Awarding Agency", "Awarding Sub Agency"
- "Transaction Description", "Mod" (modification number)
- "naics_code", "naics_description", "product_or_service_code", "product_or_service_description"
Development
Type Checking
npm run type-check
Formatting
npm run format
Linting
npm run lint:fix
Resources
- USASpending API Documentation
- MCP TypeScript SDK
- Vercel MCP Adapter (mcp-handler)
- Model Context Protocol Specification
Notes
- The USASpending API can be slow for complex queries (90+ seconds for large result sets)
- No API key required - the API is public
- The server uses SSE transport when Redis is configured (required for Vercel)
- Fluid compute is recommended for efficient execution on Vercel
License
This project is maintained by Agile Six Applications.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。