data-analyst-mcp 0.3.0 → 0.4.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.
Files changed (292) hide show
  1. package/README.md +286 -262
  2. package/dist/adapters/bjs.d.ts +13 -0
  3. package/dist/adapters/bjs.js +28 -0
  4. package/dist/adapters/bjs.js.map +1 -0
  5. package/dist/adapters/cbp.d.ts +5 -0
  6. package/dist/adapters/cbp.js +64 -0
  7. package/dist/adapters/cbp.js.map +1 -0
  8. package/dist/adapters/cdc-wonder.d.ts +5 -0
  9. package/dist/adapters/cdc-wonder.js +68 -0
  10. package/dist/adapters/cdc-wonder.js.map +1 -0
  11. package/dist/adapters/cpsc.d.ts +4 -0
  12. package/dist/adapters/cpsc.js +125 -0
  13. package/dist/adapters/cpsc.js.map +1 -0
  14. package/dist/adapters/fhwa.d.ts +9 -0
  15. package/dist/adapters/fhwa.js +16 -0
  16. package/dist/adapters/fhwa.js.map +1 -0
  17. package/dist/adapters/foreign-assistance.d.ts +9 -0
  18. package/dist/adapters/foreign-assistance.js +42 -0
  19. package/dist/adapters/foreign-assistance.js.map +1 -0
  20. package/dist/adapters/hud-ahar.d.ts +3 -0
  21. package/dist/adapters/hud-ahar.js +80 -0
  22. package/dist/adapters/hud-ahar.js.map +1 -0
  23. package/dist/adapters/nces.d.ts +10 -0
  24. package/dist/adapters/nces.js +32 -0
  25. package/dist/adapters/nces.js.map +1 -0
  26. package/dist/adapters/nsf.d.ts +11 -0
  27. package/dist/adapters/nsf.js +25 -0
  28. package/dist/adapters/nsf.js.map +1 -0
  29. package/dist/adapters/onrr.d.ts +9 -0
  30. package/dist/adapters/onrr.js +35 -0
  31. package/dist/adapters/onrr.js.map +1 -0
  32. package/dist/adapters/sba.d.ts +10 -0
  33. package/dist/adapters/sba.js +134 -0
  34. package/dist/adapters/sba.js.map +1 -0
  35. package/dist/adapters/treasury-tic.d.ts +30 -0
  36. package/dist/adapters/treasury-tic.js +149 -0
  37. package/dist/adapters/treasury-tic.js.map +1 -0
  38. package/dist/adapters/uscourts.d.ts +8 -0
  39. package/dist/adapters/uscourts.js +8 -0
  40. package/dist/adapters/uscourts.js.map +1 -0
  41. package/dist/analysis/cite.d.ts +9 -1
  42. package/dist/analysis/cite.js +9 -2
  43. package/dist/analysis/cite.js.map +1 -1
  44. package/dist/bin/cli.d.ts +2 -0
  45. package/dist/bin/cli.js +17 -0
  46. package/dist/bin/cli.js.map +1 -1
  47. package/dist/core/generic-rest.js +42 -17
  48. package/dist/core/generic-rest.js.map +1 -1
  49. package/dist/core/guard.d.ts +32 -0
  50. package/dist/core/guard.js +176 -0
  51. package/dist/core/guard.js.map +1 -0
  52. package/dist/core/http.d.ts +10 -0
  53. package/dist/core/http.js +36 -7
  54. package/dist/core/http.js.map +1 -1
  55. package/dist/core/keys.d.ts +13 -3
  56. package/dist/core/keys.js +67 -7
  57. package/dist/core/keys.js.map +1 -1
  58. package/dist/core/package.d.ts +12 -3
  59. package/dist/core/package.js +56 -12
  60. package/dist/core/package.js.map +1 -1
  61. package/dist/core/secret_patterns.d.ts +6 -0
  62. package/dist/core/secret_patterns.js +20 -0
  63. package/dist/core/secret_patterns.js.map +1 -0
  64. package/dist/core/tabular.d.ts +43 -1
  65. package/dist/core/tabular.js +149 -6
  66. package/dist/core/tabular.js.map +1 -1
  67. package/dist/envelope.js +3 -1
  68. package/dist/envelope.js.map +1 -1
  69. package/dist/index.d.ts +29 -22
  70. package/dist/index.js +45 -46
  71. package/dist/index.js.map +1 -1
  72. package/dist/remote/app.js +87 -31
  73. package/dist/remote/app.js.map +1 -1
  74. package/dist/remote/oauth.js +8 -1
  75. package/dist/remote/oauth.js.map +1 -1
  76. package/dist/remote/pages.d.ts +3 -7
  77. package/dist/remote/pages.js +49 -19
  78. package/dist/remote/pages.js.map +1 -1
  79. package/dist/remote/sign.d.ts +7 -1
  80. package/dist/remote/sign.js +33 -7
  81. package/dist/remote/sign.js.map +1 -1
  82. package/dist/remote/store.js +14 -5
  83. package/dist/remote/store.js.map +1 -1
  84. package/dist/report/audit_report.js +29 -7
  85. package/dist/report/audit_report.js.map +1 -1
  86. package/dist/report/build_report.js +34 -4
  87. package/dist/report/build_report.js.map +1 -1
  88. package/dist/report/method_audit.js +10 -1
  89. package/dist/report/method_audit.js.map +1 -1
  90. package/dist/report/scan_secrets.d.ts +4 -1
  91. package/dist/report/scan_secrets.js +38 -18
  92. package/dist/report/scan_secrets.js.map +1 -1
  93. package/dist/server.d.ts +3 -1
  94. package/dist/server.js +46 -13
  95. package/dist/server.js.map +1 -1
  96. package/dist/tools.js +27 -6
  97. package/dist/tools.js.map +1 -1
  98. package/guide/WORKFLOW.md +134 -134
  99. package/guide/assets/disclaimer.txt +1 -1
  100. package/guide/assets/download_data.ps1 +164 -162
  101. package/guide/assets/download_data.sh +8 -2
  102. package/guide/assets/report_template.html +597 -597
  103. package/guide/references/routing.md +198 -171
  104. package/guide/references/style_guide.md +398 -398
  105. package/package.json +56 -56
  106. package/packs/acf/endpoints.json +114 -114
  107. package/packs/acf/policy.json +104 -104
  108. package/packs/actuaries/endpoints.json +82 -82
  109. package/packs/actuaries/policy.json +109 -109
  110. package/packs/bea/assets/download_bea.ps1 +182 -182
  111. package/packs/bea/docs/bea_api.md +461 -461
  112. package/packs/bea/docs/datasets.md +157 -157
  113. package/packs/bea/docs/report_patterns.md +112 -112
  114. package/packs/bea/policy.json +170 -170
  115. package/packs/bea/source.md +152 -152
  116. package/packs/bjs/endpoints.json +150 -0
  117. package/packs/bjs/policy.json +114 -0
  118. package/packs/bjs/source.md +98 -0
  119. package/packs/bls/assets/download_bls.ps1 +152 -152
  120. package/packs/bls/docs/analysis_patterns.md +108 -108
  121. package/packs/bls/docs/bls_api.md +73 -73
  122. package/packs/bls/docs/series_ids.md +149 -149
  123. package/packs/bls/policy.json +238 -238
  124. package/packs/bts/endpoints.json +346 -346
  125. package/packs/bts/policy.json +94 -94
  126. package/packs/cbp/endpoints.json +31 -0
  127. package/packs/cbp/policy.json +85 -0
  128. package/packs/cbp/source.md +57 -0
  129. package/packs/cdc/endpoints.json +197 -197
  130. package/packs/cdc/policy.json +83 -83
  131. package/packs/cdc/source.md +1 -1
  132. package/packs/cdc-wonder/endpoints.json +26 -0
  133. package/packs/cdc-wonder/policy.json +84 -0
  134. package/packs/cdc-wonder/source.md +53 -0
  135. package/packs/census/endpoints.json +99 -99
  136. package/packs/cfpb/endpoints.json +326 -326
  137. package/packs/cfpb/policy.json +119 -119
  138. package/packs/clinical-trials/endpoints.json +166 -166
  139. package/packs/clinical-trials/policy.json +84 -84
  140. package/packs/cms/endpoints.json +69 -69
  141. package/packs/cms/policy.json +96 -96
  142. package/packs/college-scorecard/endpoints.json +252 -252
  143. package/packs/college-scorecard/policy.json +106 -106
  144. package/packs/college-scorecard/source.md +1 -1
  145. package/packs/congress/endpoints.json +1701 -1701
  146. package/packs/congress/policy.json +117 -117
  147. package/packs/cpsc/endpoints.json +91 -0
  148. package/packs/cpsc/policy.json +91 -0
  149. package/packs/cpsc/source.md +76 -0
  150. package/packs/dhs-ohss/endpoints.json +66 -66
  151. package/packs/dhs-ohss/policy.json +107 -107
  152. package/packs/dhs-ohss/source.md +1 -1
  153. package/packs/doj-news/endpoints.json +59 -59
  154. package/packs/doj-news/policy.json +96 -96
  155. package/packs/doj-news/source.md +1 -1
  156. package/packs/dol/endpoints.json +817 -817
  157. package/packs/dol/policy.json +135 -135
  158. package/packs/eia/endpoints.json +717 -717
  159. package/packs/eia/policy.json +112 -112
  160. package/packs/epa/endpoints.json +291 -291
  161. package/packs/epa/policy.json +99 -99
  162. package/packs/epa-aqs/endpoints.json +173 -173
  163. package/packs/epa-aqs/policy.json +96 -96
  164. package/packs/fbi/endpoints.json +1841 -1841
  165. package/packs/fbi/policy.json +118 -118
  166. package/packs/fbi/source.md +3 -3
  167. package/packs/fda/endpoints.json +237 -237
  168. package/packs/fda/policy.json +121 -121
  169. package/packs/fdic/endpoints.json +416 -416
  170. package/packs/fdic/policy.json +83 -83
  171. package/packs/fec/endpoints.json +707 -707
  172. package/packs/fec/policy.json +93 -93
  173. package/packs/fed-board/endpoints.json +89 -89
  174. package/packs/fed-board/policy.json +136 -136
  175. package/packs/federal-register/endpoints.json +143 -143
  176. package/packs/federal-register/policy.json +86 -86
  177. package/packs/fema/endpoints.json +645 -645
  178. package/packs/fema/policy.json +103 -103
  179. package/packs/fhfa/endpoints.json +105 -105
  180. package/packs/fhfa/policy.json +109 -109
  181. package/packs/fhwa/endpoints.json +48 -0
  182. package/packs/fhwa/policy.json +91 -0
  183. package/packs/fhwa/source.md +59 -0
  184. package/packs/foreign-assistance/endpoints.json +166 -0
  185. package/packs/foreign-assistance/policy.json +80 -0
  186. package/packs/foreign-assistance/source.md +76 -0
  187. package/packs/fred/assets/download_fred.ps1 +122 -122
  188. package/packs/fred/docs/analysis_patterns.md +124 -124
  189. package/packs/fred/docs/fred_api.md +94 -94
  190. package/packs/fred/docs/series.md +188 -188
  191. package/packs/fred/policy.json +253 -253
  192. package/packs/fsa/endpoints.json +150 -150
  193. package/packs/fsa/policy.json +99 -99
  194. package/packs/fsa/source.md +1 -1
  195. package/packs/govinfo/endpoints.json +519 -519
  196. package/packs/gsa-calc/endpoints.json +93 -93
  197. package/packs/gsa-calc/policy.json +97 -97
  198. package/packs/hud/endpoints.json +146 -146
  199. package/packs/hud/policy.json +84 -84
  200. package/packs/hud/source.md +1 -1
  201. package/packs/hud-ahar/endpoints.json +92 -0
  202. package/packs/hud-ahar/policy.json +88 -0
  203. package/packs/hud-ahar/source.md +72 -0
  204. package/packs/ipums/docs/report_patterns.md +117 -117
  205. package/packs/irs-soi/endpoints.json +114 -114
  206. package/packs/irs-soi/policy.json +107 -107
  207. package/packs/medicaid/endpoints.json +412 -412
  208. package/packs/medicaid/policy.json +108 -108
  209. package/packs/naep/endpoints.json +217 -217
  210. package/packs/naep/policy.json +100 -100
  211. package/packs/naep/source.md +1 -1
  212. package/packs/nces/endpoints.json +101 -0
  213. package/packs/nces/policy.json +99 -0
  214. package/packs/nces/source.md +75 -0
  215. package/packs/nhtsa/endpoints.json +132 -132
  216. package/packs/nhtsa/policy.json +93 -93
  217. package/packs/nhtsa/source.md +1 -1
  218. package/packs/nih/endpoints.json +452 -452
  219. package/packs/nih/policy.json +86 -86
  220. package/packs/noaa/endpoints.json +431 -431
  221. package/packs/noaa/policy.json +95 -95
  222. package/packs/nrel/endpoints.json +327 -327
  223. package/packs/nrel/policy.json +96 -96
  224. package/packs/nsf/endpoints.json +33 -0
  225. package/packs/nsf/policy.json +83 -0
  226. package/packs/nsf/source.md +59 -0
  227. package/packs/nws/endpoints.json +271 -271
  228. package/packs/nws/policy.json +82 -82
  229. package/packs/nyfed/endpoints.json +80 -80
  230. package/packs/nyfed/policy.json +92 -92
  231. package/packs/omb/endpoints.json +460 -460
  232. package/packs/omb/policy.json +106 -106
  233. package/packs/onrr/endpoints.json +198 -0
  234. package/packs/onrr/policy.json +91 -0
  235. package/packs/onrr/source.md +55 -0
  236. package/packs/open-payments/endpoints.json +297 -297
  237. package/packs/open-payments/policy.json +101 -101
  238. package/packs/opm/assets/download_opm.ps1 +125 -125
  239. package/packs/opm/docs/fields.md +184 -184
  240. package/packs/opm/docs/opm_api.md +71 -71
  241. package/packs/opm/docs/report_patterns.md +83 -83
  242. package/packs/opm/lib/data_dictionary.csv +73 -73
  243. package/packs/pbgc/endpoints.json +483 -483
  244. package/packs/pbgc/policy.json +94 -94
  245. package/packs/philfed/endpoints.json +85 -85
  246. package/packs/philfed/policy.json +94 -94
  247. package/packs/port.json +65 -0
  248. package/packs/regulations/endpoints.json +287 -287
  249. package/packs/regulations/policy.json +86 -86
  250. package/packs/sba/endpoints.json +34 -0
  251. package/packs/sba/policy.json +86 -0
  252. package/packs/sba/source.md +60 -0
  253. package/packs/sec/endpoints.json +236 -236
  254. package/packs/sec/policy.json +86 -86
  255. package/packs/senate-lobbying/endpoints.json +553 -553
  256. package/packs/senate-lobbying/policy.json +99 -99
  257. package/packs/snapqc/endpoints.json +1426 -1426
  258. package/packs/snapqc/policy.json +92 -92
  259. package/packs/treasury/catalog.json +2267 -2267
  260. package/packs/treasury/docs/api_guide.md +245 -245
  261. package/packs/treasury/docs/datasets.md +56 -56
  262. package/packs/treasury/docs/report_patterns.md +126 -126
  263. package/packs/treasury/policy.json +159 -159
  264. package/packs/treasury/source.md +170 -165
  265. package/packs/treasury-tic/endpoints.json +77 -0
  266. package/packs/treasury-tic/policy.json +89 -0
  267. package/packs/treasury-tic/source.md +80 -0
  268. package/packs/treasury-yields/endpoints.json +226 -226
  269. package/packs/treasury-yields/policy.json +86 -86
  270. package/packs/usaspending/endpoints.json +1315 -1315
  271. package/packs/usaspending/policy.json +109 -109
  272. package/packs/uscourts/endpoints.json +22 -0
  273. package/packs/uscourts/policy.json +87 -0
  274. package/packs/uscourts/source.md +56 -0
  275. package/packs/usda-fna/policy.json +133 -133
  276. package/packs/usda-fooddata/endpoints.json +180 -180
  277. package/packs/usda-fooddata/policy.json +94 -94
  278. package/packs/usda-nass/endpoints.json +323 -323
  279. package/packs/usda-nass/policy.json +95 -95
  280. package/packs/usda-outlook/endpoints.json +86 -86
  281. package/packs/usda-outlook/policy.json +109 -109
  282. package/packs/usgs/endpoints.json +313 -313
  283. package/packs/usgs/policy.json +95 -95
  284. package/packs/usitc/endpoints.json +74 -74
  285. package/packs/usitc/policy.json +111 -111
  286. package/packs/uspto/endpoints.json +141 -141
  287. package/packs/uspto/policy.json +95 -95
  288. package/packs/uspto/source.md +1 -1
  289. package/packs/va/endpoints.json +414 -414
  290. package/packs/va/policy.json +101 -101
  291. package/packs/world-bank/endpoints.json +122 -122
  292. package/packs/world-bank/policy.json +101 -101
