Repository avatar
Other Tools
v0.2.1
active

fedcontracts

com.adamfreemer/fedcontracts

Federal IT contract awards from USAspending.gov: recent wins, recompetes, company profiles.

Documentation

FedContracts MCP

A remote MCP server that lets an AI assistant (Claude, ChatGPT, Cursor) query federal IT and software contract awards from USAspending.gov.

Contract awards are an early hiring signal. A company that just won a large services contract has to staff it. A contract nearing its final end date is likely to be recompeted, so the incumbent and its competitors both start hiring. FedContracts is for job seekers, contractors looking for work, and small firms doing market research. It answers questions like "who just won work at VA?" or "which DHS contracts end in the next six months?"

Built with Rails 8 and the official mcp Ruby SDK. It is public, read-only, and needs no account or API key.

Architecture

flowchart LR
    USA[("USAspending.gov")]
    subgraph sync ["Daily rake sync (Heroku Scheduler)"]
        S1["AwardSync<br/>search API: spending_by_award"]
        S2["EndDateSync<br/>bulk CSV downloads:<br/>potential end dates, parent companies"]
    end
    DB[("Postgres<br/>agencies, recipients,<br/>awards, sync_runs")]
    MCP["/mcp<br/>4 read-only MCP tools<br/>(stateless Streamable HTTP, JSON)"]
    AI["AI client<br/>Claude, ChatGPT, Cursor"]

    USA --> S1 --> DB
    USA --> S2 --> DB
    DB --> MCP
    AI -- "JSON-RPC over HTTP POST" --> MCP

Hard rule: tool calls never hit USAspending live. They read only from Postgres, so every call returns well under Heroku's 30-second router timeout and keeps working even when USAspending is slow or rate-limiting us. Every response includes data_freshness (the time of the last successful sync).

The sync runs once a day: the last 7 days of awards (the window overlaps so late reports get picked up), then one bulk download that fills potential end dates and parent companies. Requests to USAspending are strictly sequential. GET /health/data returns 503 if the last successful award sync is more than 36 hours old.

Tools

ToolWhat it does
search_awardsSearch awards by keyword, agency, NAICS code, state, minimum amount, set-aside, number of offers, contract vehicle, and services vs. products, filtered by signing date (default last 90 days, up to 10 years).
recent_awardsContracts signed in the last N days at an agency, plus a per-company summary: who just won work and may be staffing up.
expiring_contractsContracts ending in the next N days with the incumbent, each labeled final_period (likely recompete) or options_remaining (likely renewal). Filters by set-aside, number of offers, contract vehicle, and services vs. products. The window can start later (starting_in_days), and results page with offset.
company_profileOne company's totals, top agencies and NAICS codes, top contract vehicles, small-business set-aside share, quarterly trend, recent awards, and soonest-ending awards. Returns candidates if the name is ambiguous.

Results are capped at 50 per call (default 25); search_awards and expiring_contracts page past that with offset / next_offset. Inputs are validated against closed JSON schemas, so bad input comes back as a readable tool error.

Search tip: contract descriptions name programs and missions ("VA.gov platform", "modernization"), almost never languages or frameworks. To find software development work, filter by NAICS instead of tech keywords: 541511 (custom programming), 541512 (systems design and integration), or the prefix 54151 for both plus other computer services. Then work from the winning companies. The tool descriptions tell AI clients the same thing.

Connect

Server URL: https://fedcontracts.adamfreemer.com/mcp

  • Claude.ai / Claude Desktop: Plugins, Add, Custom connector. Paste the server URL and choose "No sign-in" (Claude detects it). The tools show as read-only.
  • Claude Code:
    claude mcp add --transport http fedcontracts https://fedcontracts.adamfreemer.com/mcp
    
  • MCP Inspector: run npx @modelcontextprotocol/inspector, choose Streamable HTTP, and paste the server URL.
  • curl:
    curl -s https://fedcontracts.adamfreemer.com/mcp \
      -H 'Content-Type: application/json' \
      -H 'Accept: application/json, text/event-stream' \
      -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
    

The endpoint is stateless: no sessions, no SSE streams. Each IP is limited to 60 requests a minute.

Example prompts

For job seekers and contractors:

  1. "Who won VA software development contracts in the last month, and who might be staffing up?"
  2. "Which DHS software contractors are growing? Compare their award trends over the last year."
  3. "Which big VA contracts are likely up for recompete in the next 6 months, and who holds them?"
  4. "I'm a Rails developer. Which companies win federal custom-software work, and which of them are hiring?" (pair with a job-search connector)
  5. "Profile Leidos's federal IT work: agencies, totals, and trend."

For market research:

  1. "What's happening with VA's Digital GI Bill (DGIB) contract? When does it end, and who holds it?"
  2. "What HHS IT contracts end in the next 6 months, and who holds them now?"

What the answers show. In testing, Claude chained the tools without being told which ones to use. For DGIB it found Accenture Federal's follow-on order and correctly labeled it options_remaining. Its current period ends 2026-12-29, but an option year runs to 2027-12-29, so the next event is more likely an option renewal than a recompete. On recent awards it told software license resales apart from services contracts that actually mean hiring. With a job-search connector also enabled, it took the companies that win custom software work at VA and searched their open roles by company name.

