@dangahagan/weather-mcp 1.0.1 → 1.2.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 +180 -122
- package/dist/config/api.d.ts +30 -0
- package/dist/config/api.d.ts.map +1 -0
- package/dist/config/api.js +32 -0
- package/dist/config/api.js.map +1 -0
- package/dist/errors/ApiError.d.ts +6 -6
- package/dist/errors/ApiError.d.ts.map +1 -1
- package/dist/errors/ApiError.js +36 -13
- package/dist/errors/ApiError.js.map +1 -1
- package/dist/handlers/alertsHandler.d.ts.map +1 -1
- package/dist/handlers/alertsHandler.js +21 -5
- package/dist/handlers/alertsHandler.js.map +1 -1
- package/dist/handlers/currentConditionsHandler.d.ts +3 -1
- package/dist/handlers/currentConditionsHandler.d.ts.map +1 -1
- package/dist/handlers/currentConditionsHandler.js +49 -2
- package/dist/handlers/currentConditionsHandler.js.map +1 -1
- package/dist/handlers/forecastHandler.d.ts +2 -1
- package/dist/handlers/forecastHandler.d.ts.map +1 -1
- package/dist/handlers/forecastHandler.js +119 -17
- package/dist/handlers/forecastHandler.js.map +1 -1
- package/dist/handlers/marineConditionsHandler.d.ts +3 -1
- package/dist/handlers/marineConditionsHandler.d.ts.map +1 -1
- package/dist/handlers/marineConditionsHandler.js +122 -10
- package/dist/handlers/marineConditionsHandler.js.map +1 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/dist/services/ncei.d.ts +61 -0
- package/dist/services/ncei.d.ts.map +1 -0
- package/dist/services/ncei.js +126 -0
- package/dist/services/ncei.js.map +1 -0
- package/dist/services/openmeteo.d.ts +23 -1
- package/dist/services/openmeteo.d.ts.map +1 -1
- package/dist/services/openmeteo.js +92 -5
- package/dist/services/openmeteo.js.map +1 -1
- package/dist/types/noaa.d.ts +20 -2
- package/dist/types/noaa.d.ts.map +1 -1
- package/dist/types/openmeteo.d.ts +18 -0
- package/dist/types/openmeteo.d.ts.map +1 -1
- package/dist/utils/geography.d.ts +62 -0
- package/dist/utils/geography.d.ts.map +1 -0
- package/dist/utils/geography.js +210 -0
- package/dist/utils/geography.js.map +1 -0
- package/dist/utils/marine.d.ts +21 -0
- package/dist/utils/marine.d.ts.map +1 -1
- package/dist/utils/marine.js +53 -0
- package/dist/utils/marine.js.map +1 -1
- package/dist/utils/normals.d.ts +86 -0
- package/dist/utils/normals.d.ts.map +1 -0
- package/dist/utils/normals.js +223 -0
- package/dist/utils/normals.js.map +1 -0
- package/dist/utils/snow.d.ts +45 -0
- package/dist/utils/snow.d.ts.map +1 -0
- package/dist/utils/snow.js +144 -0
- package/dist/utils/snow.js.map +1 -0
- package/dist/utils/timezone.d.ts +56 -0
- package/dist/utils/timezone.d.ts.map +1 -0
- package/dist/utils/timezone.js +169 -0
- package/dist/utils/timezone.js.map +1 -0
- package/dist/utils/version.d.ts +15 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +24 -0
- package/dist/utils/version.js.map +1 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -12,16 +12,59 @@ An MCP (Model Context Protocol) server that provides **global weather data** to
|
|
|
12
12
|
|
|
13
13
|
## Features
|
|
14
14
|
|
|
15
|
-
- **
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
15
|
+
- **Global Weather Forecasts**: Get forecasts for any location worldwide (ENHANCED in v0.4.0)
|
|
16
|
+
- Automatic source selection: NOAA (US, more detailed) or Open-Meteo (international)
|
|
17
|
+
- Extended forecasts up to 16 days (was 7)
|
|
18
|
+
- Sunrise/sunset times with daylight duration
|
|
19
|
+
- Daily or hourly granularity
|
|
20
|
+
- Precipitation probability display
|
|
21
|
+
- Temperature trends, humidity, wind, and UV index
|
|
22
|
+
- **Current Conditions**: Get enhanced real-time weather observations for US locations
|
|
23
|
+
- Heat index and wind chill when relevant
|
|
24
|
+
- 24-hour temperature range
|
|
25
|
+
- Wind gusts and detailed cloud cover
|
|
26
|
+
- Recent precipitation history
|
|
27
|
+
- Optional fire weather indices (see below)
|
|
28
|
+
- **Location Search**: Find coordinates for any location worldwide (v0.4.0)
|
|
29
|
+
- Convert location names to coordinates ("Paris" → 48.8534°, 2.3488°)
|
|
30
|
+
- Support for cities, airports, landmarks, and regions globally
|
|
31
|
+
- Detailed metadata: timezone, elevation, population, country
|
|
32
|
+
- Enables natural language queries: "What's the weather in Tokyo?"
|
|
33
|
+
- **Climate Normals - Historical Context**: Compare weather to 30-year averages (NEW in v1.2.0)
|
|
34
|
+
- **Optional enhancement** for current conditions and forecasts (`include_normals=true`)
|
|
35
|
+
- Shows normal high/low temperatures and precipitation for comparison
|
|
36
|
+
- Displays departure from normal ("10°F warmer than normal")
|
|
37
|
+
- **Hybrid data strategy**: Open-Meteo computed normals (global, free) or optional NOAA NCEI official normals (US only, requires free API token)
|
|
38
|
+
- Based on 1991-2020 climate normals period
|
|
39
|
+
- Helps understand if weather is unusual for the time of year
|
|
40
|
+
- **Snow and Ice Data**: Enhanced winter weather information (NEW in v1.2.0)
|
|
41
|
+
- Snow depth on ground (current conditions, US only)
|
|
42
|
+
- Snowfall accumulation forecasts with time periods
|
|
43
|
+
- Ice accumulation forecasts for freezing rain events
|
|
44
|
+
- Smart threshold-based display (filters trace amounts)
|
|
45
|
+
- Unit conversions from metric to imperial
|
|
46
|
+
- **Timezone-Aware Display**: All timestamps in local time (NEW in v1.2.0)
|
|
47
|
+
- Automatic timezone detection from coordinates
|
|
48
|
+
- All times displayed in location's local timezone
|
|
49
|
+
- Includes timezone abbreviations (EST, PDT, etc.)
|
|
50
|
+
- Handles daylight saving time transitions
|
|
51
|
+
- Formatted time ranges for forecast periods
|
|
52
|
+
- **Weather Alerts**: Get active weather watches, warnings, and advisories for US locations
|
|
53
|
+
- Severity levels (Extreme, Severe, Moderate, Minor)
|
|
54
|
+
- Urgency and certainty indicators
|
|
55
|
+
- Effective and expiration times
|
|
56
|
+
- Instructions and recommended responses
|
|
57
|
+
- **Historical Data**: Access historical weather observations for any location worldwide
|
|
58
|
+
- Recent data (last 7 days): Detailed hourly observations from NOAA real-time API (US only)
|
|
59
|
+
- Archival data (>7 days old): Hourly/daily weather data from 1940-present via Open-Meteo (global coverage)
|
|
60
|
+
- **Air Quality Monitoring**: Comprehensive air quality data for any location worldwide (v0.5.0)
|
|
61
|
+
- Air Quality Index (AQI) with automatic region detection (US AQI or European EAQI)
|
|
62
|
+
- Health recommendations based on AQI levels
|
|
63
|
+
- Pollutant concentrations (PM2.5, PM10, O₃, NO₂, SO₂, CO, NH₃)
|
|
64
|
+
- UV Index with sun protection recommendations
|
|
65
|
+
- Optional hourly air quality forecasts (5-day outlook)
|
|
66
|
+
- Categorized health risk levels (Good, Moderate, Unhealthy, etc.)
|
|
67
|
+
- Activity recommendations for sensitive populations
|
|
25
68
|
- **Severe Weather Probabilities**: Probabilistic severe weather forecasting (NEW in v0.6.0)
|
|
26
69
|
- US locations only (NOAA gridpoint data)
|
|
27
70
|
- Optional enhancement to forecasts (`include_severe_weather` parameter)
|
|
@@ -31,14 +74,6 @@ An MCP (Model Context Protocol) server that provides **global weather data** to
|
|
|
31
74
|
- Lightning activity levels
|
|
32
75
|
- Smart display showing only significant threats
|
|
33
76
|
- Works with both daily and hourly forecasts
|
|
34
|
-
- **Air Quality Monitoring**: Comprehensive air quality data for any location worldwide (v0.5.0)
|
|
35
|
-
- Air Quality Index (AQI) with automatic region detection (US AQI or European EAQI)
|
|
36
|
-
- Health recommendations based on AQI levels
|
|
37
|
-
- Pollutant concentrations (PM2.5, PM10, O₃, NO₂, SO₂, CO, NH₃)
|
|
38
|
-
- UV Index with sun protection recommendations
|
|
39
|
-
- Optional hourly air quality forecasts (5-day outlook)
|
|
40
|
-
- Categorized health risk levels (Good, Moderate, Unhealthy, etc.)
|
|
41
|
-
- Activity recommendations for sensitive populations
|
|
42
77
|
- **Fire Weather Data**: Fire danger indices for US locations (v0.5.0)
|
|
43
78
|
- Haines Index (atmospheric fire growth potential)
|
|
44
79
|
- Grassland Fire Danger Index
|
|
@@ -46,32 +81,16 @@ An MCP (Model Context Protocol) server that provides **global weather data** to
|
|
|
46
81
|
- Mixing Height (smoke dispersion indicator)
|
|
47
82
|
- Transport Wind Speed (smoke transport)
|
|
48
83
|
- Optional enhancement to current conditions
|
|
49
|
-
- **
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
- Precipitation probability display
|
|
60
|
-
- Temperature trends, humidity, wind, and UV index
|
|
61
|
-
- **Weather Alerts**: Get active weather watches, warnings, and advisories for US locations
|
|
62
|
-
- Severity levels (Extreme, Severe, Moderate, Minor)
|
|
63
|
-
- Urgency and certainty indicators
|
|
64
|
-
- Effective and expiration times
|
|
65
|
-
- Instructions and recommended responses
|
|
66
|
-
- **Current Conditions**: Get enhanced real-time weather observations for US locations
|
|
67
|
-
- Heat index and wind chill when relevant
|
|
68
|
-
- 24-hour temperature range
|
|
69
|
-
- Wind gusts and detailed cloud cover
|
|
70
|
-
- Recent precipitation history
|
|
71
|
-
- Optional fire weather indices (see above)
|
|
72
|
-
- **Historical Data**: Access historical weather observations for any location worldwide
|
|
73
|
-
- Recent data (last 7 days): Detailed hourly observations from NOAA real-time API (US only)
|
|
74
|
-
- Archival data (>7 days old): Hourly/daily weather data from 1940-present via Open-Meteo (global coverage)
|
|
84
|
+
- **Marine Conditions**: Comprehensive marine weather for coastal and ocean areas (NEW in v0.6.0)
|
|
85
|
+
- Global coverage for waves, swell, and ocean currents
|
|
86
|
+
- Significant wave height with safety categorization (Calm to Extreme)
|
|
87
|
+
- Wind waves (locally generated) and swell (distant systems) separation
|
|
88
|
+
- Wave period and direction for planning
|
|
89
|
+
- Ocean current velocity and direction
|
|
90
|
+
- Optional 5-day marine forecast with daily summaries
|
|
91
|
+
- Safety assessment for maritime activities (sailing, boating, surfing)
|
|
92
|
+
- Wave interpretation guide based on Douglas Sea Scale
|
|
93
|
+
- Important: Data has limited coastal accuracy - NOT for navigation
|
|
75
94
|
- **Service Status Checking**: Proactively verify API availability with health checks
|
|
76
95
|
- **Enhanced Error Handling**: Detailed, actionable error messages with status page links
|
|
77
96
|
- **Intelligent Caching**: Built-in in-memory cache reduces API calls and improves performance
|
|
@@ -92,6 +111,7 @@ The Weather MCP server includes an intelligent in-memory caching system that sig
|
|
|
92
111
|
The cache automatically stores and retrieves weather data with intelligent expiration:
|
|
93
112
|
|
|
94
113
|
- **Location Searches**: Cached for 30 days (locations don't move)
|
|
114
|
+
- **Climate Normals**: Cached indefinitely (30-year averages are static) - NEW in v1.2.0
|
|
95
115
|
- **Marine Conditions**: Cached for 1 hour (marine data updates hourly) - NEW in v0.6.0
|
|
96
116
|
- **Air Quality Data**: Cached for 1 hour (air quality updates hourly) - v0.5.0
|
|
97
117
|
- **Fire Weather Data**: Cached for 2 hours (gridpoint data updates ~hourly) - v0.5.0
|
|
@@ -112,8 +132,18 @@ export CACHE_ENABLED=false
|
|
|
112
132
|
|
|
113
133
|
# Adjust maximum cache size (default: 1000 entries)
|
|
114
134
|
export CACHE_MAX_SIZE=1500
|
|
135
|
+
|
|
136
|
+
# Optional: NOAA NCEI API token for official climate normals (US only, NEW in v1.2.0)
|
|
137
|
+
# Falls back to Open-Meteo computed normals if not configured
|
|
138
|
+
export NCEI_API_TOKEN=your_token_here
|
|
115
139
|
```
|
|
116
140
|
|
|
141
|
+
**Note on Climate Normals (v1.2.0):**
|
|
142
|
+
- By default, climate normals use Open-Meteo's computed 30-year averages (completely free, global coverage, zero setup)
|
|
143
|
+
- Optionally, you can configure a free NCEI API token to use official NOAA climate normals for US locations
|
|
144
|
+
- Get a free token at: https://www.ncdc.noaa.gov/cdo-web/token
|
|
145
|
+
- If NCEI token is configured but unavailable, the system automatically falls back to Open-Meteo
|
|
146
|
+
|
|
117
147
|
### Monitoring
|
|
118
148
|
|
|
119
149
|
Use the `check_service_status` tool to view cache statistics including:
|
|
@@ -237,32 +267,7 @@ You can also find coordinates manually:
|
|
|
237
267
|
|
|
238
268
|
## Available Tools
|
|
239
269
|
|
|
240
|
-
### 1.
|
|
241
|
-
Find coordinates for any location worldwide by name.
|
|
242
|
-
|
|
243
|
-
**Parameters:**
|
|
244
|
-
- `query` (required): Location name to search for (e.g., "Paris", "New York, NY", "Tokyo")
|
|
245
|
-
- `limit` (optional): Maximum number of results to return (1-100, default: 5)
|
|
246
|
-
|
|
247
|
-
**Description:**
|
|
248
|
-
Converts location names to coordinates using the Open-Meteo Geocoding API. Returns multiple matches with detailed metadata including coordinates, timezone, elevation, population, and administrative regions. Enables natural language weather queries by finding coordinates automatically.
|
|
249
|
-
|
|
250
|
-
**Examples:**
|
|
251
|
-
```
|
|
252
|
-
"Find coordinates for Paris"
|
|
253
|
-
"Search for Tokyo, Japan"
|
|
254
|
-
"Where is San Francisco, CA?"
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
**Returns:**
|
|
258
|
-
- Location name and full administrative hierarchy
|
|
259
|
-
- Latitude and longitude coordinates
|
|
260
|
-
- Timezone and elevation
|
|
261
|
-
- Population (when available)
|
|
262
|
-
- Country and region information
|
|
263
|
-
- Feature type (capital, city, airport, etc.)
|
|
264
|
-
|
|
265
|
-
### 2. get_forecast (ENHANCED in v0.4.0)
|
|
270
|
+
### 1. get_forecast (ENHANCED in v0.4.0, v1.2.0)
|
|
266
271
|
Get weather forecast for any location worldwide.
|
|
267
272
|
|
|
268
273
|
**Parameters:**
|
|
@@ -271,6 +276,7 @@ Get weather forecast for any location worldwide.
|
|
|
271
276
|
- `days` (optional): Number of days in forecast (1-16, default: 7)
|
|
272
277
|
- `granularity` (optional): "daily" or "hourly" (default: "daily")
|
|
273
278
|
- `include_precipitation_probability` (optional): Include rain chances (default: true)
|
|
279
|
+
- `include_normals` (optional): Include climate normals for comparison (default: false, NEW in v1.2.0)
|
|
274
280
|
- `source` (optional): "auto" (default), "noaa" (US only), or "openmeteo" (global)
|
|
275
281
|
|
|
276
282
|
**Description:**
|
|
@@ -291,39 +297,86 @@ Automatically selects the best data source: NOAA for US locations (more detailed
|
|
|
291
297
|
- Weather conditions and descriptions
|
|
292
298
|
- UV index (for international locations)
|
|
293
299
|
- Humidity and atmospheric conditions
|
|
300
|
+
- Climate normals comparison (when `include_normals=true`, NEW in v1.2.0)
|
|
301
|
+
- Snow and ice accumulation forecasts (when available, NEW in v1.2.0)
|
|
302
|
+
- All timestamps in local timezone (NEW in v1.2.0)
|
|
294
303
|
|
|
295
|
-
###
|
|
296
|
-
|
|
304
|
+
### 2. get_current_conditions (ENHANCED in v1.2.0)
|
|
305
|
+
Get current weather conditions for a location (US only).
|
|
297
306
|
|
|
298
|
-
**Parameters:**
|
|
307
|
+
**Parameters:**
|
|
308
|
+
- `latitude` (required): Latitude coordinate (-90 to 90)
|
|
309
|
+
- `longitude` (required): Longitude coordinate (-180 to 180)
|
|
310
|
+
- `include_fire_weather` (optional): Include fire weather indices (default: false)
|
|
311
|
+
- `include_normals` (optional): Include climate normals for comparison (default: false, NEW in v1.2.0)
|
|
312
|
+
|
|
313
|
+
**Example:**
|
|
314
|
+
```
|
|
315
|
+
What are the current weather conditions in New York? (latitude: 40.7128, longitude: -74.0060)
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
**Returns:**
|
|
319
|
+
- Current temperature, humidity, wind, pressure
|
|
320
|
+
- Heat index or wind chill (when applicable)
|
|
321
|
+
- 24-hour temperature range
|
|
322
|
+
- Recent precipitation
|
|
323
|
+
- Cloud cover and visibility
|
|
324
|
+
- Snow depth on ground (when available, NEW in v1.2.0)
|
|
325
|
+
- Climate normals comparison (when `include_normals=true`, NEW in v1.2.0)
|
|
326
|
+
- Fire weather indices (when `include_fire_weather=true`)
|
|
327
|
+
- All timestamps in local timezone (NEW in v1.2.0)
|
|
328
|
+
|
|
329
|
+
### 3. search_location (NEW in v0.4.0)
|
|
330
|
+
Find coordinates for any location worldwide by name.
|
|
331
|
+
|
|
332
|
+
**Parameters:**
|
|
333
|
+
- `query` (required): Location name to search for (e.g., "Paris", "New York, NY", "Tokyo")
|
|
334
|
+
- `limit` (optional): Maximum number of results to return (1-100, default: 5)
|
|
299
335
|
|
|
300
336
|
**Description:**
|
|
301
|
-
|
|
337
|
+
Converts location names to coordinates using the Open-Meteo Geocoding API. Returns multiple matches with detailed metadata including coordinates, timezone, elevation, population, and administrative regions. Enables natural language weather queries by finding coordinates automatically.
|
|
302
338
|
|
|
303
|
-
**
|
|
339
|
+
**Examples:**
|
|
304
340
|
```
|
|
305
|
-
|
|
341
|
+
"Find coordinates for Paris"
|
|
342
|
+
"Search for Tokyo, Japan"
|
|
343
|
+
"Where is San Francisco, CA?"
|
|
306
344
|
```
|
|
307
345
|
|
|
308
346
|
**Returns:**
|
|
309
|
-
-
|
|
310
|
-
-
|
|
311
|
-
-
|
|
312
|
-
-
|
|
313
|
-
-
|
|
347
|
+
- Location name and full administrative hierarchy
|
|
348
|
+
- Latitude and longitude coordinates
|
|
349
|
+
- Timezone and elevation
|
|
350
|
+
- Population (when available)
|
|
351
|
+
- Country and region information
|
|
352
|
+
- Feature type (capital, city, airport, etc.)
|
|
314
353
|
|
|
315
|
-
### 4.
|
|
316
|
-
Get
|
|
354
|
+
### 4. get_alerts
|
|
355
|
+
Get active weather alerts, watches, warnings, and advisories for US locations.
|
|
317
356
|
|
|
318
357
|
**Parameters:**
|
|
319
358
|
- `latitude` (required): Latitude coordinate (-90 to 90)
|
|
320
359
|
- `longitude` (required): Longitude coordinate (-180 to 180)
|
|
360
|
+
- `active_only` (optional): Show only active alerts (default: true)
|
|
321
361
|
|
|
322
|
-
**
|
|
362
|
+
**Description:**
|
|
363
|
+
Retrieves current weather alerts from the NOAA API for safety-critical weather information. Returns severity levels (Extreme, Severe, Moderate, Minor), urgency indicators, effective/expiration times, and affected areas. Alerts are automatically sorted by severity with the most critical first.
|
|
364
|
+
|
|
365
|
+
**Examples:**
|
|
323
366
|
```
|
|
324
|
-
|
|
367
|
+
"Are there any weather alerts for Miami, Florida?"
|
|
368
|
+
"Check for severe weather warnings in Oklahoma City"
|
|
369
|
+
"What weather watches are active in my area?" (latitude: 40.7128, longitude: -74.0060)
|
|
325
370
|
```
|
|
326
371
|
|
|
372
|
+
**Returns:**
|
|
373
|
+
- Alert type and severity (Extreme → Severe → Moderate → Minor)
|
|
374
|
+
- Urgency, certainty, and response type
|
|
375
|
+
- Event description and instructions
|
|
376
|
+
- Effective and expiration times
|
|
377
|
+
- Affected geographic areas
|
|
378
|
+
- Recommended actions and safety information
|
|
379
|
+
|
|
327
380
|
### 5. get_historical_weather
|
|
328
381
|
Get historical weather observations for a location.
|
|
329
382
|
|
|
@@ -383,33 +436,7 @@ If you get "No historical data available":
|
|
|
383
436
|
- Note: Most recent data has a 5-day delay
|
|
384
437
|
- Very recent dates (last 5 days) may not be available in archival data yet
|
|
385
438
|
|
|
386
|
-
### 6.
|
|
387
|
-
Get active weather alerts, watches, warnings, and advisories for US locations.
|
|
388
|
-
|
|
389
|
-
**Parameters:**
|
|
390
|
-
- `latitude` (required): Latitude coordinate (-90 to 90)
|
|
391
|
-
- `longitude` (required): Longitude coordinate (-180 to 180)
|
|
392
|
-
- `active_only` (optional): Show only active alerts (default: true)
|
|
393
|
-
|
|
394
|
-
**Description:**
|
|
395
|
-
Retrieves current weather alerts from the NOAA API for safety-critical weather information. Returns severity levels (Extreme, Severe, Moderate, Minor), urgency indicators, effective/expiration times, and affected areas. Alerts are automatically sorted by severity with the most critical first.
|
|
396
|
-
|
|
397
|
-
**Examples:**
|
|
398
|
-
```
|
|
399
|
-
"Are there any weather alerts for Miami, Florida?"
|
|
400
|
-
"Check for severe weather warnings in Oklahoma City"
|
|
401
|
-
"What weather watches are active in my area?" (latitude: 40.7128, longitude: -74.0060)
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
**Returns:**
|
|
405
|
-
- Alert type and severity (Extreme → Severe → Moderate → Minor)
|
|
406
|
-
- Urgency, certainty, and response type
|
|
407
|
-
- Event description and instructions
|
|
408
|
-
- Effective and expiration times
|
|
409
|
-
- Affected geographic areas
|
|
410
|
-
- Recommended actions and safety information
|
|
411
|
-
|
|
412
|
-
### 7. get_air_quality (NEW in v0.5.0)
|
|
439
|
+
### 6. get_air_quality (NEW in v0.5.0)
|
|
413
440
|
Get comprehensive air quality data for any location worldwide.
|
|
414
441
|
|
|
415
442
|
**Parameters:**
|
|
@@ -435,8 +462,28 @@ Provides current air quality conditions using the Open-Meteo Air Quality API wit
|
|
|
435
462
|
- Activity recommendations for sensitive groups
|
|
436
463
|
- Optional 5-day hourly forecast
|
|
437
464
|
|
|
438
|
-
###
|
|
439
|
-
|
|
465
|
+
### 7. check_service_status
|
|
466
|
+
Check the operational status of weather APIs and cache performance.
|
|
467
|
+
|
|
468
|
+
**Parameters:** None
|
|
469
|
+
|
|
470
|
+
**Description:**
|
|
471
|
+
Performs health checks on both NOAA and Open-Meteo APIs to verify they are operational. Use this tool when experiencing errors or to proactively verify service availability before making weather data requests. Returns current status, helpful messages, links to official status pages, and cache statistics.
|
|
472
|
+
|
|
473
|
+
**Example:**
|
|
474
|
+
```
|
|
475
|
+
Check if the weather services are operational
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
**Returns:**
|
|
479
|
+
- Operational status for NOAA API (forecasts & current conditions)
|
|
480
|
+
- Operational status for Open-Meteo API (historical data & forecasts)
|
|
481
|
+
- Cache statistics (hit rate, size, API call reduction)
|
|
482
|
+
- Status page links and recommended actions if issues are detected
|
|
483
|
+
- Overall service availability summary
|
|
484
|
+
|
|
485
|
+
### 8. get_marine_conditions (NEW in v0.6.0, Enhanced in v1.1.0)
|
|
486
|
+
Get marine weather conditions including wave height, swell, ocean currents, and sea state with automatic source selection for Great Lakes and coastal bays.
|
|
440
487
|
|
|
441
488
|
**Parameters:**
|
|
442
489
|
- `latitude` (required): Latitude coordinate (-90 to 90)
|
|
@@ -444,7 +491,10 @@ Get marine weather conditions including wave height, swell, ocean currents, and
|
|
|
444
491
|
- `forecast` (optional): Include 5-day marine forecast (default: false)
|
|
445
492
|
|
|
446
493
|
**Description:**
|
|
447
|
-
Provides comprehensive marine weather data
|
|
494
|
+
Provides comprehensive marine weather data with intelligent dual-source support:
|
|
495
|
+
- **Great Lakes & Coastal Bays (NEW in v1.1.0)**: Automatically uses NOAA gridpoint data for all 5 Great Lakes (Superior, Michigan, Huron, Erie, Ontario) and major US coastal bays (Chesapeake Bay, San Francisco Bay, Tampa Bay, Puget Sound, Lake Okeechobee). Provides wave height, wave period, wave direction, and wind conditions.
|
|
496
|
+
- **Ocean Coverage**: Uses Open-Meteo Marine API for global ocean coverage, including significant wave height with Douglas Sea Scale categorization, wind waves vs swell separation, wave period/direction, ocean currents, and safety assessment for maritime activities.
|
|
497
|
+
- **Automatic Selection**: Intelligent geographic detection automatically selects the best data source with zero configuration required.
|
|
448
498
|
|
|
449
499
|
**Important:** Data has limited accuracy in coastal areas and is NOT suitable for coastal navigation - always consult official marine forecasts.
|
|
450
500
|
|
|
@@ -539,7 +589,7 @@ Use the `check_service_status` tool to proactively verify API availability:
|
|
|
539
589
|
|
|
540
590
|
### Automated Test Suite
|
|
541
591
|
|
|
542
|
-
This project includes a comprehensive test suite with
|
|
592
|
+
This project includes a comprehensive test suite with 693 automated tests:
|
|
543
593
|
|
|
544
594
|
```bash
|
|
545
595
|
# Run all tests
|
|
@@ -556,13 +606,13 @@ npm run test:ui
|
|
|
556
606
|
```
|
|
557
607
|
|
|
558
608
|
**Test Coverage:**
|
|
559
|
-
- **
|
|
560
|
-
- **100% coverage** on critical utilities (cache, validation, units, errors)
|
|
609
|
+
- **693 tests** across unit and integration test suites (340 new tests in v1.2.0)
|
|
610
|
+
- **100% coverage** on critical utilities (cache, validation, units, errors, normals, snow, timezone)
|
|
561
611
|
- **54% overall coverage** with focus on reliability and security
|
|
562
612
|
- All tests execute in ~1 second
|
|
563
613
|
|
|
564
614
|
**Test Categories:**
|
|
565
|
-
- **Unit Tests** (
|
|
615
|
+
- **Unit Tests** (427 tests) - Cache, validation, units, errors, config, retry logic, normals, snow, timezone
|
|
566
616
|
- **Integration Tests** (19 tests) - Error recovery scenarios, service status checks
|
|
567
617
|
|
|
568
618
|
### Quick API Connectivity Test
|
|
@@ -608,6 +658,7 @@ weather-mcp/
|
|
|
608
658
|
├── src/
|
|
609
659
|
│ ├── index.ts # Main MCP server
|
|
610
660
|
│ ├── config/
|
|
661
|
+
│ │ ├── api.ts # API configuration (NCEI token) - NEW in v1.2.0
|
|
611
662
|
│ │ ├── cache.ts # Cache configuration and TTL strategies
|
|
612
663
|
│ │ └── displayThresholds.ts # Display thresholds for weather conditions
|
|
613
664
|
│ ├── errors/
|
|
@@ -617,10 +668,14 @@ weather-mcp/
|
|
|
617
668
|
│ │ ├── currentConditionsHandler.ts # Current conditions handler
|
|
618
669
|
│ │ ├── forecastHandler.ts # Forecast tool handler
|
|
619
670
|
│ │ ├── historicalWeatherHandler.ts # Historical weather handler
|
|
671
|
+
│ │ ├── airQualityHandler.ts # Air quality handler
|
|
672
|
+
│ │ ├── marineConditionsHandler.ts # Marine conditions handler
|
|
673
|
+
│ │ ├── locationHandler.ts # Location search handler
|
|
620
674
|
│ │ └── statusHandler.ts # Service status handler
|
|
621
675
|
│ ├── services/
|
|
622
676
|
│ │ ├── noaa.ts # NOAA API service
|
|
623
|
-
│ │
|
|
677
|
+
│ │ ├── openmeteo.ts # Open-Meteo API service
|
|
678
|
+
│ │ └── ncei.ts # NCEI climate normals service - NEW in v1.2.0
|
|
624
679
|
│ ├── types/
|
|
625
680
|
│ │ ├── noaa.ts # NOAA TypeScript type definitions
|
|
626
681
|
│ │ └── openmeteo.ts # Open-Meteo TypeScript type definitions
|
|
@@ -629,9 +684,12 @@ weather-mcp/
|
|
|
629
684
|
│ ├── logger.ts # Structured logging utilities
|
|
630
685
|
│ ├── temperatureConversion.ts # Temperature conversion helpers
|
|
631
686
|
│ ├── units.ts # Unit conversion utilities
|
|
632
|
-
│
|
|
687
|
+
│ ├── validation.ts # Input validation functions
|
|
688
|
+
│ ├── normals.ts # Climate normals utilities - NEW in v1.2.0
|
|
689
|
+
│ ├── snow.ts # Snow and ice data utilities - NEW in v1.2.0
|
|
690
|
+
│ └── timezone.ts # Timezone-aware formatting - NEW in v1.2.0
|
|
633
691
|
├── tests/
|
|
634
|
-
│ ├── unit/ # Unit tests (
|
|
692
|
+
│ ├── unit/ # Unit tests (427 tests) - 93 new tests in v1.2.0
|
|
635
693
|
│ └── integration/ # Integration tests (19 tests)
|
|
636
694
|
├── dist/ # Compiled JavaScript (generated)
|
|
637
695
|
├── docs/ # Documentation
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API configuration for external weather services
|
|
3
|
+
*
|
|
4
|
+
* Most APIs used by this server are free and require no authentication.
|
|
5
|
+
* Optional API tokens can be configured for enhanced features.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* NCEI (National Centers for Environmental Information) API token
|
|
9
|
+
*
|
|
10
|
+
* OPTIONAL: Get a free token at https://www.ncdc.noaa.gov/cdo-web/token
|
|
11
|
+
*
|
|
12
|
+
* Benefits of providing a token:
|
|
13
|
+
* - Access to official NOAA climate normals for US locations
|
|
14
|
+
* - More accurate than computed normals from reanalysis data
|
|
15
|
+
*
|
|
16
|
+
* If not provided:
|
|
17
|
+
* - Climate normals will be computed from Open-Meteo historical data
|
|
18
|
+
* - Works globally (not just US)
|
|
19
|
+
* - No setup required
|
|
20
|
+
*
|
|
21
|
+
* Rate limits with token:
|
|
22
|
+
* - 5 requests per second
|
|
23
|
+
* - 10,000 requests per day
|
|
24
|
+
*/
|
|
25
|
+
export declare const NCEI_API_TOKEN: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Check if NCEI API is available (token configured)
|
|
28
|
+
*/
|
|
29
|
+
export declare function isNCEIAvailable(): boolean;
|
|
30
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/config/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc,oBAA6B,CAAC;AAEzD;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API configuration for external weather services
|
|
3
|
+
*
|
|
4
|
+
* Most APIs used by this server are free and require no authentication.
|
|
5
|
+
* Optional API tokens can be configured for enhanced features.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* NCEI (National Centers for Environmental Information) API token
|
|
9
|
+
*
|
|
10
|
+
* OPTIONAL: Get a free token at https://www.ncdc.noaa.gov/cdo-web/token
|
|
11
|
+
*
|
|
12
|
+
* Benefits of providing a token:
|
|
13
|
+
* - Access to official NOAA climate normals for US locations
|
|
14
|
+
* - More accurate than computed normals from reanalysis data
|
|
15
|
+
*
|
|
16
|
+
* If not provided:
|
|
17
|
+
* - Climate normals will be computed from Open-Meteo historical data
|
|
18
|
+
* - Works globally (not just US)
|
|
19
|
+
* - No setup required
|
|
20
|
+
*
|
|
21
|
+
* Rate limits with token:
|
|
22
|
+
* - 5 requests per second
|
|
23
|
+
* - 10,000 requests per day
|
|
24
|
+
*/
|
|
25
|
+
export const NCEI_API_TOKEN = process.env.NCEI_API_TOKEN;
|
|
26
|
+
/**
|
|
27
|
+
* Check if NCEI API is available (token configured)
|
|
28
|
+
*/
|
|
29
|
+
export function isNCEIAvailable() {
|
|
30
|
+
return !!NCEI_API_TOKEN && NCEI_API_TOKEN.trim().length > 0;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/config/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;AAEzD;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,CAAC,cAAc,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class ApiError extends Error {
|
|
8
8
|
readonly statusCode: number;
|
|
9
|
-
readonly service: 'NOAA' | 'OpenMeteo';
|
|
9
|
+
readonly service: 'NOAA' | 'OpenMeteo' | 'NCEI';
|
|
10
10
|
readonly userMessage: string;
|
|
11
11
|
readonly helpLinks: string[];
|
|
12
12
|
readonly isRetryable: boolean;
|
|
13
|
-
constructor(message: string, statusCode: number, service: 'NOAA' | 'OpenMeteo', userMessage: string, helpLinks?: string[], isRetryable?: boolean);
|
|
13
|
+
constructor(message: string, statusCode: number, service: 'NOAA' | 'OpenMeteo' | 'NCEI', userMessage: string, helpLinks?: string[], isRetryable?: boolean);
|
|
14
14
|
/**
|
|
15
15
|
* Format error for display to user
|
|
16
16
|
*/
|
|
@@ -21,13 +21,13 @@ export declare class ApiError extends Error {
|
|
|
21
21
|
*/
|
|
22
22
|
export declare class RateLimitError extends ApiError {
|
|
23
23
|
readonly retryAfter?: number;
|
|
24
|
-
constructor(service: 'NOAA' | 'OpenMeteo', retryAfter?: number);
|
|
24
|
+
constructor(service: 'NOAA' | 'OpenMeteo' | 'NCEI', messageOrRetryAfter?: string | number, retryAfter?: number);
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Service unavailable error - API is down or timing out
|
|
28
28
|
*/
|
|
29
29
|
export declare class ServiceUnavailableError extends ApiError {
|
|
30
|
-
constructor(service: 'NOAA' | 'OpenMeteo', originalError?: Error);
|
|
30
|
+
constructor(service: 'NOAA' | 'OpenMeteo' | 'NCEI', messageOrError?: string | Error, originalError?: Error);
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Invalid location error - coordinates not supported or out of range
|
|
@@ -35,13 +35,13 @@ export declare class ServiceUnavailableError extends ApiError {
|
|
|
35
35
|
export declare class InvalidLocationError extends ApiError {
|
|
36
36
|
readonly latitude?: number;
|
|
37
37
|
readonly longitude?: number;
|
|
38
|
-
constructor(service: 'NOAA' | 'OpenMeteo', message: string, latitude?: number, longitude?: number);
|
|
38
|
+
constructor(service: 'NOAA' | 'OpenMeteo' | 'NCEI', message: string, latitude?: number, longitude?: number);
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Data not found error - requested data doesn't exist
|
|
42
42
|
*/
|
|
43
43
|
export declare class DataNotFoundError extends ApiError {
|
|
44
|
-
constructor(service: 'NOAA' | 'OpenMeteo', message: string);
|
|
44
|
+
constructor(service: 'NOAA' | 'OpenMeteo' | 'NCEI', message: string);
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Validation error - invalid input parameters
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiError.d.ts","sourceRoot":"","sources":["../../src/errors/ApiError.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ApiError.d.ts","sourceRoot":"","sources":["../../src/errors/ApiError.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IACvD,SAAgB,WAAW,EAAE,MAAM,CAAC;IACpC,SAAgB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpC,SAAgB,WAAW,EAAE,OAAO,CAAC;gBAGnC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,EACtC,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,MAAM,EAAO,EACxB,WAAW,GAAE,OAAe;IAgB9B;;OAEG;IACH,aAAa,IAAI,MAAM;CAYxB;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAExB,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,EAAE,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAiC/G;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,QAAQ;gBACvC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,EAAE,aAAa,CAAC,EAAE,KAAK;CAiC3G;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,QAAQ;IAChD,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClC,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAGjC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,EACtC,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM;CAerB;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;gBACjC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM;CAYpE;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,SAAgB,KAAK,CAAC,EAAE,MAAM,CAAC;IAC/B,SAAgB,KAAK,CAAC,EAAE,GAAG,CAAC;gBAEhB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;CAUzD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAetD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAgBvD"}
|
package/dist/errors/ApiError.js
CHANGED
|
@@ -42,33 +42,56 @@ export class ApiError extends Error {
|
|
|
42
42
|
*/
|
|
43
43
|
export class RateLimitError extends ApiError {
|
|
44
44
|
retryAfter;
|
|
45
|
-
constructor(service, retryAfter) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
constructor(service, messageOrRetryAfter, retryAfter) {
|
|
46
|
+
// Handle backwards compatibility: if second param is number, treat it as retryAfter
|
|
47
|
+
let message;
|
|
48
|
+
let retry;
|
|
49
|
+
if (typeof messageOrRetryAfter === 'number') {
|
|
50
|
+
message = undefined;
|
|
51
|
+
retry = messageOrRetryAfter;
|
|
52
|
+
}
|
|
53
|
+
else if (typeof messageOrRetryAfter === 'string') {
|
|
54
|
+
message = messageOrRetryAfter;
|
|
55
|
+
retry = retryAfter;
|
|
56
|
+
}
|
|
57
|
+
const userMessage = message || (retry
|
|
58
|
+
? `Rate limit exceeded. Please retry after ${retry} seconds.`
|
|
59
|
+
: 'Rate limit exceeded. Please retry in a few seconds.');
|
|
49
60
|
super(`Rate limit exceeded for ${service}`, 429, service, userMessage, [
|
|
50
61
|
'https://weather.gov/documentation/services-web-api',
|
|
51
62
|
'https://open-meteo.com/en/features#api-documentation',
|
|
63
|
+
'https://www.ncdc.noaa.gov/cdo-web/webservices'
|
|
52
64
|
], true // Retryable after waiting
|
|
53
65
|
);
|
|
54
66
|
this.name = 'RateLimitError';
|
|
55
|
-
this.retryAfter =
|
|
67
|
+
this.retryAfter = retry;
|
|
56
68
|
}
|
|
57
69
|
}
|
|
58
70
|
/**
|
|
59
71
|
* Service unavailable error - API is down or timing out
|
|
60
72
|
*/
|
|
61
73
|
export class ServiceUnavailableError extends ApiError {
|
|
62
|
-
constructor(service, originalError) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
constructor(service, messageOrError, originalError) {
|
|
75
|
+
// Handle backwards compatibility: if second param is Error, treat it as originalError
|
|
76
|
+
let message;
|
|
77
|
+
let error;
|
|
78
|
+
if (typeof messageOrError === 'string') {
|
|
79
|
+
message = messageOrError;
|
|
80
|
+
error = originalError;
|
|
81
|
+
}
|
|
82
|
+
else if (messageOrError instanceof Error) {
|
|
83
|
+
message = undefined;
|
|
84
|
+
error = messageOrError;
|
|
85
|
+
}
|
|
86
|
+
const userMessage = message || `The ${service} weather service is temporarily unavailable. Please try again in a few minutes.`;
|
|
87
|
+
const helpLink = service === 'NOAA' ? 'https://www.weather.gov/'
|
|
88
|
+
: service === 'NCEI' ? 'https://www.ncei.noaa.gov/'
|
|
89
|
+
: 'https://open-meteo.com/';
|
|
90
|
+
super(`${service} API is currently unavailable`, 503, service, userMessage, [helpLink], true // Retryable
|
|
68
91
|
);
|
|
69
92
|
this.name = 'ServiceUnavailableError';
|
|
70
|
-
if (
|
|
71
|
-
this.stack = `${this.stack}\nCaused by: ${
|
|
93
|
+
if (error && error.stack) {
|
|
94
|
+
this.stack = `${this.stack}\nCaused by: ${error.stack}`;
|
|
72
95
|
}
|
|
73
96
|
}
|
|
74
97
|
}
|