DEV Community

Cover image for How to give Claude a federal spending research tool with the Apify MCP server
Michael
Michael

Posted on • Originally published at scrapers.lat

How to give Claude a federal spending research tool with the Apify MCP server

Ask Claude how much the U.S. government has paid Booz Allen Hamilton, or which agency signed a contractor's biggest contract, and it will answer from training data that is months or years stale. Federal award records change every day: new obligations, modifications, option exercises, and dissolutions. For competitive intelligence or market research, an answer that is "roughly right for some year" is worse than no answer, because it reads as authoritative.

In this guide we fix that. We connect Claude to the official Apify MCP server, expose a single Actor that reads the U.S. government's official award record on USAspending.gov, and turn "how much has this contractor won?" from a guess into a live lookup against the source of record. By the end you will have a working federal-spending research tool that Claude, Cursor, or any MCP client can call mid-conversation, and you will understand exactly where in the run the tool fires and what it returns.

Everything below is a real setup with real output. No mocked responses.

What is the Apify MCP server?

Model Context Protocol (MCP) is an open standard that lets AI clients call external tools. The Apify MCP server (https://mcp.apify.com) implements that standard on top of the Apify platform, which means every one of the thousands of Actors in the Apify Store becomes a tool an agent can invoke.

Why route an Actor through MCP instead of hard-coding an API call?

  • The agent decides when to fetch. Claude reads the conversation, notices it needs a fact it does not have, and calls the tool on its own. You do not write glue code for every question.
  • Structured input and output. The MCP server hands Claude the Actor's input schema, so the model fills in the parameters correctly, and returns a clean dataset it can reason over.
  • One connection, many tools. The same MCP endpoint exposes search-actors, fetch-actor-details, and call-actor, so an agent can discover and run any Actor without new configuration.
  • No infrastructure. The server is hosted. You add a few lines to a config file and you are done.

The Actor we will use

We will expose the USAspending Federal Award & Contract Scraper. It searches the U.S. government's official award database and returns the full record for each award: recipient name and UEI, award amount and total outlays, awarding and funding agency, NAICS and PSC codes, contract type and competition details, period of performance, place of performance, and subaward totals.

That field set is exactly what govcon competitive intelligence, market research, and investigative reporting need. USAspending is public, authoritative, and covers contracts, grants, loans, and direct payments across every federal agency, so it is a strong first source for any question about where federal dollars go.

The USAspending Federal Award & Contract Scraper on the Apify Store

Step 1: Get your Apify API token

Sign in to the Apify Console, open Settings → Integrations, and copy your personal API token. The MCP server uses it to authenticate and to bill Actor runs to your account.

📌 Note: the token is a secret. Keep it in the client config only, never in a prompt or a committed file.

Step 2: Point Claude Desktop at the Apify MCP server

Open Claude Desktop's config file (Settings → Developer → Edit Config, or ~/Library/Application Support/Claude/claude_desktop_config.json on macOS) and add the Apify server. The tools query parameter is the important part: it tells the server which Actor to expose, so Claude gets one focused tool instead of the entire Store.

{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=scrapers_lat/usaspending-awards-scraper",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Cursor uses the same JSON in .cursor/mcp.json. If you prefer to run it locally over stdio instead of the hosted endpoint:

{
  "mcpServers": {
    "apify": {
      "command": "npx",
      "args": ["-y", "@apify/actors-mcp-server", "--tools", "scrapers_lat/usaspending-awards-scraper"],
      "env": { "APIFY_TOKEN": "YOUR_APIFY_TOKEN" }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Restart Claude Desktop so it picks up the new server.

Step 3: Confirm the tool is loaded

After the restart, the Actor shows up as a callable tool. If you list the tools the Apify server exposes, you will see the storage helpers plus the Actor itself, named after its Store handle:

get-actor-run, get-dataset-items, get-key-value-store-record,
abort-actor-run, scrapers_lat--usaspending-awards-scraper
Enter fullscreen mode Exit fullscreen mode

That last entry, scrapers_lat--usaspending-awards-scraper, is our research tool. Claude now knows it exists, what it does (from the Actor's README), and what inputs it takes (from the input schema the server passes along).

Step 4: Ask Claude to research a contractor

Now the payoff. In a normal chat, ask a question that requires ground truth:

"What are the biggest federal contracts Booz Allen Hamilton has won? Give me the top award with the agency, dollar value, and what the work is."

Claude recognizes it cannot answer this reliably from memory, selects the USAspending tool, and fills in the input from your question. Under the hood the client sends a tools/call with the Actor's parameters:

{
  "name": "scrapers_lat--usaspending-awards-scraper",
  "arguments": {
    "recipient": "Booz Allen Hamilton",
    "awardTypes": ["contracts"],
    "sort": "Award Amount",
    "order": "desc",
    "maxAwards": 8
  }
}
Enter fullscreen mode Exit fullscreen mode

The Apify MCP server starts the Actor, waits for it to finish, and returns the dataset. Here is the real run metadata it produced:

{
  "runId": "CdcLUwb2NkfZYRza5",
  "actorName": "scrapers_lat/usaspending-awards-scraper",
  "status": "SUCCEEDED",
  "startedAt": "2026-07-30T17:47:03.334Z",
  "finishedAt": "2026-07-30T17:47:09.348Z",
  "stats": { "runTimeSecs": 5.9 }
}
Enter fullscreen mode Exit fullscreen mode

Six seconds, live against the official award record.

Step 5: Read the real output

The dataset the tool returns is structured award data. This is an actual record from the run (trimmed to the fields that matter for competitive intelligence):

{
  "recipientName": "BOOZ ALLEN HAMILTON INC",
  "recipientUei": "KHK6E1JW9C15",
  "awardAmount": 1365285599.63,
  "baseAndAllOptions": 1521528358.84,
  "totalOutlays": 1042189081.61,
  "awardingAgency": "Department of Veterans Affairs",
  "awardingOffice": "TECHNOLOGY ACQUISITION CENTER NJ (36C10B)",
  "contractAwardType": "DELIVERY ORDER",
  "naicsCode": "541512",
  "naicsDescription": "COMPUTER SYSTEMS DESIGN SERVICES",
  "description": "TRANSFORMATION TWENTY-ONE TOTAL TECHNOLOGY NEXT GENERATION (T4NG) TASK ORDER - BENEFITS INTEGRATED DELIVERY",
  "startDate": "2021-05-17",
  "endDate": "2026-08-07",
  "extentCompeted": "FULL AND OPEN COMPETITION",
  "numberOfOffersReceived": "6",
  "typeOfContractPricing": "FIRM FIXED PRICE",
  "subawardCount": 21,
  "totalSubawardAmount": 307321597.58,
  "url": "https://www.usaspending.gov/award/CONT_AWD_36C10B21N10070021_3600_VA11816D1007_3600"
}
Enter fullscreen mode Exit fullscreen mode

Claude reads that and answers in plain language: Booz Allen's largest active contract in the record is a $1.37 billion Department of Veterans Affairs delivery order under the T4NG program, a firm-fixed-price computer-systems-design award competed full and open with six offers, running through August 2026, with 21 subawards worth $307 million flowed down to other firms. Every one of those facts is traceable to an official record, with the USAspending award link as evidence, not the model's memory.

Claude calling the USAspending tool and answering with live federal award data

The context those fields carry is the real value. numberOfOffersReceived tells you how competitive a vendor's key contracts actually were; extentCompeted separates open competition from sole-source; totalSubawardAmount and subawardCount reveal how much of the prime's award flows to subcontractors, which is where teaming opportunities live. The model alone would surface none of that.

A real use case: a govcon market-research agent

Put this in context. A business-development analyst at a federal contractor is sizing up a competitor before a recompete and needs to know, on demand:

  1. which agencies buy the most from that competitor,
  2. how large and how competitive their flagship contracts are, and
  3. when those contracts expire, so the recompete window is visible.

Without a tool, the analyst opens USAspending, runs an advanced search, filters by recipient and award type, sorts by amount, and copies fields into a spreadsheet, once per competitor. With the tool wired into Claude, the analyst names the competitors in the chat and asks the agent to profile each one. Claude calls the Actor per recipient, ranks the awards, reads the period-of-performance end dates to flag upcoming recompetes, and produces a short competitive brief with the USAspending award link beside each figure. The manual search step disappears; the analysis stays with the human.

This is the shape of every good agent tool: it removes the mechanical fetch, not the decision.

Going further: chain a second tool

Spending history answers "who won what." The natural follow-up is "what is open right now." The same MCP connection can expose more Actors by extending the tools parameter:

https://mcp.apify.com?tools=scrapers_lat/usaspending-awards-scraper,scrapers_lat/sam-gov-opportunities-scraper
Enter fullscreen mode Exit fullscreen mode

Now the agent can profile a contractor's award history on USAspending and pull live, open solicitations from SAM.gov in the same conversation, then connect the two: it sees a competitor's expiring VA contract, searches SAM.gov for the matching recompete notice, and hands you both in one brief. Because each Actor is a separate tool, the agent picks the right one for each step on its own.

🏹 Troubleshooting: if the tool does not appear in Claude, the two usual causes are a missing or misspelled Actor handle in the tools parameter (it must be the exact username/actor-name from the Store URL) and a config that was edited while Claude was running. Fix the handle, save, and fully restart the client.

📌 Note: each tool call is a real Actor run billed to your Apify account (this Actor is pay-per-result). Keep maxAwards modest for interactive research; if you plan to pull thousands of awards on a schedule, run the Actor directly through the Apify API or a scheduled task instead of one call per chat message.

Wrapping up

You now have an AI agent that can research federal award and contract spending against the official government record, on demand, mid-conversation, with the agency, dollar, competition, and subaward detail a market-intelligence question actually needs. The pattern is reusable: pick an Actor that returns authoritative structured data, expose it through the Apify MCP server with the tools parameter, and let the agent decide when to call it.

To take it further:

  • Query by keyword or agency instead of recipient to map an entire market segment rather than one firm.
  • Add SAM.gov opportunities, entity-registration, or sanctions Actors to build a full govcon research agent.
  • Read the Apify MCP server docs for OAuth setup, resource reads, and the search-actors / call-actor tools that let an agent discover Actors it was not preconfigured with.

The Actor used in this guide: USAspending Federal Award & Contract Scraper.

Top comments (0)