Data caveats

  • Prime awards only. Subcontractors, who do much of the hiring on large programs, are not included.
  • IT and software only: NAICS 541511, 541512, 541513, 541519, and 518210 (override with SYNC_NAICS). Only contracts with activity in about the last two years are stored.
  • DoD lags about 90 days. Department of Defense data publishes late, so recent DoD awards are sparse. Civilian agencies (DHS, VA, HHS, Treasury) are better for demos.
  • Option and recompete labels. The current end date often isn't the real end. expiring_contracts compares it with the potential end date (all options exercised) from bulk downloads. final_period means the last possible end date falls in the window, options_remaining means it can still be extended, and unknown means the end-date sync hasn't covered that award yet.
  • Set-aside, offers, and vehicle. These come from the bulk downloads. set_aside takes a code (SBA, 8A, SDVOSBC, ...) or small_business for any small-business set-aside. max_offers skips awards with no reported offer count. vehicle matches the parent IDV PIID as a prefix. A null field means not reported, not none. On task orders the set-aside is often recorded on the parent vehicle, so a set-aside filter can miss orders. work_type splits services from products by PSC code (services codes start with a letter), which separates real services work from brand-name resale.
  • Synced daily. Data is as fresh as the last sync. Check data_freshness in each response.
  • Search caveats. Descriptions come from USAspending and are often short. Company names match on the legal name, so acronyms like "GDIT" usually won't match.

Design notes: what I learned

Why not let the AI query USAspending directly? USAspending's search is a POST API, and its website renders in JavaScript. Chat clients' web tools mostly fetch pages with GET, so in Claude.ai or ChatGPT the assistant usually falls back to press releases and news. An agent that can make HTTP calls could use the API, but it would be slow. Searches page 100 records at a time, rate limits hit under load, and the most useful field isn't in the search API at all (next note). Syncing once a day into Postgres makes every tool call fast and predictable, and turns the domain knowledge into tool descriptions the model reads.

The recompete signal needs a second data source. A contract's current end date is often just the end of this option year. The real end, with all options exercised, only appears in USAspending's bulk CSV downloads, which take minutes to generate. The nightly sync joins the two, so expiring_contracts can tell a likely recompete (final_period) from a likely renewal (options_remaining). Doing that live in a tool call wouldn't be possible.

Keywords fail; NAICS works. Contracting officers write the award descriptions. They name programs ("VA.gov platform"), not technologies, so a search for "Ruby" or "React" finds almost nothing. Agencies also code similar work differently: over 180 days, VA had 15 awards of $1M or more under 541511 (custom programming), 23 under 541512, and 151 across the 54151 prefix. The fix was a prefix match on NAICS, plus tool descriptions that tell the model to filter by NAICS and agency and then work from the winning companies.

Contract data says who will hire, not how to apply. USAspending has company names, addresses, and parent companies, but no websites or job listings. The connector is most useful next to a job-search connector: this one finds the companies, and the other finds their openings.

Local development

You need Ruby 3.3.14 and PostgreSQL.

bundle install
bin/rails db:prepare
DAYS=30 bin/rails sync:backfill   # small local dataset, about 3.3k awards
bin/rails server                  # MCP at http://localhost:3000/mcp

onboard.md covers the full backfill, sync tasks, config vars (MCP_ALLOWED_HOSTS, MCP_BEARER_TOKEN, MCP_RATE_LIMIT_PER_MINUTE), and a repo map. CLAUDE.md is the build spec.

Testing

bundle exec rspec
  • Real HTTP is blocked in tests (WebMock). USAspending responses are replayed from recorded VCR cassettes in spec/cassettes/.
  • Query objects run against a FactoryBot dataset modeled on real contracts (examples.md).
  • Request specs cover the MCP protocol end to end: initialize, tools/list, tools/call for each tool, bad input, auth, host checks, and rate limits.
  • GitHub Actions runs RSpec against Postgres, plus RuboCop, Brakeman, and bundler-audit.

Stack

Ruby 3.3, Rails 8.1 (API-only), PostgreSQL with pg_trgm for fuzzy matching, mcp gem 1.11 (official Streamable HTTP transport, stateless JSON mode), Faraday with retries, rack-attack, and RSpec, WebMock, VCR, and FactoryBot. It is hosted on Heroku (web dyno, Heroku Postgres, Heroku Scheduler).

Screenshots

Landing page, showing the connection guide, tools, and live pipeline status:

Landing page, light mode

Dark mode, mobile width:

Landing page, dark mode on mobile

Claude.ai with the connector, asked "Which large VA IT contracts are likely up for recompete in the next 6 months, and who holds them?":

Claude.ai answering a VA recompete question with the Fed Contracts connector: tool calls, a table of final-period contracts with incumbents, and caveats

Data from USAspending.gov. Not affiliated with the U.S. government. MIT licensed; see LICENSE.

No installation packages available.