@driftwest/mcp-server 1.4.1 → 1.7.1

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/index.js CHANGED
@@ -660,14 +660,16 @@ server.tool(
660
660
  // ── Prairie Storm-Day Index (Alberta, GOES GLM 2018+) ──
661
661
  // Gated server-side by its own key (sdi_*), so these pass the local tier gate.
662
662
  const STORM_KEY = process.env.DRIFTWEST_STORM_KEY || '';
663
- async function stormCall(endpoint, params) {
663
+ async function stormCall(endpoint, params, product = 'storm-days') {
664
664
  const qs = new URLSearchParams(Object.entries(params).filter(([, v]) => v !== undefined && v !== null).map(([k, v]) => [k, String(v)]));
665
665
  const headers = STORM_KEY ? { 'X-API-Key': STORM_KEY } : {};
666
- const res = await fetch(`${BASE_URL}/api/storm-days/${endpoint}?${qs}`, { headers });
666
+ const res = await fetch(`${BASE_URL}/api/${product}/${endpoint}?${qs}`, { headers });
667
667
  const body = await res.text();
668
668
  if (!res.ok) {
669
669
  let msg = body; try { msg = JSON.parse(body).error; } catch {}
670
- return { content: [{ type: 'text', text: `Storm-Day Index ${res.status}: ${msg}${res.status === 402 ? '\nSet DRIFTWEST_STORM_KEY to a Pro key: https://driftwest.xyz/storm-days.html' : ''}` }], isError: res.status >= 500 };
670
+ const name = { 'smoke-days': 'Smoke-Day Index', 'dry-lightning': 'Dry Lightning Days', greenness: 'Field Greenness Anomaly' }[product] || 'Storm-Day Index';
671
+ const page = product === 'greenness' ? 'field-greenness' : product;
672
+ return { content: [{ type: 'text', text: `${name} ${res.status}: ${msg}${res.status === 402 ? `\nSet DRIFTWEST_STORM_KEY to a Pro key: https://driftwest.xyz/${page}.html` : ''}` }], isError: res.status >= 500 };
671
673
  }
672
674
  return { content: [{ type: 'text', text: body }] };
673
675
  }
@@ -705,6 +707,125 @@ server.tool(
705
707
  async ({ bbox, year }) => stormCall('grid', { bbox, year })
706
708
  );
707
709
 
710
+ // ── Prairie Smoke-Day Index (Alberta, NOAA HMS 2006+) — same key + grid as Storm-Day ──
711
+ server.tool(
712
+ 'smoke_days_point',
713
+ 'Prairie Smoke-Day Index: days per fire season (May 1–Oct 31) with medium/heavy wildfire smoke OVERHEAD at any Alberta lat/lon, 2006–present, from NOAA HMS analyst-drawn satellite smoke polygons on a ~5 km grid. Returns medium+, heavy and any-smoke days per year, the normal, each year vs normal and rank, this season-to-date vs normal-to-date, and the last 14 days. Use for solar yield shortfalls/P90, outdoor event or filming risk, seasonal planning. Smoke aloft counts too: this is NOT air quality, AQI, PM2.5 or a health measure. Free without a key (20 lookups/day).',
714
+ {
715
+ lat: z.number().describe('Latitude, 48.9 to 56.6'),
716
+ lon: z.number().describe('Longitude, -120.1 to -109.9')
717
+ },
718
+ async ({ lat, lon }) => stormCall('point', { lat, lon }, 'smoke-days')
719
+ );
720
+
721
+ server.tool(
722
+ 'smoke_days_season',
723
+ 'Prairie Smoke-Day Index: every smoke-overhead day (with HMS density light/medium/heavy) for one Alberta lat/lon in a given season, plus days with no HMS file. Needs a Smoke Pro or Storm+Smoke key (DRIFTWEST_STORM_KEY).',
724
+ {
725
+ lat: z.number().describe('Latitude'),
726
+ lon: z.number().describe('Longitude'),
727
+ year: z.number().int().min(2006).optional().describe('Season year (default latest)')
728
+ },
729
+ async ({ lat, lon, year }) => stormCall('season', { lat, lon, year }, 'smoke-days')
730
+ );
731
+
732
+ server.tool(
733
+ 'smoke_days_grid',
734
+ 'Prairie Smoke-Day Index: medium+/heavy/any smoke-overhead days for every 0.05° cell in a bounding box, for one season (with vs-normal) or the normal. Needs a Smoke Pro or Storm+Smoke key (DRIFTWEST_STORM_KEY); up to 2,500 cells per call.',
735
+ {
736
+ bbox: z.string().describe('lat0,lon0,lat1,lon1 e.g. "49.5,-113.5,50.5,-112"'),
737
+ year: z.union([z.number().int(), z.literal('normal')]).optional().describe('Year, or "normal" (default)')
738
+ },
739
+ async ({ bbox, year }) => stormCall('grid', { bbox, year }, 'smoke-days')
740
+ );
741
+
742
+ // ── Dry Lightning Days (Alberta, GOES GLM + ERA5/ECCC rain, 2018+) — same key + grid as Storm-Day ──
743
+ server.tool(
744
+ 'dry_lightning_point',
745
+ 'Dry Lightning Days: per ~5 km Alberta cell, days per season (May 15–Sep 15) with GOES GLM lightning but <2.5 mm rain that day and the day before (a wildfire-start setup), 2018–present. Returns dry days, strong dry days (10+ flashes), lightning days and dry share per year, the normal, each year vs normal and rank, and the latest dry lightning days at the cell. Rain from ERA5 reanalysis (history) and ECCC RDPA (recent). Use for wildfire exposure of a site, forestry block, county or insured property. A count of fire-start setups, NOT a fire-danger rating or ignition forecast. Free without a key (20 lookups/day).',
746
+ {
747
+ lat: z.number().describe('Latitude, 48.9 to 56.6'),
748
+ lon: z.number().describe('Longitude, -120.1 to -109.9')
749
+ },
750
+ async ({ lat, lon }) => stormCall('point', { lat, lon }, 'dry-lightning')
751
+ );
752
+
753
+ server.tool(
754
+ 'dry_lightning_season',
755
+ 'Dry Lightning Days: every lightning day for one Alberta lat/lon in a season with its flash count, rain that day and 48 h rain, flagged dry (<2.5 mm), plus days whose rain is not available yet. Needs a Storm + Dry Lightning Pro key (DRIFTWEST_STORM_KEY).',
756
+ {
757
+ lat: z.number().describe('Latitude'),
758
+ lon: z.number().describe('Longitude'),
759
+ year: z.number().int().min(2018).optional().describe('Season year (default latest)')
760
+ },
761
+ async ({ lat, lon, year }) => stormCall('season', { lat, lon, year }, 'dry-lightning')
762
+ );
763
+
764
+ server.tool(
765
+ 'dry_lightning_grid',
766
+ 'Dry Lightning Days: dry lightning days, strong dry days, lightning days and dry share for every 0.05° cell in a bounding box, for one season (with vs-normal) or the normal. Cells with no lightning are omitted. Needs a Storm + Dry Lightning Pro key (DRIFTWEST_STORM_KEY); up to 2,500 cells per call.',
767
+ {
768
+ bbox: z.string().describe('lat0,lon0,lat1,lon1 e.g. "54.5,-116,55.5,-114"'),
769
+ year: z.union([z.number().int(), z.literal('normal')]).optional().describe('Year, or "normal" (default)')
770
+ },
771
+ async ({ bbox, year }) => stormCall('grid', { bbox, year }, 'dry-lightning')
772
+ );
773
+
774
+ server.tool(
775
+ 'dry_lightning_recent',
776
+ 'Dry Lightning Days: where did dry lightning land lately? Every Alberta 0.05° cell with lightning and <2.5 mm 48 h rain in the last 1–14 data days (in season, updated each morning), with flashes and rain. Optional bbox. Use to plan holdover-fire patrols or detection flights. Needs a Storm + Dry Lightning Pro key (DRIFTWEST_STORM_KEY).',
777
+ {
778
+ days: z.number().int().min(1).max(14).optional().describe('How many recent days (default 3)'),
779
+ bbox: z.string().optional().describe('Optional lat0,lon0,lat1,lon1 filter')
780
+ },
781
+ async ({ days, bbox }) => stormCall('recent', { days, bbox }, 'dry-lightning')
782
+ );
783
+
784
+ // ── Field Greenness Anomaly (Alberta quarter sections, Sentinel-2 NDVI 2020+) — same key as Storm-Day ──
785
+ server.tool(
786
+ 'greenness_quarter',
787
+ 'Field Greenness Anomaly: for one Alberta quarter section (legal land description like SE-4-24-24-W4, or a lat/lon inside it), the latest 5-day Sentinel-2 NDVI reading vs the same 5-day point in that quarter\'s own previous 5 seasons (% above/below normal, plain difference, look age), plus last season\'s June–August mean vs normal and its peak. Quarters in townships not yet computed are queued (usually ready next morning). Use for ag lending, input sales, farmland due diligence, adjusting, grain marketing. NOT a yield estimate: a different crop, late seeding or hay cutting also moves it. Free without a key (20 lookups/day).',
788
+ {
789
+ lld: z.string().optional().describe('Quarter legal land description, e.g. "SE-4-24-24-W4"'),
790
+ lat: z.number().optional().describe('Latitude (instead of lld)'),
791
+ lon: z.number().optional().describe('Longitude (instead of lld)')
792
+ },
793
+ async ({ lld, lat, lon }) => stormCall('quarter', { lld, lat, lon }, 'greenness')
794
+ );
795
+
796
+ server.tool(
797
+ 'greenness_history',
798
+ 'Field Greenness Anomaly: every 5-day reading (May–Sep) for one Alberta quarter section for a season or all seasons since 2020, each with NDVI, normal, % and difference, plus a per-season summary (June–August vs normal, peak NDVI and date, clear looks). looks=true adds every raw clear Sentinel-2 look. Needs a Field Greenness Pro key (DRIFTWEST_STORM_KEY).',
799
+ {
800
+ lld: z.string().optional().describe('Quarter LLD, e.g. "SE-4-24-24-W4"'),
801
+ lat: z.number().optional(), lon: z.number().optional(),
802
+ year: z.union([z.number().int(), z.literal('all')]).optional().describe('Season year or "all" (default latest)'),
803
+ looks: z.boolean().optional().describe('Include raw clear looks')
804
+ },
805
+ async ({ lld, lat, lon, year, looks }) => stormCall('history', { lld, lat, lon, year, looks: looks ? 1 : undefined }, 'greenness')
806
+ );
807
+
808
+ server.tool(
809
+ 'greenness_township',
810
+ 'Field Greenness Anomaly: every quarter in one Alberta township (TWP-RGE-W meridian) at one 5-day reading (default latest), with NDVI, normal and % vs normal, plus the township median series for that season. geometry=true adds quarter outlines. Needs a Field Greenness Pro key (DRIFTWEST_STORM_KEY).',
811
+ {
812
+ twp: z.number().int().min(1).max(126), rge: z.number().int().min(1).max(30), m: z.number().int().min(4).max(6).describe('Meridian 4, 5 or 6'),
813
+ d: z.string().optional().describe('Pentad date YYYY-MM-DD (default latest)'),
814
+ geometry: z.boolean().optional()
815
+ },
816
+ async ({ twp, rge, m, d, geometry }) => stormCall('township', { twp, rge, m, d, geometry: geometry ? 1 : undefined }, 'greenness')
817
+ );
818
+
819
+ server.tool(
820
+ 'greenness_recent',
821
+ 'Field Greenness Anomaly: every covered Alberta quarter whose latest 5-day reading is at or below max_pct % of its own normal (default -10), worst first, optional bbox. "Who is struggling where." Needs a Field Greenness Pro key (DRIFTWEST_STORM_KEY).',
822
+ {
823
+ max_pct: z.number().optional().describe('Threshold, default -10'),
824
+ bbox: z.string().optional().describe('lat0,lon0,lat1,lon1')
825
+ },
826
+ async ({ max_pct, bbox }) => stormCall('recent', { max_pct, bbox }, 'greenness')
827
+ );
828
+
708
829
  // ── Resources ──
709
830
 
710
831
  server.resource(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driftwest/mcp-server",
3
- "version": "1.4.1",
3
+ "version": "1.7.1",
4
4
  "description": "MCP server for DriftWest environmental data \u2014 43 tools including EMF MYSTERY GAME: a collaborative science game where AI agents investigate unexplained sensor anomalies, submit hypotheses, and compete on a leaderboard. Also: Prairie Storm-Day Index (Alberta lightning days 2018+), space weather, 355 beaches, wildfire, air quality, seismic. Free tier available.",
5
5
  "main": "index.js",
6
6
  "bin": {
package/server.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://registry.modelcontextprotocol.io/schema/server.json",
3
3
  "name": "driftwest/mcp-server",
4
4
  "description": "Environmental data MCP server \u2014 43 tools: EMF sensors, Alberta storm-day (lightning) index, space weather, 355 beaches, wildfire monitoring, air quality, seismic activity across Western Canada and Pacific Northwest, plus EMF Mystery Game for AI agents.",
5
- "version": "1.4.1",
5
+ "version": "1.7.1",
6
6
  "repository": {
7
7
  "url": "https://github.com/driftwest/mcp-server",
8
8
  "source": "https://github.com/driftwest/mcp-server"
@@ -11,7 +11,7 @@
11
11
  {
12
12
  "registryType": "npm",
13
13
  "name": "@driftwest/mcp-server",
14
- "version": "1.4.1",
14
+ "version": "1.7.1",
15
15
  "runtime": "node",
16
16
  "runtimeArgs": [],
17
17
  "environmentVariables": [
@@ -22,7 +22,7 @@
22
22
  },
23
23
  {
24
24
  "name": "DRIFTWEST_STORM_KEY",
25
- "description": "Prairie Storm-Day Index Pro key (sdi_pro_...) for season/grid tools. Point lookups work without it.",
25
+ "description": "Storm-Day / Smoke-Day / Dry Lightning Pro key (sdi_...) for season/grid tools. Point lookups work without it.",
26
26
  "required": false
27
27
  }
28
28
  ]
@@ -200,6 +200,50 @@
200
200
  {
201
201
  "name": "storm_days_grid",
202
202
  "description": "Storm days per 0.05\u00b0 cell in a bounding box"
203
+ },
204
+ {
205
+ "name": "smoke_days_point",
206
+ "description": "Alberta medium/heavy wildfire smoke-overhead days per season at a lat/lon, 2006+, vs normal"
207
+ },
208
+ {
209
+ "name": "smoke_days_season",
210
+ "description": "Every smoke-overhead day (with density) at a lat/lon in one season"
211
+ },
212
+ {
213
+ "name": "smoke_days_grid",
214
+ "description": "Smoke-overhead days per 0.05\u00b0 cell in a bounding box"
215
+ },
216
+ {
217
+ "name": "dry_lightning_point",
218
+ "description": "Alberta dry lightning days (lightning, <2.5 mm rain) per season at a lat/lon, 2018+, vs normal"
219
+ },
220
+ {
221
+ "name": "dry_lightning_season",
222
+ "description": "Every lightning day with its rain at a lat/lon in one season, flagged dry"
223
+ },
224
+ {
225
+ "name": "dry_lightning_grid",
226
+ "description": "Dry lightning days per 0.05\u00b0 cell in a bounding box"
227
+ },
228
+ {
229
+ "name": "dry_lightning_recent",
230
+ "description": "Every Alberta cell hit by dry lightning in the last 1-14 days"
231
+ },
232
+ {
233
+ "name": "greenness_quarter",
234
+ "description": "Alberta quarter section: latest Sentinel-2 NDVI vs its own 5-season normal (%), plus last summer"
235
+ },
236
+ {
237
+ "name": "greenness_history",
238
+ "description": "Every 5-day greenness reading and season summary for one quarter, 2020+"
239
+ },
240
+ {
241
+ "name": "greenness_township",
242
+ "description": "Every quarter in an Alberta township at one 5-day reading, vs normal"
243
+ },
244
+ {
245
+ "name": "greenness_recent",
246
+ "description": "Covered quarters running furthest below their own greenness normal"
203
247
  }
204
248
  ]
205
249
  }
package/tier-config.json CHANGED
@@ -16,7 +16,18 @@
16
16
  "mystery_game_status",
17
17
  "storm_days_point",
18
18
  "storm_days_season",
19
- "storm_days_grid"
19
+ "storm_days_grid",
20
+ "smoke_days_point",
21
+ "smoke_days_season",
22
+ "smoke_days_grid",
23
+ "dry_lightning_point",
24
+ "dry_lightning_season",
25
+ "dry_lightning_grid",
26
+ "dry_lightning_recent",
27
+ "greenness_quarter",
28
+ "greenness_history",
29
+ "greenness_township",
30
+ "greenness_recent"
20
31
  ]
21
32
  },
22
33
  "pro": {