@dangahagan/weather-mcp 1.36.0 → 1.36.2
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 +3 -3
- package/dist/utils/timezone.d.ts +4 -0
- package/dist/utils/timezone.d.ts.map +1 -1
- package/dist/utils/timezone.js +6 -1
- package/dist/utils/timezone.js.map +1 -1
- package/dist/utils/timezoneOverrides.d.ts +60 -0
- package/dist/utils/timezoneOverrides.d.ts.map +1 -0
- package/dist/utils/timezoneOverrides.js +66 -0
- package/dist/utils/timezoneOverrides.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@dangahagan/weather-mcp)
|
|
4
4
|
[](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.dgahagan/weather-mcp)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
[](./docs/testing/TEST_SUITE_README.md)
|
|
7
7
|
[](https://nodejs.org)
|
|
8
8
|
|
|
9
9
|
**Give your AI assistant real weather data — 17 tools, zero API keys, zero signup, zero cost.**
|
|
@@ -58,7 +58,7 @@ Choose this one if you want:
|
|
|
58
58
|
|
|
59
59
|
- **Genuinely free** — every data source is a free public API. No trial that expires, no credit card, no rate-limited "free tier" bait.
|
|
60
60
|
- **No API keys** — install to first forecast in under a minute. Nothing to configure, nothing to leak into a repo. ([Four optional keys](#optional-api-keys) add extras if you want them; the default configuration needs none.)
|
|
61
|
-
- **Fully open source** — MIT licensed, readable TypeScript, 6,
|
|
61
|
+
- **Fully open source** — MIT licensed, readable TypeScript, 6,132 tests. Audit it, fork it, fix it.
|
|
62
62
|
- **Privacy-respecting** — your queries go directly from your machine to public weather APIs. No middleman server, and no telemetry unless you opt in.
|
|
63
63
|
- **Breadth** — 17 tools covering weather, safety hazards (lightning, floods, wildfires), marine conditions, air quality, and historical data back to 1940. Most weather MCPs stop at forecasts.
|
|
64
64
|
|
|
@@ -400,7 +400,7 @@ npm run build # Compile TypeScript
|
|
|
400
400
|
npm run dev # Run in development mode
|
|
401
401
|
npm test # Offline tests: unit + integration (what CI runs)
|
|
402
402
|
npm run test:live # Live-network tests against the real upstreams, by hand
|
|
403
|
-
npm test && npm run test:live # Run all 6,
|
|
403
|
+
npm test && npm run test:live # Run all 6,132 tests
|
|
404
404
|
npm run test:coverage # Coverage report
|
|
405
405
|
npm run audit # Dependency vulnerability scan
|
|
406
406
|
```
|
package/dist/utils/timezone.d.ts
CHANGED
|
@@ -39,6 +39,10 @@ export declare function getTimezoneAbbreviation(timezone: string, datetime?: Dat
|
|
|
39
39
|
* back to a coarse US longitude heuristic and finally UTC if the lookup fails
|
|
40
40
|
* (e.g. invalid coordinates).
|
|
41
41
|
*
|
|
42
|
+
* A handful of date-line areas where `tz-lookup` is a calendar day wrong (American
|
|
43
|
+
* Samoa, Tokelau, St Lawrence Island) are answered first by the override boxes in
|
|
44
|
+
* `./timezoneOverrides.ts`.
|
|
45
|
+
*
|
|
42
46
|
* @param latitude - Latitude
|
|
43
47
|
* @param longitude - Longitude
|
|
44
48
|
* @returns IANA timezone identifier
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timezone.d.ts","sourceRoot":"","sources":["../../src/utils/timezone.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"timezone.d.ts","sourceRoot":"","sources":["../../src/utils/timezone.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAkB,EACvD,UAAU,GAAE,KAAK,GAAG,KAAa,GAChC,MAAM,CAiCR;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAahF;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAmBhF;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,CAUjF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAsBnF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,MAAM,CAmBR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAgB/D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAOzD;AAED;;2EAE2E;AAC3E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;gGACgG;AAChG,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE"}
|
package/dist/utils/timezone.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { DateTime } from 'luxon';
|
|
6
6
|
import tzLookup from 'tz-lookup';
|
|
7
7
|
import { logger } from './logger.js';
|
|
8
|
+
import { timezoneOverrideFor } from './timezoneOverrides.js';
|
|
8
9
|
/**
|
|
9
10
|
* Format an ISO 8601 datetime string in the specified timezone
|
|
10
11
|
* @param isoString - ISO 8601 datetime string (e.g., "2025-11-07T14:30:00+00:00")
|
|
@@ -113,13 +114,17 @@ export function getTimezoneAbbreviation(timezone, datetime) {
|
|
|
113
114
|
* back to a coarse US longitude heuristic and finally UTC if the lookup fails
|
|
114
115
|
* (e.g. invalid coordinates).
|
|
115
116
|
*
|
|
117
|
+
* A handful of date-line areas where `tz-lookup` is a calendar day wrong (American
|
|
118
|
+
* Samoa, Tokelau, St Lawrence Island) are answered first by the override boxes in
|
|
119
|
+
* `./timezoneOverrides.ts`.
|
|
120
|
+
*
|
|
116
121
|
* @param latitude - Latitude
|
|
117
122
|
* @param longitude - Longitude
|
|
118
123
|
* @returns IANA timezone identifier
|
|
119
124
|
*/
|
|
120
125
|
export function guessTimezoneFromCoords(latitude, longitude) {
|
|
121
126
|
try {
|
|
122
|
-
return tzLookup(latitude, longitude);
|
|
127
|
+
return timezoneOverrideFor(latitude, longitude) ?? tzLookup(latitude, longitude);
|
|
123
128
|
}
|
|
124
129
|
catch (error) {
|
|
125
130
|
logger.warn('tz-lookup failed; falling back to coarse timezone heuristic', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timezone.js","sourceRoot":"","sources":["../../src/utils/timezone.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"timezone.js","sourceRoot":"","sources":["../../src/utils/timezone.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,QAAgB,EAChB,MAAM,GAAyC,QAAQ,EACvD,UAAU,GAAkB,KAAK;IAEjC,IAAI,CAAC;QACH,4EAA4E;QAC5E,gFAAgF;QAChF,iFAAiF;QACjF,uEAAu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AAC,SAAS,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AAC1F,CAAC;AAED;gGACgG;AAChG,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,OAAO,IAAI,IAAI,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Point-override boxes for the places where `tz-lookup` is a calendar day wrong.
|
|
3
|
+
*
|
|
4
|
+
* `tz-lookup` 6.1.25 (pinned in `package.json`) stores coarse polygons, and at the
|
|
5
|
+
* date line coarse is not an hour off but a whole day: Tutuila resolves to
|
|
6
|
+
* `Pacific/Apia` (UTC+13) instead of `Pacific/Pago_Pago` (UTC−11), Fakaofo to
|
|
7
|
+
* `Pacific/Pago_Pago` instead of `Pacific/Fakaofo`, and Gambell to `Asia/Anadyr`
|
|
8
|
+
* instead of `America/Nome`. `guessTimezoneFromCoords` (`./timezone.ts`) consults
|
|
9
|
+
* {@link timezoneOverrideFor} first and falls through to `tz-lookup` everywhere
|
|
10
|
+
* else, so a point outside every box keeps `tz-lookup`'s answer by construction.
|
|
11
|
+
*
|
|
12
|
+
* **These boxes assert a rendered zone.** Every alert time, banner expiry and
|
|
13
|
+
* fallback forecast day at a point inside one is rendered in the box's zone. They
|
|
14
|
+
* were measured on 2026-11-27 against `geo-tz` 8.1.10 (full-resolution
|
|
15
|
+
* timezone-boundary-builder polygons) at 0.01°: every non-`Etc/` zone `geo-tz`
|
|
16
|
+
* reports inside a box is that box's zone, and the neighbours that must stay out
|
|
17
|
+
* (Apia, Upolu's east tip, Big Diomede, Swains) do. Re-measure before editing an
|
|
18
|
+
* edge — see the GOTCHAS entry for the sweep method.
|
|
19
|
+
*
|
|
20
|
+
* **They are owned by the zone question.** Never derive them from, or merge them
|
|
21
|
+
* with, `isInNwsTerritory` or `isInUS` (`./geography.ts`): those are routing
|
|
22
|
+
* predicates whose edges were drawn for a different question (where
|
|
23
|
+
* api.weather.gov answers 400; which upstream to ask), and GOTCHAS G53 is what
|
|
24
|
+
* happens when a routing edge starts deciding rendered output.
|
|
25
|
+
*
|
|
26
|
+
* **Why the Little Diomede west edge is −168.975.** The US–Russia line runs at
|
|
27
|
+
* −168.978 between the two Diomedes; `geo-tz` reads `Asia/Anadyr` at −168.980 and
|
|
28
|
+
* `America/Nome` at −168.975 across the whole box latitude.
|
|
29
|
+
*
|
|
30
|
+
* Open sea inside a box gets the box's zone rather than a nautical `Etc/GMT±n`
|
|
31
|
+
* zone, deliberately — a caller asking about the water off Tutuila wants Samoa
|
|
32
|
+
* local time, which is also what Open-Meteo answers there.
|
|
33
|
+
*
|
|
34
|
+
* Pure and zero-I/O.
|
|
35
|
+
*/
|
|
36
|
+
export interface TimezoneOverrideBox {
|
|
37
|
+
/** For this docblock and test names only — never rendered. */
|
|
38
|
+
readonly place: string;
|
|
39
|
+
readonly minLat: number;
|
|
40
|
+
readonly maxLat: number;
|
|
41
|
+
readonly minLon: number;
|
|
42
|
+
readonly maxLon: number;
|
|
43
|
+
/** IANA zone identifier. */
|
|
44
|
+
readonly zone: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The override table. Bounds are inclusive on all four sides, and no two boxes
|
|
48
|
+
* overlap, so lookup order never matters.
|
|
49
|
+
*
|
|
50
|
+
* No box crosses the antimeridian, which is why a plain `min <= x <= max` test is
|
|
51
|
+
* correct. A box that must cross ±180 has to be split in two, not given
|
|
52
|
+
* `minLon > maxLon`.
|
|
53
|
+
*/
|
|
54
|
+
export declare const TIMEZONE_OVERRIDE_BOXES: readonly TimezoneOverrideBox[];
|
|
55
|
+
/**
|
|
56
|
+
* The override zone for a coordinate, or `undefined` when no box contains it.
|
|
57
|
+
* A non-finite coordinate matches no box (every comparison is false).
|
|
58
|
+
*/
|
|
59
|
+
export declare function timezoneOverrideFor(latitude: number, longitude: number): string | undefined;
|
|
60
|
+
//# sourceMappingURL=timezoneOverrides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timezoneOverrides.d.ts","sourceRoot":"","sources":["../../src/utils/timezoneOverrides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,MAAM,WAAW,mBAAmB;IAClC,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAaD;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,mBAAmB,EAMhE,CAAC;AAEH;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO3F"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Point-override boxes for the places where `tz-lookup` is a calendar day wrong.
|
|
3
|
+
*
|
|
4
|
+
* `tz-lookup` 6.1.25 (pinned in `package.json`) stores coarse polygons, and at the
|
|
5
|
+
* date line coarse is not an hour off but a whole day: Tutuila resolves to
|
|
6
|
+
* `Pacific/Apia` (UTC+13) instead of `Pacific/Pago_Pago` (UTC−11), Fakaofo to
|
|
7
|
+
* `Pacific/Pago_Pago` instead of `Pacific/Fakaofo`, and Gambell to `Asia/Anadyr`
|
|
8
|
+
* instead of `America/Nome`. `guessTimezoneFromCoords` (`./timezone.ts`) consults
|
|
9
|
+
* {@link timezoneOverrideFor} first and falls through to `tz-lookup` everywhere
|
|
10
|
+
* else, so a point outside every box keeps `tz-lookup`'s answer by construction.
|
|
11
|
+
*
|
|
12
|
+
* **These boxes assert a rendered zone.** Every alert time, banner expiry and
|
|
13
|
+
* fallback forecast day at a point inside one is rendered in the box's zone. They
|
|
14
|
+
* were measured on 2026-11-27 against `geo-tz` 8.1.10 (full-resolution
|
|
15
|
+
* timezone-boundary-builder polygons) at 0.01°: every non-`Etc/` zone `geo-tz`
|
|
16
|
+
* reports inside a box is that box's zone, and the neighbours that must stay out
|
|
17
|
+
* (Apia, Upolu's east tip, Big Diomede, Swains) do. Re-measure before editing an
|
|
18
|
+
* edge — see the GOTCHAS entry for the sweep method.
|
|
19
|
+
*
|
|
20
|
+
* **They are owned by the zone question.** Never derive them from, or merge them
|
|
21
|
+
* with, `isInNwsTerritory` or `isInUS` (`./geography.ts`): those are routing
|
|
22
|
+
* predicates whose edges were drawn for a different question (where
|
|
23
|
+
* api.weather.gov answers 400; which upstream to ask), and GOTCHAS G53 is what
|
|
24
|
+
* happens when a routing edge starts deciding rendered output.
|
|
25
|
+
*
|
|
26
|
+
* **Why the Little Diomede west edge is −168.975.** The US–Russia line runs at
|
|
27
|
+
* −168.978 between the two Diomedes; `geo-tz` reads `Asia/Anadyr` at −168.980 and
|
|
28
|
+
* `America/Nome` at −168.975 across the whole box latitude.
|
|
29
|
+
*
|
|
30
|
+
* Open sea inside a box gets the box's zone rather than a nautical `Etc/GMT±n`
|
|
31
|
+
* zone, deliberately — a caller asking about the water off Tutuila wants Samoa
|
|
32
|
+
* local time, which is also what Open-Meteo answers there.
|
|
33
|
+
*
|
|
34
|
+
* Pure and zero-I/O.
|
|
35
|
+
*/
|
|
36
|
+
function box(place, minLat, maxLat, minLon, maxLon, zone) {
|
|
37
|
+
return Object.freeze({ place, minLat, maxLat, minLon, maxLon, zone });
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The override table. Bounds are inclusive on all four sides, and no two boxes
|
|
41
|
+
* overlap, so lookup order never matters.
|
|
42
|
+
*
|
|
43
|
+
* No box crosses the antimeridian, which is why a plain `min <= x <= max` test is
|
|
44
|
+
* correct. A box that must cross ±180 has to be split in two, not given
|
|
45
|
+
* `minLon > maxLon`.
|
|
46
|
+
*/
|
|
47
|
+
export const TIMEZONE_OVERRIDE_BOXES = Object.freeze([
|
|
48
|
+
box('American Samoa — Tutuila, Aunu‘u, Manu‘a, Rose Atoll', -14.8, -14.0, -171.1, -167.9, 'Pacific/Pago_Pago'),
|
|
49
|
+
box('Tokelau', -9.7, -8.4, -172.7, -170.9, 'Pacific/Fakaofo'),
|
|
50
|
+
box('St Lawrence Island', 62.8, 64.0, -172.25, -168.4, 'America/Nome'),
|
|
51
|
+
box('Little Diomede and US waters north of it', 65.6, 66.0, -168.975, -168.7, 'America/Nome'),
|
|
52
|
+
box('Russian waters south of Big Diomede', 65.36, 65.64, -170.65, -168.98, 'Asia/Anadyr'),
|
|
53
|
+
]);
|
|
54
|
+
/**
|
|
55
|
+
* The override zone for a coordinate, or `undefined` when no box contains it.
|
|
56
|
+
* A non-finite coordinate matches no box (every comparison is false).
|
|
57
|
+
*/
|
|
58
|
+
export function timezoneOverrideFor(latitude, longitude) {
|
|
59
|
+
for (const b of TIMEZONE_OVERRIDE_BOXES) {
|
|
60
|
+
if (latitude >= b.minLat && latitude <= b.maxLat && longitude >= b.minLon && longitude <= b.maxLon) {
|
|
61
|
+
return b.zone;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=timezoneOverrides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timezoneOverrides.js","sourceRoot":"","sources":["../../src/utils/timezoneOverrides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAaH,SAAS,GAAG,CACV,KAAa,EACb,MAAc,EACd,MAAc,EACd,MAAc,EACd,MAAc,EACd,IAAY;IAEZ,OAAO,M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ahagan/weather-mcp",
|
|
3
|
-
"version": "1.36.
|
|
3
|
+
"version": "1.36.2",
|
|
4
4
|
"description": "MCP server giving AI assistants 17 weather tools with zero API keys: global forecasts, current conditions, alerts, air quality, marine conditions, lightning detection, radar imagery, river levels, wildfire tracking, and historical weather back to 1940. Built entirely on free public data sources (NOAA, Open-Meteo, USGS, NIFC).",
|
|
5
5
|
"mcpName": "io.github.dgahagan/weather-mcp",
|
|
6
6
|
"main": "dist/index.js",
|