package/README.md CHANGED
@@ -1,262 +1,286 @@
1
- # data-analyst-mcp
2
-
3
- An MCP server for official U.S. government data. It asks the user the questions that change a headline
4
- number before fetching anything, gets the data from the agency at call time, packages it (CSV, data
5
- dictionary, provenance) and cites every result. It covers 63 sources.
6
-
7
- > **Status: 0.3.** All 63 sources work, along with the analysis and audit tools, hosted mode (streamable HTTP, a
8
- > claude.ai connector) and per-user keys. The test suite runs offline on recorded fixtures.
9
- > One gap remains: usda-fna's three PDF endpoints need a PDF text reader, and return `not_supported`.
10
- > The package is not published to npm yet.
11
-
12
- ## Install
13
-
14
- Requires Node.js 22 or later. Most sources need no key, so steps 2 and 3 are optional.
15
-
16
- ### 1. Add the server to your client
17
-
18
- **Claude Code**
19
-
20
- ```bash
21
- claude mcp add data-analyst -- npx -y data-analyst-mcp
22
- ```
23
-
24
- Add `--scope user` to make it available in every project. To pass a key here, put `-e` before the `--`, for example
25
- `claude mcp add data-analyst -e DATA_GOV_API_KEY=your-key -- npx -y data-analyst-mcp`.
26
-
27
- **Claude Desktop**: `claude_desktop_config.json`, in `~/Library/Application Support/Claude/` (macOS) or
28
- `%APPDATA%\Claude\` (Windows). Settings → Developer → Edit Config opens it. Restart Claude Desktop after editing.
29
-
30
- ```json
31
- {
32
- "mcpServers": {
33
- "data-analyst": {
34
- "command": "npx",
35
- "args": ["-y", "data-analyst-mcp"],
36
- "env": { "DATA_GOV_API_KEY": "your-key" }
37
- }
38
- }
39
- }
40
- ```
41
-
42
- **Cursor**: the same `mcpServers` block in `~/.cursor/mcp.json` (every project) or `.cursor/mcp.json` (one project).
43
-
44
- **VS Code**: `.vscode/mcp.json` uses `servers` instead of `mcpServers`. An `inputs` entry makes VS Code ask for the key
45
- once and store it, so the key is not written into a file you might commit.
46
-
47
- ```json
48
- {
49
- "inputs": [
50
- { "type": "promptString", "id": "data-gov-key", "description": "api.data.gov API key", "password": true }
51
- ],
52
- "servers": {
53
- "data-analyst": {
54
- "type": "stdio",
55
- "command": "npx",
56
- "args": ["-y", "data-analyst-mcp"],
57
- "env": { "DATA_GOV_API_KEY": "${input:data-gov-key}" }
58
- }
59
- }
60
- }
61
- ```
62
-
63
- **Codex**: `~/.codex/config.toml`
64
-
65
- ```toml
66
- [mcp_servers.data-analyst]
67
- command = "npx"
68
- args = ["-y", "data-analyst-mcp"]
69
-
70
- [mcp_servers.data-analyst.env]
71
- DATA_GOV_API_KEY = "your-key"
72
- ```
73
-
74
- Leave out the `env` block if you have no keys, or if you store them with `setup` (step 2).
75
-
76
- **Until the package is published to npm**, build it and point the client at the build:
77
-
78
- ```bash
79
- git clone https://github.com/zsu/data-analyst-mcp.git
80
- ```
81
-
82
- ```bash
83
- cd data-analyst-mcp && npm install && npm run build
84
- ```
85
-
86
- Then use `"command": "node", "args": ["<path>/data-analyst-mcp/dist/bin/cli.js"]` in the configs above, and
87
- `node dist/bin/cli.js setup <source>` in place of `npx -y data-analyst-mcp setup <source>` below.
88
-
89
- ### 2. Add keys (optional)
90
-
91
- Each key is free. Without a key, a source either falls back to a keyless route with lower limits, or offers a
92
- manual download (`manual_bundle`): the user downloads the files in a browser, and the server packages them.
93
-
94
- | Variable | Sources | Without it | Free key |
95
- |---|---|---|---|
96
- | `AQS_API_KEY` + `AQS_EMAIL` | epa-aqs | manual download only | [aqs.epa.gov](https://aqs.epa.gov/data/api/signup?email=YOUR_EMAIL) |
97
- | `BEA_API_KEY` | bea | bulk files for the main tables; the API-only datasets need the key | [apps.bea.gov](https://apps.bea.gov/API/signup/) |
98
- | `BLS_API_KEY` | bls | 25 queries a day, 25 series and 10 years each; no annual averages or catalog titles | [data.bls.gov](https://data.bls.gov/registrationEngine/) |
99
- | `CENSUS_API_KEY` | census | manual download only | [api.census.gov](https://api.census.gov/data/key_signup.html) |
100
- | `DATA_GOV_API_KEY` | college-scorecard, congress, fbi, fda, fec, govinfo, nrel, regulations, usda-fooddata, usgs | `DEMO_KEY` or keyless, at a few requests an hour (fda: 1,000 a day; usgs earthquakes never need a key) | [api.data.gov](https://api.data.gov/signup/) |
101
- | `DOL_API_KEY` | dol | catalog and field lists only; data queries need the key | [dataportal.dol.gov](https://dataportal.dol.gov/registration) |
102
- | `EIA_API_KEY` | eia | `DEMO_KEY`, about 10 requests an hour | [eia.gov](https://www.eia.gov/opendata/register.php) |
103
- | `FRED_API_KEY` | fred | observations only; search, vintages, revision history and GeoFRED need the key | [fredaccount.stlouisfed.org](https://fredaccount.stlouisfed.org/apikeys) |
104
- | `HUD_USER_TOKEN` | hud | manual download only | [huduser.gov](https://www.huduser.gov/hudapi/public/register) |
105
- | `IPUMS_API_KEY` | ipums | build the extract on the IPUMS website (free account) | [account.ipums.org](https://account.ipums.org/api_keys) |
106
- | `LDA_API_KEY` | senate-lobbying | 15 requests a minute instead of 120 | [lda.gov](https://lda.gov/api/register/) |
107
- | `NOAA_API_KEY` | noaa | the keyless data and station-search endpoints; Climate Data Online v2 needs the key | [ncei.noaa.gov](https://www.ncei.noaa.gov/cdo-web/token) |
108
- | `USDA_NASS_API_KEY` | usda-nass | manual download only | [quickstats.nass.usda.gov](https://quickstats.nass.usda.gov/api) |
109
- | `USPTO_API_KEY` | uspto | manual download only | [data.uspto.gov](https://data.uspto.gov/apis/getting-started) |
110
-
111
- Two settings are not keys. SEC asks every client to identify itself, so set `SEC_USER_AGENT` to your name and email
112
- (`"Jane Doe jane@example.com"`). `NWS_USER_AGENT` is optional and does the same for the weather service.
113
-
114
- **Store a key with `setup` (recommended).** It shows the signup link, reads the key with hidden input, and writes
115
- it to `~/.config/data-analyst/keys.json`. The key stays out of client config files, and every client reads it. It
116
- works mid-session, with no restart.
117
-
118
- ```bash
119
- npx -y data-analyst-mcp setup congress
120
- ```
121
-
122
- `setup` takes any source that uses the key: `setup congress` stores `DATA_GOV_API_KEY`, and all 10 api.data.gov
123
- sources use it. `setup epa-aqs` also asks for `AQS_EMAIL`. Or put the variables in the client's `env` block, as in step 1.
124
- [API keys](#api-keys) lists every place the server looks.
125
-
126
- ### 3. Check it
127
-
128
- Ask your assistant: *"Is my api.data.gov key set up?"* The `check_key` tool reports whether the key was found and where,
129
- never its value. To list only the sources you can use, start the server with `--hide-unconfigured` (see
130
- [Options](#options)).
131
-
132
- ### 4. Try it
133
-
134
- - *"How has the unemployment rate compared with CPI inflation since 2020?"*
135
- - *"What is the median household income in each county of Ohio?"*
136
- - *"Which drugs had the most reported adverse events last year?"*
137
- - *"How much did each federal agency spend in fiscal year 2024?"*
138
- - *"How many unhealthy air-quality days did Phoenix have in 2023?"*
139
-
140
- The assistant asks the questions that change the answer first (which measure, which years, which population),
141
- then fetches, computes and cites.
142
-
143
- To host the server for claude.ai or a team, see [docs/hosting.md](docs/hosting.md).
144
-
145
- ## How it works
146
-
147
- | Tool | What it does |
148
- |---|---|
149
- | `guide` | the method: framing, asking only critical questions, the accuracy checklist, combining sources |
150
- | `find_sources` | ranks the sources for a question, or lists them all |
151
- | `source_brief` | one source's playbook, its **questions_to_ask**, key status, rules and request index |
152
- | `request_schema` | full parameters of the requests to use; searches a source's catalog |
153
- | `record_decisions` | how each critical question was settled (answered, Don't know, skipped, not asked and why) |
154
- | `fetch` | downloads into the session workspace; returns a summary, the files, the citation and notes |
155
- | `manual_bundle`, `ingest` | a one-command download for the user's own computer, then packaging what they downloaded |
156
- | `compute` | builds exhibits from the full tables with declarative steps (a whitelisted expression language, no eval); the steps are recorded for `rerun` |
157
- | `facts`, `write_table`, `cite` | register the numbers cited, write the benchmark and sensitivity tables, snapshot cited pages |
158
- | `audit_answer`, `rerun` | the release gate: every number in the answer is a registered fact, the method record is complete, and the analysis reproduces |
159
- | `build_report`, `style_check`, `audit_report` | an HTML report and replication ZIP, only when asked |
160
- | `handoff` | the per-source data hand-off |
161
- | `check_key` | whether a key is set up (never shows it) |
162
- | `read_file` | a small text file from the workspace |
163
-
164
- **Asking before fetching is enforced, not just suggested.** `fetch` returns `gate_blocked` until, for that
165
- source, the model has read `source_brief` and the schemas of the requests it uses, and has recorded how each
166
- critical question was settled. The model asks the questions in chat, in one round. A blocking question that
167
- the user skips is asked once more. The server also exposes an `analyze` prompt and `source://<id>`
168
- resources, for clients that let users pick prompts or attach resources.
169
-
170
- **Results** have one shape. Success: `{status: "ok" | "partial", summary, files, citation, notes}`. Failure:
171
- `{status: "error", code, message, fix, retry_after_s?}`. The codes are `invalid_request`, `not_found`,
172
- `not_supported`, `agency_rejected`, `agency_unavailable`, `key_missing`, `key_rejected`, `rate_limited`,
173
- `gate_blocked` and `server_error`.
174
-
175
- ## Options
176
-
177
- | Option (flag / environment) | What it does |
178
- |---|---|
179
- | `--sources fred,treasury` / `DATA_ANALYST_SOURCES` | serve only these sources |
180
- | `--domains economy,health` / `DATA_ANALYST_DOMAINS` | serve only the sources in these domains |
181
- | `--hide-unconfigured` / `DATA_ANALYST_HIDE_UNCONFIGURED=1` | leave out of listings the sources whose required key is not set up |
182
- | `--workspace <folder>` / `DATA_ANALYST_WORKSPACE` | (stdio) one fixed analysis folder, so a fetch is reused after a restart |
183
-
184
- ```json
185
- { "mcpServers": { "data-analyst": { "command": "npx", "args": ["-y", "data-analyst-mcp", "--domains", "economy,health"] } } }
186
- ```
187
-
188
- The tool list stays the same size whatever is enabled: sources are found with `find_sources`, not loaded as
189
- tools.
190
-
191
- Every result lists its upstream requests (`requests`: method, credential-free URL, status, cached, time), and
192
- `citation` names the publisher, page and retrieval date. Requests are rate-limited per host (a token bucket),
193
- retried with backoff on 429 and 5xx (honoring Retry-After), and kept within each agency's per-minute budgets.
194
-
195
- **Caching follows each source's terms.**
196
- - A source whose policy allows persistent copies (`cache.mode: persistent`) can be cached on disk in
197
- `DATA_ANALYST_CACHE` (default `~/.cache/data-analyst`). census and bea do; opm's terms allow it, but its port
198
- downloads again for now.
199
- - Most sources allow reuse only inside the analysis folder, and FRED none at all. For those, a fixed
200
- `--workspace` gives reuse across restarts without keeping copies anywhere else.
201
-
202
- ## As a library
203
-
204
- ```ts
205
- import { route, brief, fetchSource, compute, registerFacts } from "data-analyst-mcp";
206
-
207
- const r = await fetchSource("cdc", { description: "NY deaths 2017", requests: [{ name: "ny", endpoint: "query",
208
- params: { dataset: "leading_death", $where: "state = 'New York' AND year = '2017'" } }] }, { out: "./out/ny" });
209
- console.log(r.summary.tables[0].rows, r.citation.text);
210
- ```
211
-
212
- - **The functions:** the same sources, engine, analysis and audits as the server. The exports are `listSources`,
213
- `route`, `brief`, `requestSchema`, `fetchSource`, `ingest`, `manualBundle`, `compute`, `registerFacts`,
214
- `writeTable`, `rerun`, `recordDecisions`, `auditAnswer`, `buildReport`, `auditReport`, `createServer` and
215
- `createApp`, plus their types.
216
- - **No ask-first gate:** it is for assistants, so the library leaves it out.
217
- - **Errors:** a failure throws `ToolError`; its `failure` holds the code and the fix.
218
-
219
- ## API keys
220
-
221
- [Install, step 2](#2-add-keys-optional) lists the keys and how to get them. When a fetch needs a key that is not set up,
222
- `fetch` returns `key_missing` with a `setup` command for **you** to run in your own terminal. The model never asks
223
- for a key in chat. `setup` writes `~/.config/data-analyst/keys.json`.
224
-
225
- The local (stdio) server looks for a key in this order. `DATA_GOV_API_KEY` is the example; each source's variable is named in
226
- its `source_brief`.
227
-
228
- 1. The `DATA_GOV_API_KEY` environment variable, for example in the MCP client's `env` block.
229
- 2. The file named by `DATA_GOV_API_KEY_FILE` (for secret managers and mounted secrets).
230
- 3. `"env": {"DATA_GOV_API_KEY": "..."}` in `~/.config/data-analyst/keys.json` (or `$DATA_ANALYST_CONFIG_DIR/keys.json`).
231
- `setup` writes this file.
232
- 4. `"env": {"DATA_GOV_API_KEY": "..."}` in Claude Code's `~/.claude/settings.json` (or `$CLAUDE_CONFIG_DIR/settings.json`).
233
- 5. `~/.data-gov/api_key`, a file that holds only the key.
234
-
235
- The files are read again on each lookup, so a key stored during a session works without a restart.
236
-
237
- No key value ever appears in a tool result: every output is redacted, and a test checks this. The hosted server
238
- reads keys only from its environment and from each user's encrypted store (see [docs/hosting.md](docs/hosting.md)).
239
-
240
- ## Hosted mode (claude.ai connector)
241
-
242
- `data-analyst-mcp serve --http` serves MCP at `/mcp` over streamable HTTP. With `DATA_ANALYST_ACCOUNTS=1`, users
243
- sign in through OAuth and store their own API keys on a write-only page. The keys are encrypted at rest, and the
244
- model never sees them. See [docs/hosting.md](docs/hosting.md) and the `Dockerfile`.
245
-
246
- ## Workspace
247
-
248
- Each session writes to its own folder under `$DATA_ANALYST_OUT` (default: the system temp folder,
249
- `data-analyst-mcp/<session>`), with `data/<source>/` and `decisions.json` inside. Nothing is written inside the
250
- package.
251
-
252
- ## Development
253
-
254
- ```bash
255
- npm install
256
- npm test
257
- npm run build
258
- npm run smoke
259
- ```
260
-
261
- - `npm test` runs offline, on recorded fixtures.
262
- - `npm run smoke` drives the built server over stdio and makes one live fetch.
1
+ # data-analyst-mcp
2
+
3
+ An MCP server for official U.S. government data. It asks the user the questions that change a headline
4
+ number before fetching anything, gets the data from the agency at call time, packages it (CSV, data
5
+ dictionary, provenance) and cites every result. It covers 76 sources.
6
+
7
+ > **Status: 0.3.** All 76 sources work, along with the analysis and audit tools, hosted mode (streamable HTTP, a
8
+ > claude.ai connector) and per-user keys. The test suite runs offline on recorded fixtures.
9
+ > One gap remains: usda-fna's three PDF endpoints need a PDF text reader, and return `not_supported`.
10
+ > Four sources are manual only, because their sites refuse scripts: cdc-wonder, hud-ahar, foreign-assistance and
11
+ > cpsc's NEISS endpoint (`manual_bundle` gives the links, `ingest` reads the saved file).
12
+ > The package is not published to npm yet.
13
+
14
+ ## Install
15
+
16
+ Requires Node.js 22 or later. Most sources need no key, so steps 2 and 3 are optional.
17
+
18
+ ### 1. Add the server to your client
19
+
20
+ **Claude Code**
21
+
22
+ ```bash
23
+ claude mcp add data-analyst -- npx -y data-analyst-mcp
24
+ ```
25
+
26
+ Add `--scope user` to make it available in every project. To pass a key here, put `-e` before the `--`, for example
27
+ `claude mcp add data-analyst -e DATA_GOV_API_KEY=your-key -- npx -y data-analyst-mcp`.
28
+
29
+ **Claude Desktop**: `claude_desktop_config.json`, in `~/Library/Application Support/Claude/` (macOS) or
30
+ `%APPDATA%\Claude\` (Windows). Settings → Developer → Edit Config opens it. Restart Claude Desktop after editing.
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "data-analyst": {
36
+ "command": "npx",
37
+ "args": ["-y", "data-analyst-mcp"],
38
+ "env": { "DATA_GOV_API_KEY": "your-key" }
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ **Cursor**: the same `mcpServers` block in `~/.cursor/mcp.json` (every project) or `.cursor/mcp.json` (one project).
45
+
46
+ **VS Code**: `.vscode/mcp.json` uses `servers` instead of `mcpServers`. An `inputs` entry makes VS Code ask for the key
47
+ once and store it, so the key is not written into a file you might commit.
48
+
49
+ ```json
50
+ {
51
+ "inputs": [
52
+ { "type": "promptString", "id": "data-gov-key", "description": "api.data.gov API key", "password": true }
53
+ ],
54
+ "servers": {
55
+ "data-analyst": {
56
+ "type": "stdio",
57
+ "command": "npx",
58
+ "args": ["-y", "data-analyst-mcp"],
59
+ "env": { "DATA_GOV_API_KEY": "${input:data-gov-key}" }
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ **Codex**: `~/.codex/config.toml`
66
+
67
+ ```toml
68
+ [mcp_servers.data-analyst]
69
+ command = "npx"
70
+ args = ["-y", "data-analyst-mcp"]
71
+
72
+ [mcp_servers.data-analyst.env]
73
+ DATA_GOV_API_KEY = "your-key"
74
+ ```
75
+
76
+ Leave out the `env` block if you have no keys, or if you store them with `setup` (step 2).
77
+
78
+ **Until the package is published to npm**, build it and point the client at the build:
79
+
80
+ ```bash
81
+ git clone https://github.com/zsu/data-analyst-mcp.git
82
+ ```
83
+
84
+ ```bash
85
+ cd data-analyst-mcp && npm install && npm run build
86
+ ```
87
+
88
+ Then use `"command": "node", "args": ["<path>/data-analyst-mcp/dist/bin/cli.js"]` in the configs above, and
89
+ `node dist/bin/cli.js setup <source>` in place of `npx -y data-analyst-mcp setup <source>` below.
90
+
91
+ ### 2. Add keys (optional)
92
+
93
+ Each key is free. Without a key, a source either falls back to a keyless route with lower limits, or offers a
94
+ manual download (`manual_bundle`): the user downloads the files in a browser, and the server packages them.
95
+
96
+ | Variable | Sources | Without it | Free key |
97
+ |---|---|---|---|
98
+ | `AQS_API_KEY` + `AQS_EMAIL` | epa-aqs | manual download only | [aqs.epa.gov](https://aqs.epa.gov/data/api/signup?email=YOUR_EMAIL) |
99
+ | `BEA_API_KEY` | bea | bulk files for the main tables; the API-only datasets need the key | [apps.bea.gov](https://apps.bea.gov/API/signup/) |
100
+ | `BLS_API_KEY` | bls | 25 queries a day, 25 series and 10 years each; no annual averages or catalog titles | [data.bls.gov](https://data.bls.gov/registrationEngine/) |
101
+ | `CENSUS_API_KEY` | census | manual download only | [api.census.gov](https://api.census.gov/data/key_signup.html) |
102
+ | `DATA_GOV_API_KEY` | college-scorecard, congress, fbi, fda, fec, govinfo, nrel, regulations, usda-fooddata, usgs | `DEMO_KEY` or keyless, at a few requests an hour (fda: 1,000 a day; usgs earthquakes never need a key) | [api.data.gov](https://api.data.gov/signup/) |
103
+ | `DOL_API_KEY` | dol | catalog and field lists only; data queries need the key | [dataportal.dol.gov](https://dataportal.dol.gov/registration) |
104
+ | `EIA_API_KEY` | eia | `DEMO_KEY`, about 10 requests an hour | [eia.gov](https://www.eia.gov/opendata/register.php) |
105
+ | `FRED_API_KEY` | fred | observations only; search, vintages, revision history and GeoFRED need the key | [fredaccount.stlouisfed.org](https://fredaccount.stlouisfed.org/apikeys) |
106
+ | `HUD_USER_TOKEN` | hud | manual download only | [huduser.gov](https://www.huduser.gov/hudapi/public/register) |
107
+ | `IPUMS_API_KEY` | ipums | build the extract on the IPUMS website (free account) | [account.ipums.org](https://account.ipums.org/api_keys) |
108
+ | `LDA_API_KEY` | senate-lobbying | 15 requests a minute instead of 120 | [lda.gov](https://lda.gov/api/register/) |
109
+ | `NOAA_API_KEY` | noaa | the keyless data and station-search endpoints; Climate Data Online v2 needs the key | [ncei.noaa.gov](https://www.ncei.noaa.gov/cdo-web/token) |
110
+ | `USDA_NASS_API_KEY` | usda-nass | manual download only | [quickstats.nass.usda.gov](https://quickstats.nass.usda.gov/api) |
111
+ | `USPTO_API_KEY` | uspto | manual download only | [data.uspto.gov](https://data.uspto.gov/apis/getting-started) |
112
+
113
+ Two settings are not keys. SEC asks every client to identify itself, so set `SEC_USER_AGENT` to your name and email
114
+ (`"Jane Doe jane@example.com"`). `NWS_USER_AGENT` is optional and does the same for the weather service.
115
+
116
+ **Store a key with `setup` (recommended).** It shows the signup link, reads the key with hidden input, and writes
117
+ it to `~/.config/data-analyst/keys.json`. The key stays out of client config files, and every client reads it. It
118
+ works mid-session, with no restart.
119
+
120
+ ```bash
121
+ npx -y data-analyst-mcp setup congress
122
+ ```
123
+
124
+ `setup` takes any source that uses the key: `setup congress` stores `DATA_GOV_API_KEY`, and all 10 api.data.gov
125
+ sources use it. `setup epa-aqs` also asks for `AQS_EMAIL`. Or put the variables in the client's `env` block, as in step 1.
126
+ [API keys](#api-keys) lists every place the server looks.
127
+
128
+ ### 3. Check it
129
+
130
+ Ask your assistant: *"Is my api.data.gov key set up?"* The `check_key` tool reports whether the key was found and where,
131
+ never its value. To list only the sources you can use, start the server with `--hide-unconfigured` (see
132
+ [Options](#options)).
133
+
134
+ ### 4. Try it
135
+
136
+ - *"How has the unemployment rate compared with CPI inflation since 2020?"*
137
+ - *"What is the median household income in each county of Ohio?"*
138
+ - *"Which drugs had the most reported adverse events last year?"*
139
+ - *"How much did each federal agency spend in fiscal year 2024?"*
140
+ - *"How many unhealthy air-quality days did Phoenix have in 2023?"*
141
+
142
+ The assistant asks the questions that change the answer first (which measure, which years, which population),
143
+ then fetches, computes and cites.
144
+
145
+ To host the server for claude.ai or a team, see [docs/hosting.md](docs/hosting.md).
146
+
147
+ ## How it works
148
+
149
+ | Tool | What it does |
150
+ |---|---|
151
+ | `guide` | the method: framing, asking only critical questions, the accuracy checklist, combining sources |
152
+ | `find_sources` | ranks the sources for a question, or lists them all |
153
+ | `source_brief` | one source's playbook, its **questions_to_ask**, key status, rules and request index |
154
+ | `request_schema` | full parameters of the requests to use; searches a source's catalog |
155
+ | `record_decisions` | how each critical question was settled (answered, Don't know, skipped, not asked and why) |
156
+ | `fetch` | downloads into the session workspace; returns a summary, the files, the citation and notes |
157
+ | `manual_bundle`, `ingest` | a one-command download for the user's own computer, then packaging what they downloaded |
158
+ | `compute` | builds exhibits from the full tables with declarative steps (a whitelisted expression language, no eval); the steps are recorded for `rerun` |
159
+ | `facts`, `write_table`, `cite` | register the numbers cited, write the benchmark and sensitivity tables, snapshot cited pages |
160
+ | `audit_answer`, `rerun` | the release gate: every number in the answer is a registered fact, the method record is complete, and the analysis reproduces |
161
+ | `build_report`, `style_check`, `audit_report` | an HTML report and replication ZIP, only when asked |
162
+ | `handoff` | the per-source data hand-off |
163
+ | `check_key` | whether a key is set up (never shows it) |
164
+ | `read_file` | a small text file from the workspace |
165
+
166
+ **Asking before fetching is enforced, not just suggested.** `fetch` returns `gate_blocked` until, for that
167
+ source, the model has read `source_brief` and the schemas of the requests it uses, and has recorded how each
168
+ critical question was settled. The model asks the questions in chat, in one round. A blocking question that
169
+ the user skips is asked once more. The server also exposes an `analyze` prompt and `source://<id>`
170
+ resources, for clients that let users pick prompts or attach resources.
171
+
172
+ **Results** have one shape. Success: `{status: "ok" | "partial", summary, files, citation, notes}`. Failure:
173
+ `{status: "error", code, message, fix, retry_after_s?}`. The codes are `invalid_request`, `not_found`,
174
+ `not_supported`, `agency_rejected`, `agency_unavailable`, `key_missing`, `key_rejected`, `rate_limited`,
175
+ `gate_blocked` and `server_error`.
176
+
177
+ ## Options
178
+
179
+ | Option (flag / environment) | What it does |
180
+ |---|---|
181
+ | `--sources fred,treasury` / `DATA_ANALYST_SOURCES` | serve only these sources |
182
+ | `--domains economy,health` / `DATA_ANALYST_DOMAINS` | serve only the sources in these domains |
183
+ | `--hide-unconfigured` / `DATA_ANALYST_HIDE_UNCONFIGURED=1` | leave out of listings the sources whose required key is not set up |
184
+ | `--workspace <folder>` / `DATA_ANALYST_WORKSPACE` | (stdio) one fixed analysis folder, so a fetch is reused after a restart |
185
+
186
+ ```json
187
+ { "mcpServers": { "data-analyst": { "command": "npx", "args": ["-y", "data-analyst-mcp", "--domains", "economy,health"] } } }
188
+ ```
189
+
190
+ The tool list stays the same size whatever is enabled: sources are found with `find_sources`, not loaded as
191
+ tools.
192
+
193
+ Every result lists its upstream requests (`requests`: method, credential-free URL, status, cached, time), and
194
+ `citation` names the publisher, page and retrieval date. Requests are rate-limited per host (a token bucket),
195
+ retried with backoff on 429 and 5xx (honoring Retry-After), and kept within each agency's per-minute budgets.
196
+
197
+ **Caching follows each source's terms.**
198
+ - A source whose policy allows persistent copies (`cache.mode: persistent`) can be cached on disk in
199
+ `DATA_ANALYST_CACHE` (default `~/.cache/data-analyst`). census and bea do; opm's terms allow it, but its port
200
+ downloads again for now.
201
+ - Most sources allow reuse only inside the analysis folder, and FRED none at all. For those, a fixed
202
+ `--workspace` gives reuse across restarts without keeping copies anywhere else.
203
+
204
+ ## As a library
205
+
206
+ ```ts
207
+ import { route, brief, fetchSource, compute, registerFacts } from "data-analyst-mcp";
208
+
209
+ const r = await fetchSource("cdc", { description: "NY deaths 2017", requests: [{ name: "ny", endpoint: "query",
210
+ params: { dataset: "leading_death", $where: "state = 'New York' AND year = '2017'" } }] }, { out: "./out/ny" });
211
+ console.log(r.summary.tables[0].rows, r.citation.text);
212
+ ```
213
+
214
+ - **The functions:** the same sources, engine, analysis and audits as the server. The exports are `listSources`,
215
+ `route`, `brief`, `requestSchema`, `fetchSource`, `ingest`, `manualBundle`, `compute`, `registerFacts`,
216
+ `writeTable`, `rerun`, `recordDecisions`, `auditAnswer`, `buildReport`, `auditReport`, `createServer` and
217
+ `createApp`, plus their types.
218
+ - **No ask-first gate:** it is for assistants, so the library leaves it out.
219
+ - **Errors:** a failure throws `ToolError`; its `failure` holds the code and the fix.
220
+
221
+ ## API keys
222
+
223
+ [Install, step 2](#2-add-keys-optional) lists the keys and how to get them. When a fetch needs a key that is not set up,
224
+ `fetch` returns `key_missing` with a `setup` command for **you** to run in your own terminal. The model never asks
225
+ for a key in chat. `setup` writes `~/.config/data-analyst/keys.json`.
226
+
227
+ The local (stdio) server looks for a key in this order. `DATA_GOV_API_KEY` is the example; each source's variable is named in
228
+ its `source_brief`.
229
+
230
+ 1. The `DATA_GOV_API_KEY` environment variable, for example in the MCP client's `env` block.
231
+ 2. The file named by `DATA_GOV_API_KEY_FILE` (for secret managers and mounted secrets).
232
+ 3. `"env": {"DATA_GOV_API_KEY": "..."}` in `~/.config/data-analyst/keys.json` (or `$DATA_ANALYST_CONFIG_DIR/keys.json`).
233
+ `setup` writes this file.
234
+ 4. `"env": {"DATA_GOV_API_KEY": "..."}` in Claude Code's `~/.claude/settings.json` (or `$CLAUDE_CONFIG_DIR/settings.json`).
235
+ 5. `~/.data-gov/api_key`, a file that holds only the key.
236
+
237
+ The files are read again on each lookup, so a key stored during a session works without a restart.
238
+
239
+ What the server guarantees, and tests check:
240
+
241
+ - **No key in any result.** Every tool result, error, prompt and resource is redacted for every key the server can
242
+ find, in every form it can be echoed in (as is, URL-encoded, JSON-escaped).
243
+ - **No tool reads a key file.** A path the model names (`ingest`, a `for_each` table, `report.json` paths,
244
+ `read_file`) is refused when it is one of the files above, a `.env` file, `~/.ssh`, `~/.aws` or a similar place,
245
+ or when the file holds a key.
246
+ - **No key in a written file.** A key an agency echoes is replaced with `[REDACTED]` in every file written to the
247
+ workspace (the result says which), and never reaches the download cache or a replication package.
248
+ - **A key goes only to its agency:** never along a next-page link to another site, never from https to http. On a
249
+ redirect to another host, a key in the URL or a header is dropped; a key in the request body (BLS) follows a
250
+ 307/308 redirect wherever it points.
251
+
252
+ **What the server cannot stop:** an assistant that has its own file or shell tools (Claude Code does) can open the
253
+ key files itself. `setup` prints the Claude Code rule that blocks this; add it to the `permissions.deny` list of your
254
+ `~/.claude/settings.json`, for example:
255
+
256
+ ```json
257
+ { "permissions": { "deny": ["Read(~/.config/data-analyst/**)", "Edit(~/.config/data-analyst/**)"] } }
258
+ ```
259
+
260
+ Prefer `setup` (or a secret manager through `<VAR>_FILE`) over the `env` block of `~/.claude/settings.json`: that
261
+ file is one Claude Code reads anyway. The hosted server reads keys only from its environment and from each user's
262
+ encrypted store (see [docs/hosting.md](docs/hosting.md)).
263
+
264
+ ## Hosted mode (claude.ai connector)
265
+
266
+ `data-analyst-mcp serve --http` serves MCP at `/mcp` over streamable HTTP. With `DATA_ANALYST_ACCOUNTS=1`, users
267
+ sign in through OAuth and store their own API keys on a write-only page. The keys are encrypted at rest, and the
268
+ model never sees them. See [docs/hosting.md](docs/hosting.md) and the `Dockerfile`.
269
+
270
+ ## Workspace
271
+
272
+ Each session writes to its own folder under `$DATA_ANALYST_OUT` (default: the system temp folder,
273
+ `data-analyst-mcp/<session>`), with `data/<source>/` and `decisions.json` inside. Nothing is written inside the
274
+ package.
275
+
276
+ ## Development
277
+
278
+ ```bash
279
+ npm install
280
+ npm test
281
+ npm run build
282
+ npm run smoke
283
+ ```
284
+
285
+ - `npm test` runs offline, on recorded fixtures.
286
+ - `npm run smoke` drives the built server over stdio and makes one live fetch.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Bureau of Justice Statistics. NCVS Select records from api.ojp.gov (Socrata-style SODA) and report table packages
3
+ * (zips of CSVs) from bjs.ojp.gov, both read by core; this adapter keeps requests off the site's bot check.
4
+ *
5
+ * Verified 2026-11-07: plain filtered queries ($where, $select of columns, $limit/$offset) answer JSON; any
6
+ * aggregate ($select with sum(), count(*), with or without $group) gets a Cloudflare "Just a moment..." challenge
7
+ * page (HTTP 403, which core reports as "blocked", or 200 HTML) instead. checkSpec refuses aggregates before a
8
+ * request is sent, and checkError names an HTTP 200 challenge page. The challenge is never answered: aggregate the
9
+ * rows with compute.
10
+ */
11
+ import type { Adapter } from "../core/packs.js";
12
+ declare const adapter: Adapter;
13
+ export default adapter;