API & MCP

Everything a person can do on Public Spending Explorer, a program or AI agent can do with the same inputs and get the identical result.

HTTP API

  • POST https://publicspendingexplorer.usefulweb.site/api/v1/calculate – run Public Spending Explorer
  • GET https://publicspendingexplorer.usefulweb.site/api/v1/tool – inputs, output schema, examples
  • OpenAPI 3.1: /openapi.json · /openapi.yaml
  • Errors: application/problem+json; 422 includes per-field errors.

Public Spending Explorer

Searches US federal awards on USAspending.gov (contracts, IDVs, grants, other assistance) or EU contract award notices on TED, then totals the results per agency/buyer and per recipient and draws the agency → recipient relationship graph. Paste a saved API response to analyse it offline.

Inputs of Public Spending Explorer
FieldTypeDefaultDescription
sourceselect (usaspending, ted, pasted)"usaspending"Data source
keywordtext—Keyword. Full-text keyword (award description / notice text).
recipienttext—Recipient / vendor name. Optional. USAspending: recipient_search_text; TED: winner-name contains.
awardTypeselect (contracts, idvs, grants, other_financial_assistance)"contracts"Award type (USAspending)
startDatedate—From. Default: 365 days before today.
endDatedate—To. Default: today.
buyerCountrytext—Buyer country (TED, ISO 3166 alpha-3)
limitinteger50Max results
pastedJsontextarea—Pasted JSON response. Response of USAspending POST /api/v2/search/spending_by_award/ or TED POST /v3/notices/search.

Every result contains

inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.

MCP (Model Context Protocol)

  • Streamable HTTP endpoint: https://publicspendingexplorer.usefulweb.site/mcp – protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake).
  • Tools: public_spending_explorer
  • Local stdio connector: node src/mcp-stdio.ts --tool=public-spending-explorer
{
  "mcpServers": {
    "public-spending-explorer": { "type": "http", "url": "https://publicspendingexplorer.usefulweb.site/mcp" }
  }
}