us-gov-open-data-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +211 -0
- package/dist/client.d.ts +54 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +388 -0
- package/dist/client.js.map +1 -0
- package/dist/instructions.d.ts +8 -0
- package/dist/instructions.d.ts.map +1 -0
- package/dist/instructions.js +549 -0
- package/dist/instructions.js.map +1 -0
- package/dist/modules/bea.d.ts +28 -0
- package/dist/modules/bea.d.ts.map +1 -0
- package/dist/modules/bea.js +158 -0
- package/dist/modules/bea.js.map +1 -0
- package/dist/modules/bls.d.ts +29 -0
- package/dist/modules/bls.d.ts.map +1 -0
- package/dist/modules/bls.js +244 -0
- package/dist/modules/bls.js.map +1 -0
- package/dist/modules/bts.d.ts +26 -0
- package/dist/modules/bts.d.ts.map +1 -0
- package/dist/modules/bts.js +112 -0
- package/dist/modules/bts.js.map +1 -0
- package/dist/modules/cdc.d.ts +26 -0
- package/dist/modules/cdc.d.ts.map +1 -0
- package/dist/modules/cdc.js +310 -0
- package/dist/modules/cdc.js.map +1 -0
- package/dist/modules/census.d.ts +23 -0
- package/dist/modules/census.d.ts.map +1 -0
- package/dist/modules/census.js +141 -0
- package/dist/modules/census.js.map +1 -0
- package/dist/modules/cfpb.d.ts +20 -0
- package/dist/modules/cfpb.d.ts.map +1 -0
- package/dist/modules/cfpb.js +135 -0
- package/dist/modules/cfpb.js.map +1 -0
- package/dist/modules/clinical-trials.d.ts +22 -0
- package/dist/modules/clinical-trials.d.ts.map +1 -0
- package/dist/modules/clinical-trials.js +171 -0
- package/dist/modules/clinical-trials.js.map +1 -0
- package/dist/modules/cms.d.ts +21 -0
- package/dist/modules/cms.d.ts.map +1 -0
- package/dist/modules/cms.js +135 -0
- package/dist/modules/cms.js.map +1 -0
- package/dist/modules/college-scorecard.d.ts +39 -0
- package/dist/modules/college-scorecard.d.ts.map +1 -0
- package/dist/modules/college-scorecard.js +192 -0
- package/dist/modules/college-scorecard.js.map +1 -0
- package/dist/modules/congress.d.ts +28 -0
- package/dist/modules/congress.d.ts.map +1 -0
- package/dist/modules/congress.js +883 -0
- package/dist/modules/congress.js.map +1 -0
- package/dist/modules/dol.d.ts +27 -0
- package/dist/modules/dol.d.ts.map +1 -0
- package/dist/modules/dol.js +209 -0
- package/dist/modules/dol.js.map +1 -0
- package/dist/modules/eia.d.ts +33 -0
- package/dist/modules/eia.d.ts.map +1 -0
- package/dist/modules/eia.js +227 -0
- package/dist/modules/eia.js.map +1 -0
- package/dist/modules/epa.d.ts +21 -0
- package/dist/modules/epa.d.ts.map +1 -0
- package/dist/modules/epa.js +91 -0
- package/dist/modules/epa.js.map +1 -0
- package/dist/modules/fbi.d.ts +28 -0
- package/dist/modules/fbi.d.ts.map +1 -0
- package/dist/modules/fbi.js +143 -0
- package/dist/modules/fbi.js.map +1 -0
- package/dist/modules/fda.d.ts +35 -0
- package/dist/modules/fda.d.ts.map +1 -0
- package/dist/modules/fda.js +262 -0
- package/dist/modules/fda.js.map +1 -0
- package/dist/modules/fdic.d.ts +21 -0
- package/dist/modules/fdic.d.ts.map +1 -0
- package/dist/modules/fdic.js +186 -0
- package/dist/modules/fdic.js.map +1 -0
- package/dist/modules/fec.d.ts +29 -0
- package/dist/modules/fec.d.ts.map +1 -0
- package/dist/modules/fec.js +282 -0
- package/dist/modules/fec.js.map +1 -0
- package/dist/modules/federal-register.d.ts +24 -0
- package/dist/modules/federal-register.d.ts.map +1 -0
- package/dist/modules/federal-register.js +184 -0
- package/dist/modules/federal-register.js.map +1 -0
- package/dist/modules/fema.d.ts +20 -0
- package/dist/modules/fema.d.ts.map +1 -0
- package/dist/modules/fema.js +156 -0
- package/dist/modules/fema.js.map +1 -0
- package/dist/modules/fred.d.ts +40 -0
- package/dist/modules/fred.d.ts.map +1 -0
- package/dist/modules/fred.js +143 -0
- package/dist/modules/fred.js.map +1 -0
- package/dist/modules/govinfo.d.ts +24 -0
- package/dist/modules/govinfo.d.ts.map +1 -0
- package/dist/modules/govinfo.js +147 -0
- package/dist/modules/govinfo.js.map +1 -0
- package/dist/modules/hud.d.ts +17 -0
- package/dist/modules/hud.d.ts.map +1 -0
- package/dist/modules/hud.js +170 -0
- package/dist/modules/hud.js.map +1 -0
- package/dist/modules/naep.d.ts +27 -0
- package/dist/modules/naep.d.ts.map +1 -0
- package/dist/modules/naep.js +210 -0
- package/dist/modules/naep.js.map +1 -0
- package/dist/modules/nhtsa.d.ts +13 -0
- package/dist/modules/nhtsa.d.ts.map +1 -0
- package/dist/modules/nhtsa.js +196 -0
- package/dist/modules/nhtsa.js.map +1 -0
- package/dist/modules/noaa.d.ts +41 -0
- package/dist/modules/noaa.d.ts.map +1 -0
- package/dist/modules/noaa.js +135 -0
- package/dist/modules/noaa.js.map +1 -0
- package/dist/modules/nrel.d.ts +25 -0
- package/dist/modules/nrel.d.ts.map +1 -0
- package/dist/modules/nrel.js +87 -0
- package/dist/modules/nrel.js.map +1 -0
- package/dist/modules/regulations.d.ts +24 -0
- package/dist/modules/regulations.d.ts.map +1 -0
- package/dist/modules/regulations.js +173 -0
- package/dist/modules/regulations.js.map +1 -0
- package/dist/modules/sec.d.ts +25 -0
- package/dist/modules/sec.d.ts.map +1 -0
- package/dist/modules/sec.js +192 -0
- package/dist/modules/sec.js.map +1 -0
- package/dist/modules/senate-lobbying.d.ts +21 -0
- package/dist/modules/senate-lobbying.d.ts.map +1 -0
- package/dist/modules/senate-lobbying.js +189 -0
- package/dist/modules/senate-lobbying.js.map +1 -0
- package/dist/modules/treasury.d.ts +23 -0
- package/dist/modules/treasury.d.ts.map +1 -0
- package/dist/modules/treasury.js +234 -0
- package/dist/modules/treasury.js.map +1 -0
- package/dist/modules/usaspending.d.ts +19 -0
- package/dist/modules/usaspending.d.ts.map +1 -0
- package/dist/modules/usaspending.js +204 -0
- package/dist/modules/usaspending.js.map +1 -0
- package/dist/modules/usda-fooddata.d.ts +24 -0
- package/dist/modules/usda-fooddata.d.ts.map +1 -0
- package/dist/modules/usda-fooddata.js +118 -0
- package/dist/modules/usda-fooddata.js.map +1 -0
- package/dist/modules/usda-nass.d.ts +46 -0
- package/dist/modules/usda-nass.d.ts.map +1 -0
- package/dist/modules/usda-nass.js +151 -0
- package/dist/modules/usda-nass.js.map +1 -0
- package/dist/modules/usgs.d.ts +21 -0
- package/dist/modules/usgs.d.ts.map +1 -0
- package/dist/modules/usgs.js +203 -0
- package/dist/modules/usgs.js.map +1 -0
- package/dist/modules/uspto.d.ts +13 -0
- package/dist/modules/uspto.d.ts.map +1 -0
- package/dist/modules/uspto.js +157 -0
- package/dist/modules/uspto.js.map +1 -0
- package/dist/modules/world-bank.d.ts +21 -0
- package/dist/modules/world-bank.d.ts.map +1 -0
- package/dist/modules/world-bank.js +130 -0
- package/dist/modules/world-bank.js.map +1 -0
- package/dist/prompts.d.ts +12 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +858 -0
- package/dist/prompts.js.map +1 -0
- package/dist/sdk/bea.d.ts +111 -0
- package/dist/sdk/bea.d.ts.map +1 -0
- package/dist/sdk/bea.js +242 -0
- package/dist/sdk/bea.js.map +1 -0
- package/dist/sdk/bls.d.ts +65 -0
- package/dist/sdk/bls.d.ts.map +1 -0
- package/dist/sdk/bls.js +203 -0
- package/dist/sdk/bls.js.map +1 -0
- package/dist/sdk/bts.d.ts +108 -0
- package/dist/sdk/bts.d.ts.map +1 -0
- package/dist/sdk/bts.js +121 -0
- package/dist/sdk/bts.js.map +1 -0
- package/dist/sdk/cdc.d.ts +105 -0
- package/dist/sdk/cdc.d.ts.map +1 -0
- package/dist/sdk/cdc.js +222 -0
- package/dist/sdk/cdc.js.map +1 -0
- package/dist/sdk/census.d.ts +47 -0
- package/dist/sdk/census.d.ts.map +1 -0
- package/dist/sdk/census.js +99 -0
- package/dist/sdk/census.js.map +1 -0
- package/dist/sdk/cfpb.d.ts +148 -0
- package/dist/sdk/cfpb.d.ts.map +1 -0
- package/dist/sdk/cfpb.js +153 -0
- package/dist/sdk/cfpb.js.map +1 -0
- package/dist/sdk/clinical-trials.d.ts +214 -0
- package/dist/sdk/clinical-trials.d.ts.map +1 -0
- package/dist/sdk/clinical-trials.js +134 -0
- package/dist/sdk/clinical-trials.js.map +1 -0
- package/dist/sdk/cms.d.ts +81 -0
- package/dist/sdk/cms.d.ts.map +1 -0
- package/dist/sdk/cms.js +227 -0
- package/dist/sdk/cms.js.map +1 -0
- package/dist/sdk/college-scorecard.d.ts +63 -0
- package/dist/sdk/college-scorecard.d.ts.map +1 -0
- package/dist/sdk/college-scorecard.js +131 -0
- package/dist/sdk/college-scorecard.js.map +1 -0
- package/dist/sdk/congress.d.ts +575 -0
- package/dist/sdk/congress.d.ts.map +1 -0
- package/dist/sdk/congress.js +659 -0
- package/dist/sdk/congress.js.map +1 -0
- package/dist/sdk/dol.d.ts +299 -0
- package/dist/sdk/dol.d.ts.map +1 -0
- package/dist/sdk/dol.js +252 -0
- package/dist/sdk/dol.js.map +1 -0
- package/dist/sdk/eia.d.ts +91 -0
- package/dist/sdk/eia.d.ts.map +1 -0
- package/dist/sdk/eia.js +156 -0
- package/dist/sdk/eia.js.map +1 -0
- package/dist/sdk/epa.d.ts +128 -0
- package/dist/sdk/epa.d.ts.map +1 -0
- package/dist/sdk/epa.js +120 -0
- package/dist/sdk/epa.js.map +1 -0
- package/dist/sdk/fbi.d.ts +48 -0
- package/dist/sdk/fbi.d.ts.map +1 -0
- package/dist/sdk/fbi.js +69 -0
- package/dist/sdk/fbi.js.map +1 -0
- package/dist/sdk/fda.d.ts +356 -0
- package/dist/sdk/fda.d.ts.map +1 -0
- package/dist/sdk/fda.js +162 -0
- package/dist/sdk/fda.js.map +1 -0
- package/dist/sdk/fdic.d.ts +227 -0
- package/dist/sdk/fdic.d.ts.map +1 -0
- package/dist/sdk/fdic.js +172 -0
- package/dist/sdk/fdic.js.map +1 -0
- package/dist/sdk/fec.d.ts +142 -0
- package/dist/sdk/fec.d.ts.map +1 -0
- package/dist/sdk/fec.js +92 -0
- package/dist/sdk/fec.js.map +1 -0
- package/dist/sdk/federal-register.d.ts +88 -0
- package/dist/sdk/federal-register.d.ts.map +1 -0
- package/dist/sdk/federal-register.js +100 -0
- package/dist/sdk/federal-register.js.map +1 -0
- package/dist/sdk/fema.d.ts +137 -0
- package/dist/sdk/fema.d.ts.map +1 -0
- package/dist/sdk/fema.js +197 -0
- package/dist/sdk/fema.js.map +1 -0
- package/dist/sdk/fred.d.ts +72 -0
- package/dist/sdk/fred.d.ts.map +1 -0
- package/dist/sdk/fred.js +59 -0
- package/dist/sdk/fred.js.map +1 -0
- package/dist/sdk/govinfo.d.ts +64 -0
- package/dist/sdk/govinfo.d.ts.map +1 -0
- package/dist/sdk/govinfo.js +187 -0
- package/dist/sdk/govinfo.js.map +1 -0
- package/dist/sdk/hud.d.ts +87 -0
- package/dist/sdk/hud.d.ts.map +1 -0
- package/dist/sdk/hud.js +91 -0
- package/dist/sdk/hud.js.map +1 -0
- package/dist/sdk/index.d.ts +51 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +51 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/naep.d.ts +93 -0
- package/dist/sdk/naep.d.ts.map +1 -0
- package/dist/sdk/naep.js +163 -0
- package/dist/sdk/naep.js.map +1 -0
- package/dist/sdk/nhtsa.d.ts +169 -0
- package/dist/sdk/nhtsa.d.ts.map +1 -0
- package/dist/sdk/nhtsa.js +102 -0
- package/dist/sdk/nhtsa.js.map +1 -0
- package/dist/sdk/noaa.d.ts +72 -0
- package/dist/sdk/noaa.d.ts.map +1 -0
- package/dist/sdk/noaa.js +64 -0
- package/dist/sdk/noaa.js.map +1 -0
- package/dist/sdk/nrel.d.ts +145 -0
- package/dist/sdk/nrel.d.ts.map +1 -0
- package/dist/sdk/nrel.js +93 -0
- package/dist/sdk/nrel.js.map +1 -0
- package/dist/sdk/regulations.d.ts +146 -0
- package/dist/sdk/regulations.d.ts.map +1 -0
- package/dist/sdk/regulations.js +103 -0
- package/dist/sdk/regulations.js.map +1 -0
- package/dist/sdk/sec.d.ts +114 -0
- package/dist/sdk/sec.d.ts.map +1 -0
- package/dist/sdk/sec.js +151 -0
- package/dist/sdk/sec.js.map +1 -0
- package/dist/sdk/senate-lobbying.d.ts +147 -0
- package/dist/sdk/senate-lobbying.d.ts.map +1 -0
- package/dist/sdk/senate-lobbying.js +125 -0
- package/dist/sdk/senate-lobbying.js.map +1 -0
- package/dist/sdk/treasury.d.ts +59 -0
- package/dist/sdk/treasury.d.ts.map +1 -0
- package/dist/sdk/treasury.js +1397 -0
- package/dist/sdk/treasury.js.map +1 -0
- package/dist/sdk/usaspending.d.ts +126 -0
- package/dist/sdk/usaspending.d.ts.map +1 -0
- package/dist/sdk/usaspending.js +270 -0
- package/dist/sdk/usaspending.js.map +1 -0
- package/dist/sdk/usda-fooddata.d.ts +112 -0
- package/dist/sdk/usda-fooddata.d.ts.map +1 -0
- package/dist/sdk/usda-fooddata.js +80 -0
- package/dist/sdk/usda-fooddata.js.map +1 -0
- package/dist/sdk/usda-nass.d.ts +75 -0
- package/dist/sdk/usda-nass.d.ts.map +1 -0
- package/dist/sdk/usda-nass.js +83 -0
- package/dist/sdk/usda-nass.js.map +1 -0
- package/dist/sdk/usgs.d.ts +221 -0
- package/dist/sdk/usgs.d.ts.map +1 -0
- package/dist/sdk/usgs.js +182 -0
- package/dist/sdk/usgs.js.map +1 -0
- package/dist/sdk/uspto.d.ts +109 -0
- package/dist/sdk/uspto.d.ts.map +1 -0
- package/dist/sdk/uspto.js +286 -0
- package/dist/sdk/uspto.js.map +1 -0
- package/dist/sdk/world-bank.d.ts +78 -0
- package/dist/sdk/world-bank.d.ts.map +1 -0
- package/dist/sdk/world-bank.js +72 -0
- package/dist/sdk/world-bank.js.map +1 -0
- package/dist/server.d.ts +22 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +196 -0
- package/dist/server.js.map +1 -0
- package/package.json +113 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* USAspending MCP module — tools + metadata. Delegates all API calls to sdk/usaspending.
|
|
3
|
+
*
|
|
4
|
+
* Tools return raw JSON data — no markdown formatting. The client decides how to present it.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { searchAwards, spendingByAgency, spendingByState, topRecipients, spendingOverTime, agencyOverview, currentFiscalYear, awardTypes, agencyCodes, } from "../sdk/usaspending.js";
|
|
8
|
+
// ─── Metadata (server.ts reads these) ────────────────────────────────
|
|
9
|
+
export const name = "usaspending";
|
|
10
|
+
export const displayName = "USAspending";
|
|
11
|
+
export const description = "Federal contracts, grants, loans, direct payments — who got the money and where";
|
|
12
|
+
export const workflow = "search awards by keyword/agency/state → drill into recipients or trends";
|
|
13
|
+
export const tips = "No API key required. Data updates nightly. Earliest data: FY2008 (2007-10-01).";
|
|
14
|
+
export const reference = {
|
|
15
|
+
awardTypes,
|
|
16
|
+
agencyCodes,
|
|
17
|
+
};
|
|
18
|
+
// ─── Tools ───────────────────────────────────────────────────────────
|
|
19
|
+
export const tools = [
|
|
20
|
+
{
|
|
21
|
+
name: "usa_spending_by_award",
|
|
22
|
+
description: "Search federal spending awards (contracts, grants, loans, direct payments). " +
|
|
23
|
+
"Filter by keyword, agency, recipient, date range, award type, and amount.\n\n" +
|
|
24
|
+
"Award type groups: 'contracts', 'grants', 'loans', 'direct_payments'. " +
|
|
25
|
+
"Or use codes: 'A,B,C,D' (contracts), '02,03,04,05' (grants), '07,08' (loans), '06,10' (direct payments)",
|
|
26
|
+
annotations: { title: "USAspending: Search Awards", readOnlyHint: true },
|
|
27
|
+
parameters: z.object({
|
|
28
|
+
keyword: z.string().optional().describe("Keyword to search across award descriptions and recipient names"),
|
|
29
|
+
award_type: z.string().optional().describe("'contracts', 'grants', 'loans', 'direct_payments', or comma-separated codes"),
|
|
30
|
+
agency: z.string().optional().describe("Awarding agency name, e.g. 'Department of Defense'"),
|
|
31
|
+
recipient: z.string().optional().describe("Recipient/company name to search for"),
|
|
32
|
+
state: z.string().optional().describe("Two-letter state code, e.g. 'CA', 'TX'"),
|
|
33
|
+
start_date: z.string().optional().describe("Start date YYYY-MM-DD (default: current FY). Earliest: 2007-10-01"),
|
|
34
|
+
end_date: z.string().optional().describe("End date YYYY-MM-DD (default: today)"),
|
|
35
|
+
min_amount: z.number().optional().describe("Minimum award amount in dollars"),
|
|
36
|
+
max_amount: z.number().optional().describe("Maximum award amount in dollars"),
|
|
37
|
+
limit: z.number().int().positive().max(100).optional().describe("Results per page (default: 25)"),
|
|
38
|
+
page: z.number().int().positive().optional().describe("Page number (default: 1)"),
|
|
39
|
+
sort_field: z.string().optional().describe("Sort by: 'Award Amount' (default), 'Recipient Name', 'Start Date', 'End Date'"),
|
|
40
|
+
}),
|
|
41
|
+
execute: async ({ keyword, award_type, agency, recipient, state, start_date, end_date, min_amount, max_amount, limit, page, sort_field }) => {
|
|
42
|
+
const data = await searchAwards({
|
|
43
|
+
keyword, awardType: award_type, agency, recipient, state,
|
|
44
|
+
startDate: start_date, endDate: end_date,
|
|
45
|
+
minAmount: min_amount, maxAmount: max_amount,
|
|
46
|
+
limit, page, sortField: sort_field,
|
|
47
|
+
});
|
|
48
|
+
if (!data.awards.length)
|
|
49
|
+
return JSON.stringify({ summary: "No awards found matching the criteria.", total: 0, awards: [] });
|
|
50
|
+
return JSON.stringify({
|
|
51
|
+
summary: `USAspending award search: ${data.total} total results, showing ${data.awards.length}`,
|
|
52
|
+
totalResults: data.total,
|
|
53
|
+
showing: data.awards.length,
|
|
54
|
+
awards: data.awards,
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "usa_spending_by_agency",
|
|
60
|
+
description: "Get total federal spending broken down by awarding agency. " +
|
|
61
|
+
"Shows which agencies are spending the most.",
|
|
62
|
+
annotations: { title: "USAspending: Spending by Agency", readOnlyHint: true },
|
|
63
|
+
parameters: z.object({
|
|
64
|
+
fiscal_year: z.number().int().optional().describe("Fiscal year (default: current)"),
|
|
65
|
+
state: z.string().optional().describe("Two-letter state code, e.g. 'CA', 'TX'"),
|
|
66
|
+
keyword: z.string().optional().describe("Keyword to filter spending"),
|
|
67
|
+
award_type: z.string().optional().describe("'contracts', 'grants', 'loans', 'direct_payments'"),
|
|
68
|
+
limit: z.number().int().positive().max(100).optional().describe("Number of agencies (default: 20)"),
|
|
69
|
+
}),
|
|
70
|
+
execute: async ({ fiscal_year, state, keyword, award_type, limit }) => {
|
|
71
|
+
const fy = fiscal_year || currentFiscalYear();
|
|
72
|
+
const agencies = await spendingByAgency({ fiscalYear: fy, state, keyword, awardType: award_type, limit });
|
|
73
|
+
if (!agencies.length)
|
|
74
|
+
return JSON.stringify({ summary: `No spending data found for FY ${fy}.`, fiscalYear: fy, agencies: [] });
|
|
75
|
+
return JSON.stringify({
|
|
76
|
+
summary: `Federal spending by agency FY ${fy}: ${agencies.length} agencies`,
|
|
77
|
+
fiscalYear: fy,
|
|
78
|
+
agencies,
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "usa_spending_by_state",
|
|
84
|
+
description: "Get federal spending by state or territory. Shows total awards and per-capita spending.",
|
|
85
|
+
annotations: { title: "USAspending: Spending by State", readOnlyHint: true },
|
|
86
|
+
parameters: z.object({
|
|
87
|
+
state: z.string().optional().describe("Two-letter state code (e.g. 'CA'). Omit for all states."),
|
|
88
|
+
fiscal_year: z.number().int().optional().describe("Fiscal year (default: most recent)"),
|
|
89
|
+
}),
|
|
90
|
+
execute: async ({ state, fiscal_year }) => {
|
|
91
|
+
const result = await spendingByState({ state, fiscalYear: fiscal_year });
|
|
92
|
+
if ("detail" in result) {
|
|
93
|
+
const d = result.detail;
|
|
94
|
+
return JSON.stringify({
|
|
95
|
+
summary: `Federal spending: ${d.name || state} — $${d.totalAwards.toLocaleString()} total, $${d.perCapita.toLocaleString()} per capita`,
|
|
96
|
+
...d,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const fy = fiscal_year || currentFiscalYear();
|
|
100
|
+
return JSON.stringify({
|
|
101
|
+
summary: `Federal spending by state FY ${fy}: ${result.states.length} states`,
|
|
102
|
+
fiscalYear: fy,
|
|
103
|
+
states: result.states,
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "usa_spending_by_recipient",
|
|
109
|
+
description: "Get the top recipients (companies, organizations) of federal spending. " +
|
|
110
|
+
"Use state and agency filters to narrow results.",
|
|
111
|
+
annotations: { title: "USAspending: Top Recipients", readOnlyHint: true },
|
|
112
|
+
parameters: z.object({
|
|
113
|
+
fiscal_year: z.number().int().optional().describe("Fiscal year (default: current)"),
|
|
114
|
+
award_type: z.string().optional().describe("'contracts', 'grants', 'loans', 'direct_payments'"),
|
|
115
|
+
state: z.string().optional().describe("Two-letter state code, e.g. 'CA', 'TX'"),
|
|
116
|
+
agency: z.string().optional().describe("Awarding agency name, e.g. 'Department of Energy'"),
|
|
117
|
+
limit: z.number().int().positive().max(100).optional().describe("Number of recipients (default: 25)"),
|
|
118
|
+
}),
|
|
119
|
+
execute: async ({ fiscal_year, award_type, state, agency, limit }) => {
|
|
120
|
+
const fy = fiscal_year || currentFiscalYear();
|
|
121
|
+
const recipients = await topRecipients({ fiscalYear: fy, awardType: award_type, state, agency, limit });
|
|
122
|
+
const typeLabel = award_type ? ` (${award_type})` : "";
|
|
123
|
+
if (!recipients.length)
|
|
124
|
+
return JSON.stringify({ summary: `No recipient data for FY ${fy}${typeLabel}.`, fiscalYear: fy, recipients: [] });
|
|
125
|
+
return JSON.stringify({
|
|
126
|
+
summary: `Top federal spending recipients${typeLabel} FY ${fy}: ${recipients.length} recipients`,
|
|
127
|
+
fiscalYear: fy,
|
|
128
|
+
awardType: award_type || null,
|
|
129
|
+
recipients,
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: "usa_spending_over_time",
|
|
135
|
+
description: "Get federal spending aggregated by time period (monthly, quarterly, or fiscal year). " +
|
|
136
|
+
"Useful for identifying trends.",
|
|
137
|
+
annotations: { title: "USAspending: Spending Over Time", readOnlyHint: true },
|
|
138
|
+
parameters: z.object({
|
|
139
|
+
group: z.string().optional().describe("Time grouping: 'month' (default), 'quarter', or 'fiscal_year'"),
|
|
140
|
+
start_date: z.string().optional().describe("Start date YYYY-MM-DD (default: 3 years ago)"),
|
|
141
|
+
end_date: z.string().optional().describe("End date YYYY-MM-DD (default: today)"),
|
|
142
|
+
agency: z.string().optional().describe("Filter to specific agency name"),
|
|
143
|
+
award_type: z.string().optional().describe("'contracts', 'grants', 'loans', 'direct_payments'"),
|
|
144
|
+
state: z.string().optional().describe("Two-letter state code, e.g. 'CA', 'TX'"),
|
|
145
|
+
keyword: z.string().optional().describe("Keyword to filter spending"),
|
|
146
|
+
}),
|
|
147
|
+
execute: async ({ group, start_date, end_date, agency, award_type, state, keyword }) => {
|
|
148
|
+
const periods = await spendingOverTime({
|
|
149
|
+
group, startDate: start_date, endDate: end_date,
|
|
150
|
+
agency, awardType: award_type, state, keyword,
|
|
151
|
+
});
|
|
152
|
+
if (!periods.length)
|
|
153
|
+
return JSON.stringify({ summary: "No spending data found for the given period.", periods: [] });
|
|
154
|
+
return JSON.stringify({
|
|
155
|
+
summary: `Federal spending over time: ${periods.length} periods, grouped by ${group || "month"}`,
|
|
156
|
+
group: group || "month",
|
|
157
|
+
periods,
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: "usa_agency_overview",
|
|
163
|
+
description: "Get an overview of a federal agency's spending, including budgetary resources and obligations.\n\n" +
|
|
164
|
+
"Common codes: '097' (DOD), '075' (HHS), '069' (Treasury), '089' (DOE), " +
|
|
165
|
+
"'012' (USDA), '015' (Justice), '036' (VA), '070' (DHS), '080' (NASA)",
|
|
166
|
+
annotations: { title: "USAspending: Agency Overview", readOnlyHint: true },
|
|
167
|
+
parameters: z.object({
|
|
168
|
+
agency_code: z.string().describe("Toptier agency code. Common: '097' (DOD), '075' (HHS), '069' (Treasury), " +
|
|
169
|
+
"'089' (DOE), '036' (VA), '070' (DHS), '080' (NASA), '091' (Education), '016' (Labor)"),
|
|
170
|
+
fiscal_year: z.number().int().optional().describe("Fiscal year (default: current)"),
|
|
171
|
+
}),
|
|
172
|
+
execute: async ({ agency_code, fiscal_year }) => {
|
|
173
|
+
const data = await agencyOverview(agency_code, fiscal_year);
|
|
174
|
+
return JSON.stringify({
|
|
175
|
+
summary: `Agency: ${data.name || agency_code} — FY ${data.fiscalYear}`,
|
|
176
|
+
...data,
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
];
|
|
181
|
+
// ─── Re-export cache control from SDK ────────────────────────────────
|
|
182
|
+
export { clearCache } from "../sdk/usaspending.js";
|
|
183
|
+
// ─── Prompts (FastMCP InputPrompt type) ──────────────────────────────
|
|
184
|
+
export const prompts = [
|
|
185
|
+
{
|
|
186
|
+
name: "federal_spending_overview",
|
|
187
|
+
description: "Comprehensive overview of federal spending with connections to authorizing legislation and votes.",
|
|
188
|
+
load: async () => "Give me a comprehensive overview of federal spending using USAspending data.\n\n" +
|
|
189
|
+
"== SPENDING DATA ==\n" +
|
|
190
|
+
"1. **Top spending agencies** — use usa_spending_by_agency with limit=15\n" +
|
|
191
|
+
"2. **Top recipients** — use usa_spending_by_recipient for contracts, limit=15\n" +
|
|
192
|
+
"3. **Top states by spending** — use usa_spending_by_state\n" +
|
|
193
|
+
"4. **Spending trend** — use usa_spending_over_time with group=quarter for the last 2 years\n\n" +
|
|
194
|
+
"== LEGISLATIVE AUTHORIZATION ==\n" +
|
|
195
|
+
"5. Use congress_search_bills for 'appropriations' in the current congress to find the authorizing legislation\n" +
|
|
196
|
+
"6. Use congress_house_votes and congress_senate_votes to show how each party voted on the appropriations\n\n" +
|
|
197
|
+
"== CONTEXT ==\n" +
|
|
198
|
+
"7. Use census_population to calculate per-capita spending by state\n" +
|
|
199
|
+
"8. Use lobbying_search for top-spending agencies to find who lobbied for these programs\n\n" +
|
|
200
|
+
"Summarize the key findings: which agencies spend the most, which companies receive the most, " +
|
|
201
|
+
"which states get the most per capita, how each party voted on the budget, and whether spending is trending up or down.",
|
|
202
|
+
},
|
|
203
|
+
];
|
|
204
|
+
//# sourceMappingURL=usaspending.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usaspending.js","sourceRoot":"","sources":["../../src/modules/usaspending.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAE/B,wEAAwE;AAExE,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,CAAC;AAClC,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AACzC,MAAM,CAAC,MAAM,WAAW,GAAG,iFAAiF,CAAC;AAC7G,MAAM,CAAC,MAAM,QAAQ,GAAG,yEAAyE,CAAC;AAClG,MAAM,CAAC,MAAM,IAAI,GAAG,gFAAgF,CAAC;AAErG,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,UAAU;IACV,WAAW;CACZ,CAAC;AAEF,wEAAwE;AAExE,MAAM,CAAC,MAAM,KAAK,GAAqB;IACrC;QACE,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,8EAA8E;YAC9E,+EAA+E;YAC/E,wEAAwE;YACxE,yGAAyG;QAC3G,WAAW,EAAE,EAAE,KAAK,EAAE,4BAA4B,EAAE,YAAY,EAAE,IAAI,EAAE;QACxE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;YACnB,OAAO,EAAE,CAAC,CAAC,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,CAAC;AAEF,wEAAwE;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,wEAAwE;AAExE,MAAM,CAAC,MAAM,OAAO,GAA4B;IAC9C;QACE,IAAI,EAAE,2BAA2B;QACjC,WAAW,EAAE,mGAAmG;QAChH,IAAI,EAAE,KAAK,IAAI,EAAE,CACf,kFAAkF;YAClF,uBAAuB;YACvB,2EAA2E;YAC3E,iFAAiF;YACjF,6DAA6D;YAC7D,gGAAgG;YAChG,mCAAmC;YACnC,iHAAiH;YACjH,8GAA8G;YAC9G,iBAAiB;YACjB,sEAAsE;YACtE,6FAA6F;YAC7F,+FAA+F;YAC/F,wHAAwH;KAC3H;CACF,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* USDA FoodData Central MCP module — search foods, get nutrition facts, compare nutrients.
|
|
3
|
+
*/
|
|
4
|
+
import type { Tool } from "fastmcp";
|
|
5
|
+
export declare const name = "usda-fooddata";
|
|
6
|
+
export declare const displayName = "USDA FoodData Central";
|
|
7
|
+
export declare const description = "Nutritional data for 300K+ foods: calories, macros, vitamins, minerals. Covers branded products, standard reference foods, and survey foods.";
|
|
8
|
+
export declare const auth: {
|
|
9
|
+
envVar: string;
|
|
10
|
+
signup: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const workflow = "fooddata_search to find foods \u2192 fooddata_detail for full nutrient breakdown";
|
|
13
|
+
export declare const tips = "Data types: 'Foundation' (minimally processed), 'SR Legacy' (historical reference), 'Branded' (commercial products), 'Survey' (FNDDS dietary studies). Use Foundation or SR Legacy for generic foods, Branded for specific products.";
|
|
14
|
+
export declare const reference: {
|
|
15
|
+
dataTypes: Record<string, string>;
|
|
16
|
+
docs: {
|
|
17
|
+
"API Guide": string;
|
|
18
|
+
"FoodData Central": string;
|
|
19
|
+
"Data Documentation": string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const tools: Tool<any, any>[];
|
|
23
|
+
export { clearCache } from "../sdk/usda-fooddata.js";
|
|
24
|
+
//# sourceMappingURL=usda-fooddata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usda-fooddata.d.ts","sourceRoot":"","sources":["../../src/modules/usda-fooddata.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAKpC,eAAO,MAAM,IAAI,kBAAkB,CAAC;AACpC,eAAO,MAAM,WAAW,0BAA0B,CAAC;AACnD,eAAO,MAAM,WAAW,iJAAiJ,CAAC;AAC1K,eAAO,MAAM,IAAI;;;CAAyE,CAAC;AAC3F,eAAO,MAAM,QAAQ,qFAAgF,CAAC;AACtG,eAAO,MAAM,IAAI,yOAAyO,CAAC;AAE3P,eAAO,MAAM,SAAS;;;;;;;CAOrB,CAAC;AAWF,eAAO,MAAM,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EA4FjC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* USDA FoodData Central MCP module — search foods, get nutrition facts, compare nutrients.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { searchFoods, getFood, listFoods, DATA_TYPES } from "../sdk/usda-fooddata.js";
|
|
6
|
+
// ─── Metadata (server.ts reads these) ────────────────────────────────
|
|
7
|
+
export const name = "usda-fooddata";
|
|
8
|
+
export const displayName = "USDA FoodData Central";
|
|
9
|
+
export const description = "Nutritional data for 300K+ foods: calories, macros, vitamins, minerals. Covers branded products, standard reference foods, and survey foods.";
|
|
10
|
+
export const auth = { envVar: "DATA_GOV_API_KEY", signup: "https://api.data.gov/signup/" };
|
|
11
|
+
export const workflow = "fooddata_search to find foods → fooddata_detail for full nutrient breakdown";
|
|
12
|
+
export const tips = "Data types: 'Foundation' (minimally processed), 'SR Legacy' (historical reference), 'Branded' (commercial products), 'Survey' (FNDDS dietary studies). Use Foundation or SR Legacy for generic foods, Branded for specific products.";
|
|
13
|
+
export const reference = {
|
|
14
|
+
dataTypes: DATA_TYPES,
|
|
15
|
+
docs: {
|
|
16
|
+
"API Guide": "https://fdc.nal.usda.gov/api-guide",
|
|
17
|
+
"FoodData Central": "https://fdc.nal.usda.gov/",
|
|
18
|
+
"Data Documentation": "https://fdc.nal.usda.gov/data-documentation",
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
// ─── Helpers ─────────────────────────────────────────────────────────
|
|
22
|
+
function formatNutrient(n) {
|
|
23
|
+
const val = n.value ?? n.amount;
|
|
24
|
+
return val !== undefined ? `${n.nutrientName}: ${val} ${n.unitName || ""}`.trim() : null;
|
|
25
|
+
}
|
|
26
|
+
// ─── Tools ───────────────────────────────────────────────────────────
|
|
27
|
+
export const tools = [
|
|
28
|
+
{
|
|
29
|
+
name: "fooddata_search",
|
|
30
|
+
description: "Search the USDA FoodData Central database for foods by keyword.\n" +
|
|
31
|
+
"Returns matching foods with basic nutrient info. Covers 300K+ foods including branded products.\n\n" +
|
|
32
|
+
"Data types: 'Foundation' (generic whole foods), 'SR Legacy' (historical USDA reference), " +
|
|
33
|
+
"'Branded' (commercial products with UPC), 'Survey' (FNDDS dietary studies).",
|
|
34
|
+
annotations: { title: "USDA FoodData: Search Foods", readOnlyHint: true },
|
|
35
|
+
parameters: z.object({
|
|
36
|
+
query: z.string().describe("Food search term (e.g. 'chicken breast', 'cheddar cheese', 'apple')"),
|
|
37
|
+
dataType: z.array(z.string()).optional().describe("Filter by data type: ['Foundation'], ['Branded'], ['SR Legacy', 'Foundation']"),
|
|
38
|
+
brandOwner: z.string().optional().describe("Filter by brand owner for branded foods (e.g. 'Kraft', 'General Mills')"),
|
|
39
|
+
pageSize: z.number().int().max(200).optional().describe("Results per page (default 25, max 200)"),
|
|
40
|
+
pageNumber: z.number().int().optional().describe("Page number (1-based)"),
|
|
41
|
+
sortBy: z.string().optional().describe("Sort field: 'dataType.keyword', 'lowercaseDescription.keyword', 'fdcId', 'publishedDate'"),
|
|
42
|
+
sortOrder: z.string().optional().describe("'asc' or 'desc'"),
|
|
43
|
+
}),
|
|
44
|
+
execute: async (args) => {
|
|
45
|
+
const data = await searchFoods(args);
|
|
46
|
+
if (!data.foods?.length)
|
|
47
|
+
return `No foods found for '${args.query}'.`;
|
|
48
|
+
return JSON.stringify({
|
|
49
|
+
summary: `Found ${data.totalHits} foods matching '${args.query}', showing ${data.foods.length} (page ${data.currentPage} of ${data.totalPages})`,
|
|
50
|
+
total: data.totalHits,
|
|
51
|
+
foods: data.foods.map(f => ({
|
|
52
|
+
fdcId: f.fdcId,
|
|
53
|
+
description: f.description,
|
|
54
|
+
dataType: f.dataType,
|
|
55
|
+
brandOwner: f.brandOwner,
|
|
56
|
+
brandName: f.brandName,
|
|
57
|
+
ingredients: f.ingredients,
|
|
58
|
+
servingSize: f.servingSize ? `${f.servingSize} ${f.servingSizeUnit || "g"}` : undefined,
|
|
59
|
+
nutrients: f.foodNutrients?.slice(0, 15).map(formatNutrient).filter(Boolean),
|
|
60
|
+
})),
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "fooddata_detail",
|
|
66
|
+
description: "Get complete nutritional details for a specific food by its FDC ID.\n" +
|
|
67
|
+
"Returns full nutrient breakdown: calories, protein, fat, carbs, vitamins, minerals, amino acids.\n" +
|
|
68
|
+
"Use fooddata_search first to find FDC IDs.",
|
|
69
|
+
annotations: { title: "USDA FoodData: Food Details", readOnlyHint: true },
|
|
70
|
+
parameters: z.object({
|
|
71
|
+
fdcId: z.number().int().describe("FoodData Central ID (get from fooddata_search results)"),
|
|
72
|
+
}),
|
|
73
|
+
execute: async ({ fdcId }) => {
|
|
74
|
+
const food = await getFood(fdcId);
|
|
75
|
+
return JSON.stringify({
|
|
76
|
+
fdcId: food.fdcId,
|
|
77
|
+
description: food.description,
|
|
78
|
+
dataType: food.dataType,
|
|
79
|
+
brandOwner: food.brandOwner,
|
|
80
|
+
brandName: food.brandName,
|
|
81
|
+
ingredients: food.ingredients,
|
|
82
|
+
servingSize: food.servingSize ? `${food.servingSize} ${food.servingSizeUnit || "g"}` : undefined,
|
|
83
|
+
category: food.foodCategory?.description,
|
|
84
|
+
published: food.publishedDate,
|
|
85
|
+
nutrients: food.foodNutrients?.map(formatNutrient).filter(Boolean),
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "fooddata_list",
|
|
91
|
+
description: "Browse a paged list of foods from the USDA database.\n" +
|
|
92
|
+
"Useful for exploring available foods by data type without a specific search term.",
|
|
93
|
+
annotations: { title: "USDA FoodData: List Foods", readOnlyHint: true },
|
|
94
|
+
parameters: z.object({
|
|
95
|
+
dataType: z.array(z.string()).optional().describe("Filter by data type: ['Foundation'], ['Branded'], ['SR Legacy']"),
|
|
96
|
+
pageSize: z.number().int().max(200).optional().describe("Results per page (default 25, max 200)"),
|
|
97
|
+
pageNumber: z.number().int().optional().describe("Page number (1-based)"),
|
|
98
|
+
sortBy: z.string().optional().describe("Sort field: 'dataType.keyword', 'lowercaseDescription.keyword', 'fdcId', 'publishedDate'"),
|
|
99
|
+
sortOrder: z.string().optional().describe("'asc' or 'desc'"),
|
|
100
|
+
}),
|
|
101
|
+
execute: async (args) => {
|
|
102
|
+
const data = await listFoods(args);
|
|
103
|
+
if (!data?.length)
|
|
104
|
+
return "No foods found.";
|
|
105
|
+
return JSON.stringify({
|
|
106
|
+
summary: `Returned ${data.length} foods${args.dataType ? ` (${args.dataType.join(", ")})` : ""}`,
|
|
107
|
+
foods: data.map(f => ({
|
|
108
|
+
fdcId: f.fdcId,
|
|
109
|
+
description: f.description,
|
|
110
|
+
dataType: f.dataType,
|
|
111
|
+
published: f.publishedDate,
|
|
112
|
+
})),
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
export { clearCache } from "../sdk/usda-fooddata.js";
|
|
118
|
+
//# sourceMappingURL=usda-fooddata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usda-fooddata.js","sourceRoot":"","sources":["../../src/modules/usda-fooddata.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAEtF,wEAAwE;AAExE,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC;AACpC,MAAM,CAAC,MAAM,WAAW,GAAG,uBAAuB,CAAC;AACnD,MAAM,CAAC,MAAM,WAAW,GAAG,8IAA8I,CAAC;AAC1K,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,8BAA8B,EAAE,CAAC;AAC3F,MAAM,CAAC,MAAM,QAAQ,GAAG,6EAA6E,CAAC;AACtG,MAAM,CAAC,MAAM,IAAI,GAAG,sOAAsO,CAAC;AAE3P,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,SAAS,EAAE,UAAU;IACrB,IAAI,EAAE;QACJ,WAAW,EAAE,oCAAoC;QACjD,kBAAkB,EAAE,2BAA2B;QAC/C,oBAAoB,EAAE,6CAA6C;KACpE;CACF,CAAC;AAEF,wEAAwE;AAExE,SAAS,cAAc,CAAC,CAAgF;IACtG,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC;IAChC,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,KAAK,GAAG,IAAI,CAAC,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3F,CAAC;AAED,wEAAwE;AAExE,MAAM,CA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QAAQ,CAAC,uBAAuB,CAAC;YACzE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0FAA0F,CAAC;YAClI,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;SAC7D,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,CAAC,IAAI,EAAE,MAAM;gBAAE,OAAO,iBAAiB,CAAC;YAC5C,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,OAAO,EAAE,YAAY,IAAI,CAAC,MAAM,SAAS,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBAChG,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBACpB,KAAK,EAAE,CAAC,CAAC,KAAK;oBACd,WAAW,EAAE,CAAC,CAAC,WAAW;oBAC1B,QAAQ,EAAE,CAAC,CAAC,QAAQ;oBACpB,SAAS,EAAE,CAAC,CAAC,aAAa;iBAC3B,CAAC,CAAC;aACJ,CAAC,CAAC;QACL,CAAC;KACF;CACF,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* USDA NASS MCP module — agricultural production, crop prices, farm income.
|
|
3
|
+
*/
|
|
4
|
+
import type { Tool, InputPrompt } from "fastmcp";
|
|
5
|
+
export declare const name = "usda-nass";
|
|
6
|
+
export declare const displayName = "USDA NASS QuickStats";
|
|
7
|
+
export declare const description = "Agricultural production, crop prices, farm income, livestock, Census of Agriculture data";
|
|
8
|
+
export declare const auth: {
|
|
9
|
+
envVar: string;
|
|
10
|
+
signup: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const workflow = "usda_crop_data or usda_livestock for specific commodities, usda_prices for price trends, usda_ag_query for custom queries";
|
|
13
|
+
export declare const tips = "Commodities: CORN, SOYBEANS, WHEAT, COTTON, CATTLE, HOGS, MILK. States: IA, IL, TX, CA, NE";
|
|
14
|
+
export declare const reference: {
|
|
15
|
+
topCommodities: {
|
|
16
|
+
CORN: string;
|
|
17
|
+
SOYBEANS: string;
|
|
18
|
+
WHEAT: string;
|
|
19
|
+
COTTON: string;
|
|
20
|
+
RICE: string;
|
|
21
|
+
SORGHUM: string;
|
|
22
|
+
CATTLE: string;
|
|
23
|
+
HOGS: string;
|
|
24
|
+
MILK: string;
|
|
25
|
+
CHICKENS: string;
|
|
26
|
+
EGGS: string;
|
|
27
|
+
};
|
|
28
|
+
categories: {
|
|
29
|
+
"AREA PLANTED": string;
|
|
30
|
+
"AREA HARVESTED": string;
|
|
31
|
+
PRODUCTION: string;
|
|
32
|
+
YIELD: string;
|
|
33
|
+
"PRICE RECEIVED": string;
|
|
34
|
+
INVENTORY: string;
|
|
35
|
+
SALES: string;
|
|
36
|
+
};
|
|
37
|
+
docs: {
|
|
38
|
+
"API Docs": string;
|
|
39
|
+
"Get Key": string;
|
|
40
|
+
"QuickStats UI": string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export declare const tools: Tool<any, any>[];
|
|
44
|
+
export declare const prompts: InputPrompt<any, any>[];
|
|
45
|
+
export { clearCache } from "../sdk/usda-nass.js";
|
|
46
|
+
//# sourceMappingURL=usda-nass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usda-nass.d.ts","sourceRoot":"","sources":["../../src/modules/usda-nass.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAKjD,eAAO,MAAM,IAAI,cAAc,CAAC;AAChC,eAAO,MAAM,WAAW,yBAAyB,CAAC;AAClD,eAAO,MAAM,WAAW,6FAA6F,CAAC;AACtH,eAAO,MAAM,IAAI;;;CAAkF,CAAC;AACpG,eAAO,MAAM,QAAQ,8HAA8H,CAAC;AACpJ,eAAO,MAAM,IAAI,+FAA+F,CAAC;AAEjH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBrB,CAAC;AAIF,eAAO,MAAM,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAqGjC,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,EAa1C,CAAC;AAIF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* USDA NASS MCP module — agricultural production, crop prices, farm income.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { queryStats, getCropProduction, getLivestockData, getPriceReceived } from "../sdk/usda-nass.js";
|
|
6
|
+
// ─── Metadata ────────────────────────────────────────────────────────
|
|
7
|
+
export const name = "usda-nass";
|
|
8
|
+
export const displayName = "USDA NASS QuickStats";
|
|
9
|
+
export const description = "Agricultural production, crop prices, farm income, livestock, Census of Agriculture data";
|
|
10
|
+
export const auth = { envVar: "USDA_NASS_API_KEY", signup: "https://quickstats.nass.usda.gov/api" };
|
|
11
|
+
export const workflow = "usda_crop_data or usda_livestock for specific commodities, usda_prices for price trends, usda_ag_query for custom queries";
|
|
12
|
+
export const tips = "Commodities: CORN, SOYBEANS, WHEAT, COTTON, CATTLE, HOGS, MILK. States: IA, IL, TX, CA, NE";
|
|
13
|
+
export const reference = {
|
|
14
|
+
topCommodities: {
|
|
15
|
+
CORN: "Corn (grain, silage)", SOYBEANS: "Soybeans", WHEAT: "Wheat (winter, spring, durum)",
|
|
16
|
+
COTTON: "Cotton (upland, pima)", RICE: "Rice", SORGHUM: "Sorghum",
|
|
17
|
+
CATTLE: "Cattle (incl. calves)", HOGS: "Hogs", MILK: "Milk (dairy)",
|
|
18
|
+
CHICKENS: "Chickens (broilers, layers)", EGGS: "Eggs",
|
|
19
|
+
},
|
|
20
|
+
categories: {
|
|
21
|
+
"AREA PLANTED": "Acres planted", "AREA HARVESTED": "Acres harvested",
|
|
22
|
+
PRODUCTION: "Total production (bushels, tons, etc.)", YIELD: "Yield per acre",
|
|
23
|
+
"PRICE RECEIVED": "Price received by farmers ($/unit)", INVENTORY: "Livestock inventory (head)",
|
|
24
|
+
"SALES": "Cash receipts from sales",
|
|
25
|
+
},
|
|
26
|
+
docs: {
|
|
27
|
+
"API Docs": "https://quickstats.nass.usda.gov/api",
|
|
28
|
+
"Get Key": "https://quickstats.nass.usda.gov/api#param_define",
|
|
29
|
+
"QuickStats UI": "https://quickstats.nass.usda.gov/",
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
// ─── Tools ───────────────────────────────────────────────────────────
|
|
33
|
+
export const tools = [
|
|
34
|
+
{
|
|
35
|
+
name: "usda_crop_data",
|
|
36
|
+
description: "Get crop production data — area planted, harvested, production, yield.\nCommodities: CORN, SOYBEANS, WHEAT, COTTON, RICE, SORGHUM",
|
|
37
|
+
annotations: { title: "USDA: Crop Data", readOnlyHint: true },
|
|
38
|
+
parameters: z.object({
|
|
39
|
+
commodity: z.string().describe("Crop name: CORN, SOYBEANS, WHEAT, COTTON, RICE"),
|
|
40
|
+
state: z.string().optional().describe("State code: IA, IL, CA, TX. Omit for national"),
|
|
41
|
+
year: z.number().int().optional().describe("Year (omit for all recent years)"),
|
|
42
|
+
category: z.string().optional().describe("PRODUCTION (default), AREA PLANTED, AREA HARVESTED, YIELD"),
|
|
43
|
+
}),
|
|
44
|
+
execute: async ({ commodity, state, year, category }) => {
|
|
45
|
+
const data = await getCropProduction(commodity, { state, year, category });
|
|
46
|
+
if (!data.length)
|
|
47
|
+
return `No crop data found for ${commodity}${state ? ` in ${state}` : ""}.`;
|
|
48
|
+
const recent = data.slice(0, 50);
|
|
49
|
+
return JSON.stringify({
|
|
50
|
+
summary: `${commodity.toUpperCase()} ${category ?? "PRODUCTION"}: ${recent.length} records${state ? ` for ${state}` : " (national)"}`,
|
|
51
|
+
records: recent.map(r => ({
|
|
52
|
+
year: r.year, state: r.state_alpha, value: r.Value, unit: r.unit_desc,
|
|
53
|
+
description: r.short_desc, period: r.reference_period_desc,
|
|
54
|
+
})),
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "usda_livestock",
|
|
60
|
+
description: "Get livestock data — inventory, slaughter, production.\nCommodities: CATTLE, HOGS, CHICKENS, MILK, EGGS",
|
|
61
|
+
annotations: { title: "USDA: Livestock", readOnlyHint: true },
|
|
62
|
+
parameters: z.object({
|
|
63
|
+
commodity: z.string().describe("CATTLE, HOGS, CHICKENS, MILK, EGGS"),
|
|
64
|
+
state: z.string().optional().describe("State code. Omit for national"),
|
|
65
|
+
year: z.number().int().optional().describe("Year"),
|
|
66
|
+
category: z.string().optional().describe("INVENTORY, PRODUCTION, SALES"),
|
|
67
|
+
}),
|
|
68
|
+
execute: async ({ commodity, state, year, category }) => {
|
|
69
|
+
const data = await getLivestockData(commodity, { state, year, category });
|
|
70
|
+
if (!data.length)
|
|
71
|
+
return `No livestock data for ${commodity}${state ? ` in ${state}` : ""}.`;
|
|
72
|
+
const recent = data.slice(0, 50);
|
|
73
|
+
return JSON.stringify({
|
|
74
|
+
summary: `${commodity.toUpperCase()}: ${recent.length} records${state ? ` for ${state}` : " (national)"}`,
|
|
75
|
+
records: recent.map(r => ({
|
|
76
|
+
year: r.year, state: r.state_alpha, value: r.Value, unit: r.unit_desc,
|
|
77
|
+
description: r.short_desc, period: r.reference_period_desc,
|
|
78
|
+
})),
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "usda_prices",
|
|
84
|
+
description: "Get prices received by farmers for agricultural commodities.\nWorks for any commodity: CORN, WHEAT, SOYBEANS, CATTLE, MILK, etc.",
|
|
85
|
+
annotations: { title: "USDA: Prices Received", readOnlyHint: true },
|
|
86
|
+
parameters: z.object({
|
|
87
|
+
commodity: z.string().describe("Any commodity: CORN, WHEAT, SOYBEANS, CATTLE, HOGS, MILK"),
|
|
88
|
+
state: z.string().optional().describe("State code. Omit for national average"),
|
|
89
|
+
year: z.number().int().optional().describe("Year"),
|
|
90
|
+
}),
|
|
91
|
+
execute: async ({ commodity, state, year }) => {
|
|
92
|
+
const data = await getPriceReceived(commodity, { state, year });
|
|
93
|
+
if (!data.length)
|
|
94
|
+
return `No price data for ${commodity}${state ? ` in ${state}` : ""}.`;
|
|
95
|
+
const recent = data.slice(0, 50);
|
|
96
|
+
return JSON.stringify({
|
|
97
|
+
summary: `${commodity.toUpperCase()} prices: ${recent.length} records${state ? ` for ${state}` : " (national)"}`,
|
|
98
|
+
records: recent.map(r => ({
|
|
99
|
+
year: r.year, state: r.state_alpha, value: r.Value, unit: r.unit_desc,
|
|
100
|
+
description: r.short_desc, period: r.reference_period_desc,
|
|
101
|
+
})),
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "usda_ag_query",
|
|
107
|
+
description: "Custom query to USDA NASS QuickStats — any combination of filters.\nMax 50,000 records. Use usda_ag_count first for large queries.",
|
|
108
|
+
annotations: { title: "USDA: Custom Query", readOnlyHint: true },
|
|
109
|
+
parameters: z.object({
|
|
110
|
+
commodity_desc: z.string().optional().describe("Commodity: CORN, WHEAT, CATTLE, etc."),
|
|
111
|
+
source_desc: z.string().optional().describe("SURVEY or CENSUS"),
|
|
112
|
+
sector_desc: z.string().optional().describe("CROPS, ANIMALS & PRODUCTS, ECONOMICS, ENVIRONMENTAL"),
|
|
113
|
+
statisticcat_desc: z.string().optional().describe("AREA PLANTED, PRODUCTION, YIELD, PRICE RECEIVED, INVENTORY"),
|
|
114
|
+
state_alpha: z.string().optional().describe("State code: IA, IL, CA or US for national"),
|
|
115
|
+
year: z.number().int().optional().describe("Year"),
|
|
116
|
+
agg_level_desc: z.string().optional().describe("NATIONAL, STATE, COUNTY"),
|
|
117
|
+
freq_desc: z.string().optional().describe("ANNUAL, MONTHLY, WEEKLY"),
|
|
118
|
+
}),
|
|
119
|
+
execute: async (params) => {
|
|
120
|
+
const data = await queryStats(params);
|
|
121
|
+
if (!data.length)
|
|
122
|
+
return "No records found for this query.";
|
|
123
|
+
const recent = data.slice(0, 100);
|
|
124
|
+
return JSON.stringify({
|
|
125
|
+
summary: `${data.length} records returned (showing ${recent.length})`,
|
|
126
|
+
totalRecords: data.length,
|
|
127
|
+
records: recent.map(r => ({
|
|
128
|
+
year: r.year, state: r.state_alpha, commodity: r.commodity_desc,
|
|
129
|
+
category: r.statisticcat_desc, value: r.Value, unit: r.unit_desc,
|
|
130
|
+
description: r.short_desc,
|
|
131
|
+
})),
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
];
|
|
136
|
+
export const prompts = [
|
|
137
|
+
{
|
|
138
|
+
name: "farm_economy",
|
|
139
|
+
description: "Overview of U.S. agricultural production, prices, and trends.",
|
|
140
|
+
load: async () => "Build a farm economy overview:\n\n" +
|
|
141
|
+
"1. Use usda_crop_data for CORN, SOYBEANS, WHEAT — production for last 3 years (national)\n" +
|
|
142
|
+
"2. Use usda_prices for CORN, SOYBEANS, WHEAT — price trends\n" +
|
|
143
|
+
"3. Use usda_livestock for CATTLE and HOGS — inventory trends\n" +
|
|
144
|
+
"4. Use bls_cpi_breakdown to show food price inflation\n" +
|
|
145
|
+
"5. Use usa_spending_by_agency to show USDA spending\n\n" +
|
|
146
|
+
"Connect the dots: are crop prices rising or falling? How does that correlate with consumer food prices (CPI food component)?",
|
|
147
|
+
},
|
|
148
|
+
];
|
|
149
|
+
// ─── Re-export cache control ─────────────────────────────────────────
|
|
150
|
+
export { clearCache } from "../sdk/usda-nass.js";
|
|
151
|
+
//# sourceMappingURL=usda-nass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usda-nass.js","sourceRoot":"","sources":["../../src/modules/usda-nass.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAA4B,MAAM,qBAAqB,CAAC;AAElI,wEAAwE;AAExE,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAC;AAChC,MAAM,CAAC,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAClD,MAAM,CAAC,MAAM,WAAW,GAAG,0FAA0F,CAAC;AACtH,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,sCAAsC,EAAE,CAAC;AACpG,MAAM,CAAC,MAAM,QAAQ,GAAG,2HAA2H,CAAC;AACpJ,MAAM,CAAC,MAAM,IAAI,GAAG,4FAA4F,CAAC;AAEjH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,cAAc,EAAE;QACd,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,+BAA+B;QAC1F,MAAM,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS;QACjE,MAAM,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc;QACnE,QAAQ,EAAE,6BAA6B,EAAE,IAAI,EAAE,MAAM;KACtD;IACD,UAAU,EAAE;QACV,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB;QACpE,UAAU,EAAE,wCAAwC,EAAE,KAAK,EAAE,gBAAgB;QAC7E,gBAAgB,EAAE,oCAAoC,EAAE,SAAS,EAAE,4BAA4B;QA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BACxB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,cAAc;oBAC/D,QAAQ,EAAE,CAAC,CAAC,iBAAiB,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS;oBAChE,WAAW,EAAE,CAAC,CAAC,UAAU;iBAC1B,CAAC,CAAC;aACJ,CAAC,CAAC;QACL,CAAC;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAA4B;IAC9C;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,+DAA+D;QAC5E,IAAI,EAAE,KAAK,IAAI,EAAE,CACf,oCAAoC;YACpC,4FAA4F;YAC5F,+DAA+D;YAC/D,gEAAgE;YAChE,yDAAyD;YACzD,yDAAyD;YACzD,8HAA8H;KACjI;CACF,CAAC;AAEF,wEAAwE;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* USGS module — earthquake data and water resources monitoring.
|
|
3
|
+
*/
|
|
4
|
+
import type { Tool } from "fastmcp";
|
|
5
|
+
import { clearCache as sdkClearCache } from "../sdk/usgs.js";
|
|
6
|
+
export declare const name = "usgs";
|
|
7
|
+
export declare const displayName = "USGS (U.S. Geological Survey)";
|
|
8
|
+
export declare const description = "Earthquake events (magnitude, location, depth, tsunami risk) and water resources monitoring (streamflow, water levels, temperature) from 13,000+ stations nationwide. No API key required.";
|
|
9
|
+
export declare const workflow = "Use usgs_earthquakes to search for earthquakes by magnitude/location/date \u2192 usgs_significant for recent notable events \u2192 usgs_water_data for streamflow and water levels at monitoring sites \u2192 usgs_water_sites to find stations.";
|
|
10
|
+
export declare const tips = "Earthquake magnitudes: 2.5+ felt by people, 4.0+ moderate, 5.0+ significant, 7.0+ major. Water parameter codes: 00060=discharge, 00065=gage height, 00010=water temp. Use state codes (CA, TX) for water site searches.";
|
|
11
|
+
export declare const reference: {
|
|
12
|
+
waterParams: Record<string, string>;
|
|
13
|
+
alertLevels: Record<string, string>;
|
|
14
|
+
docs: {
|
|
15
|
+
"Earthquake API": string;
|
|
16
|
+
"Water Services": string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const tools: Tool<any, any>[];
|
|
20
|
+
export { sdkClearCache as clearCache };
|
|
21
|
+
//# sourceMappingURL=usgs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usgs.d.ts","sourceRoot":"","sources":["../../src/modules/usgs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EASL,UAAU,IAAI,aAAa,EAE5B,MAAM,gBAAgB,CAAC;AAIxB,eAAO,MAAM,IAAI,SAAS,CAAC;AAC3B,eAAO,MAAM,WAAW,kCAAkC,CAAC;AAC3D,eAAO,MAAM,WAAW,+LACsK,CAAC;AAC/L,eAAO,MAAM,QAAQ,qPACgN,CAAC;AACtO,eAAO,MAAM,IAAI,4NAC0M,CAAC;AAE5N,eAAO,MAAM,SAAS;;;;;;;CAOrB,CAAC;AA0BF,eAAO,MAAM,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,EAsKjC,CAAC;AAEF,OAAO,EAAE,aAAa,IAAI,UAAU,EAAE,CAAC"}
|