@dangahagan/weather-mcp 0.1.2 → 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 (68) hide show
  1. package/README.md +295 -52
  2. package/dist/config/cache.d.ts +30 -0
  3. package/dist/config/cache.d.ts.map +1 -0
  4. package/dist/config/cache.js +105 -0
  5. package/dist/config/cache.js.map +1 -0
  6. package/dist/config/displayThresholds.d.ts +83 -0
  7. package/dist/config/displayThresholds.d.ts.map +1 -0
  8. package/dist/config/displayThresholds.js +83 -0
  9. package/dist/config/displayThresholds.js.map +1 -0
  10. package/dist/errors/ApiError.d.ts +62 -0
  11. package/dist/errors/ApiError.d.ts.map +1 -0
  12. package/dist/errors/ApiError.js +147 -0
  13. package/dist/errors/ApiError.js.map +1 -0
  14. package/dist/handlers/alertsHandler.d.ts +11 -0
  15. package/dist/handlers/alertsHandler.d.ts.map +1 -0
  16. package/dist/handlers/alertsHandler.js +79 -0
  17. package/dist/handlers/alertsHandler.js.map +1 -0
  18. package/dist/handlers/currentConditionsHandler.d.ts +11 -0
  19. package/dist/handlers/currentConditionsHandler.d.ts.map +1 -0
  20. package/dist/handlers/currentConditionsHandler.js +168 -0
  21. package/dist/handlers/currentConditionsHandler.js.map +1 -0
  22. package/dist/handlers/forecastHandler.d.ts +13 -0
  23. package/dist/handlers/forecastHandler.d.ts.map +1 -0
  24. package/dist/handlers/forecastHandler.js +226 -0
  25. package/dist/handlers/forecastHandler.js.map +1 -0
  26. package/dist/handlers/historicalWeatherHandler.d.ts +12 -0
  27. package/dist/handlers/historicalWeatherHandler.d.ts.map +1 -0
  28. package/dist/handlers/historicalWeatherHandler.js +188 -0
  29. package/dist/handlers/historicalWeatherHandler.js.map +1 -0
  30. package/dist/handlers/locationHandler.d.ts +11 -0
  31. package/dist/handlers/locationHandler.d.ts.map +1 -0
  32. package/dist/handlers/locationHandler.js +113 -0
  33. package/dist/handlers/locationHandler.js.map +1 -0
  34. package/dist/handlers/statusHandler.d.ts +12 -0
  35. package/dist/handlers/statusHandler.d.ts.map +1 -0
  36. package/dist/handlers/statusHandler.js +106 -0
  37. package/dist/handlers/statusHandler.js.map +1 -0
  38. package/dist/index.js +149 -343
  39. package/dist/index.js.map +1 -1
  40. package/dist/services/noaa.d.ts +23 -1
  41. package/dist/services/noaa.d.ts.map +1 -1
  42. package/dist/services/noaa.js +154 -41
  43. package/dist/services/noaa.js.map +1 -1
  44. package/dist/services/openmeteo.d.ts +63 -3
  45. package/dist/services/openmeteo.d.ts.map +1 -1
  46. package/dist/services/openmeteo.js +284 -50
  47. package/dist/services/openmeteo.js.map +1 -1
  48. package/dist/types/noaa.d.ts +64 -12
  49. package/dist/types/noaa.d.ts.map +1 -1
  50. package/dist/types/openmeteo.d.ts +156 -0
  51. package/dist/types/openmeteo.d.ts.map +1 -1
  52. package/dist/utils/cache.d.ts +69 -0
  53. package/dist/utils/cache.d.ts.map +1 -0
  54. package/dist/utils/cache.js +164 -0
  55. package/dist/utils/cache.js.map +1 -0
  56. package/dist/utils/logger.d.ts +59 -0
  57. package/dist/utils/logger.d.ts.map +1 -0
  58. package/dist/utils/logger.js +128 -0
  59. package/dist/utils/logger.js.map +1 -0
  60. package/dist/utils/temperatureConversion.d.ts +12 -0
  61. package/dist/utils/temperatureConversion.d.ts.map +1 -0
  62. package/dist/utils/temperatureConversion.js +17 -0
  63. package/dist/utils/temperatureConversion.js.map +1 -0
  64. package/dist/utils/validation.d.ts +89 -0
  65. package/dist/utils/validation.d.ts.map +1 -0
  66. package/dist/utils/validation.js +177 -0
  67. package/dist/utils/validation.js.map +1 -0
  68. package/package.json +10 -3
package/dist/index.js CHANGED
@@ -10,16 +10,32 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
10
10
  import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
11
11
  import { NOAAService } from './services/noaa.js';
12
12
  import { OpenMeteoService } from './services/openmeteo.js';
13
+ import { CacheConfig } from './config/cache.js';
14
+ import { logger } from './utils/logger.js';
15
+ import { formatErrorForUser } from './errors/ApiError.js';
16
+ import { handleGetForecast } from './handlers/forecastHandler.js';
17
+ import { handleGetCurrentConditions } from './handlers/currentConditionsHandler.js';
18
+ import { handleGetAlerts } from './handlers/alertsHandler.js';
19
+ import { handleGetHistoricalWeather } from './handlers/historicalWeatherHandler.js';
20
+ import { handleCheckServiceStatus } from './handlers/statusHandler.js';
21
+ import { handleSearchLocation } from './handlers/locationHandler.js';
13
22
  /**
14
23
  * Server information
15
24
  */
25
+ import { readFileSync } from 'fs';
26
+ import { fileURLToPath } from 'url';
27
+ import { dirname, join } from 'path';
28
+ // Read version from package.json to ensure single source of truth
29
+ const __filename = fileURLToPath(import.meta.url);
30
+ const __dirname = dirname(__filename);
31
+ const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
16
32
  const SERVER_NAME = 'weather-mcp';
17
- const SERVER_VERSION = '0.1.0';
33
+ const SERVER_VERSION = packageJson.version;
18
34
  /**
19
35
  * Initialize the NOAA service
20
36
  */
21
37
  const noaaService = new NOAAService({
22
- userAgent: '(weather-mcp, github.com/weather-mcp)'
38
+ userAgent: `weather-mcp/${SERVER_VERSION} (https://github.com/dgahagan/weather-mcp)`
23
39
  });
24
40
  /**
25
41
  * Initialize the Open-Meteo service for historical data
@@ -45,7 +61,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
45
61
  tools: [
46
62
  {
47
63
  name: 'get_forecast',
48
- description: 'Get future weather forecast for a location (US only). Use this for upcoming weather predictions (e.g., "tomorrow", "this week", "next 7 days"). Returns forecast data including temperature, precipitation, wind, and conditions. For current weather, use get_current_conditions. For past weather, use get_historical_weather. If this tool returns an error, check the error message for status page links and consider using check_service_status to verify API availability.',
64
+ description: 'Get future weather forecast for a location (global coverage). Use this for upcoming weather predictions (e.g., "tomorrow", "this week", "next 7 days", "hourly forecast"). Returns forecast data including temperature, precipitation, wind, conditions, and sunrise/sunset times. Supports both daily and hourly granularity. Automatically selects best data source: NOAA for US locations (more detailed), Open-Meteo for international locations. For current weather, use get_current_conditions. For past weather, use get_historical_weather. If this tool returns an error, check the error message for status page links and consider using check_service_status to verify API availability.',
49
65
  inputSchema: {
50
66
  type: 'object',
51
67
  properties: {
@@ -63,10 +79,27 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
63
79
  },
64
80
  days: {
65
81
  type: 'number',
66
- description: 'Number of days to include in forecast (1-7, default: 7)',
82
+ description: 'Number of days to include in forecast (1-16 for global, 1-7 for US NOAA, default: 7)',
67
83
  minimum: 1,
68
- maximum: 7,
84
+ maximum: 16,
69
85
  default: 7
86
+ },
87
+ granularity: {
88
+ type: 'string',
89
+ description: 'Forecast granularity: "daily" for day/night periods or "hourly" for hour-by-hour detail (default: "daily")',
90
+ enum: ['daily', 'hourly'],
91
+ default: 'daily'
92
+ },
93
+ include_precipitation_probability: {
94
+ type: 'boolean',
95
+ description: 'Include precipitation probability in the forecast output (default: true)',
96
+ default: true
97
+ },
98
+ source: {
99
+ type: 'string',
100
+ description: 'Data source: "auto" (default, selects NOAA for US or Open-Meteo for international), "noaa" (US only), or "openmeteo" (global)',
101
+ enum: ['auto', 'noaa', 'openmeteo'],
102
+ default: 'auto'
70
103
  }
71
104
  },
72
105
  required: ['latitude', 'longitude']
@@ -94,6 +127,33 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
94
127
  required: ['latitude', 'longitude']
95
128
  }
96
129
  },
130
+ {
131
+ name: 'get_alerts',
132
+ description: 'Get active weather alerts, watches, warnings, and advisories for a location (US only). Use this for safety-critical weather information when asked about "any alerts?", "weather warnings?", "is it safe?", "dangerous weather?", or "weather watches?". Returns severity, urgency, certainty, effective/expiration times, and affected areas. For forecast data, use get_forecast instead. If this tool returns an error, check the error message for status page links and consider using check_service_status to verify API availability.',
133
+ inputSchema: {
134
+ type: 'object',
135
+ properties: {
136
+ latitude: {
137
+ type: 'number',
138
+ description: 'Latitude of the location (-90 to 90)',
139
+ minimum: -90,
140
+ maximum: 90
141
+ },
142
+ longitude: {
143
+ type: 'number',
144
+ description: 'Longitude of the location (-180 to 180)',
145
+ minimum: -180,
146
+ maximum: 180
147
+ },
148
+ active_only: {
149
+ type: 'boolean',
150
+ description: 'Whether to show only active alerts (default: true)',
151
+ default: true
152
+ }
153
+ },
154
+ required: ['latitude', 'longitude']
155
+ }
156
+ },
97
157
  {
98
158
  name: 'get_historical_weather',
99
159
  description: 'Get historical weather data for a specific date range in the past. Use this when the user asks about weather on specific past dates (e.g., "yesterday", "last week", "November 4, 2024", "30 years ago"). Automatically uses NOAA API for recent dates (last 7 days, US only) or Open-Meteo API for older dates (worldwide, back to 1940). Do NOT use for current conditions - use get_current_conditions instead. If this tool returns an error, check the error message for status page links and consider using check_service_status to verify API availability.',
@@ -139,6 +199,27 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
139
199
  properties: {},
140
200
  required: []
141
201
  }
202
+ },
203
+ {
204
+ name: 'search_location',
205
+ description: 'Search for locations by name to get coordinates for weather queries. Use this when the user provides a location name instead of coordinates (e.g., "Paris", "New York", "Tokyo", "San Francisco, CA"). Returns location matches with coordinates, timezone, elevation, and other metadata. Enables natural language location queries like "What\'s the weather in Paris?" by converting location names to coordinates.',
206
+ inputSchema: {
207
+ type: 'object',
208
+ properties: {
209
+ query: {
210
+ type: 'string',
211
+ description: 'Location name to search for (e.g., "Paris", "New York, NY", "Tokyo")'
212
+ },
213
+ limit: {
214
+ type: 'number',
215
+ description: 'Maximum number of results to return (1-100, default: 5)',
216
+ minimum: 1,
217
+ maximum: 100,
218
+ default: 5
219
+ }
220
+ },
221
+ required: ['query']
222
+ }
142
223
  }
143
224
  ]
144
225
  };
@@ -150,349 +231,35 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
150
231
  const { name, arguments: args } = request.params;
151
232
  try {
152
233
  switch (name) {
153
- case 'get_forecast': {
154
- const { latitude, longitude, days = 7 } = args;
155
- // Get forecast data
156
- const forecast = await noaaService.getForecastByCoordinates(latitude, longitude);
157
- const periods = forecast.properties.periods.slice(0, days * 2); // Each day typically has 2 periods (day/night)
158
- // Format the forecast for display
159
- let output = `# Weather Forecast\n\n`;
160
- output += `**Location:** ${forecast.properties.elevation.value}m elevation\n`;
161
- output += `**Updated:** ${new Date(forecast.properties.updated).toLocaleString()}\n\n`;
162
- for (const period of periods) {
163
- output += `## ${period.name}\n`;
164
- output += `**Temperature:** ${period.temperature}°${period.temperatureUnit}\n`;
165
- output += `**Wind:** ${period.windSpeed} ${period.windDirection}\n`;
166
- output += `**Forecast:** ${period.shortForecast}\n\n`;
167
- if (period.detailedForecast) {
168
- output += `${period.detailedForecast}\n\n`;
169
- }
170
- }
171
- return {
172
- content: [
173
- {
174
- type: 'text',
175
- text: output
176
- }
177
- ]
178
- };
179
- }
180
- case 'get_current_conditions': {
181
- const { latitude, longitude } = args;
182
- // Get current observation
183
- const observation = await noaaService.getCurrentConditions(latitude, longitude);
184
- const props = observation.properties;
185
- // Format current conditions
186
- let output = `# Current Weather Conditions\n\n`;
187
- output += `**Station:** ${props.station}\n`;
188
- output += `**Time:** ${new Date(props.timestamp).toLocaleString()}\n\n`;
189
- if (props.textDescription) {
190
- output += `**Conditions:** ${props.textDescription}\n`;
191
- }
192
- if (props.temperature.value !== null) {
193
- const tempF = props.temperature.unitCode.includes('degC')
194
- ? (props.temperature.value * 9 / 5) + 32
195
- : props.temperature.value;
196
- output += `**Temperature:** ${Math.round(tempF)}°F\n`;
197
- }
198
- if (props.dewpoint.value !== null) {
199
- const dewF = props.dewpoint.unitCode.includes('degC')
200
- ? (props.dewpoint.value * 9 / 5) + 32
201
- : props.dewpoint.value;
202
- output += `**Dewpoint:** ${Math.round(dewF)}°F\n`;
203
- }
204
- if (props.relativeHumidity.value !== null) {
205
- output += `**Humidity:** ${Math.round(props.relativeHumidity.value)}%\n`;
206
- }
207
- if (props.windSpeed.value !== null) {
208
- const windMph = props.windSpeed.unitCode.includes('km_h')
209
- ? props.windSpeed.value * 0.621371
210
- : props.windSpeed.value * 2.23694; // m/s to mph
211
- const windDir = props.windDirection.value;
212
- output += `**Wind:** ${Math.round(windMph)} mph`;
213
- if (windDir !== null) {
214
- output += ` from ${Math.round(windDir)}°`;
215
- }
216
- output += `\n`;
217
- }
218
- if (props.barometricPressure.value !== null) {
219
- const pressureInHg = props.barometricPressure.value * 0.0002953;
220
- output += `**Pressure:** ${pressureInHg.toFixed(2)} inHg\n`;
221
- }
222
- if (props.visibility.value !== null) {
223
- const visibilityMiles = props.visibility.value * 0.000621371;
224
- output += `**Visibility:** ${visibilityMiles.toFixed(1)} miles\n`;
225
- }
226
- return {
227
- content: [
228
- {
229
- type: 'text',
230
- text: output
231
- }
232
- ]
233
- };
234
- }
235
- case 'get_historical_weather': {
236
- const { latitude, longitude, start_date, end_date, limit = 168 } = args;
237
- // Parse dates
238
- const startTime = new Date(start_date);
239
- const endTime = new Date(end_date);
240
- // Validate date parsing
241
- if (isNaN(startTime.getTime()) || isNaN(endTime.getTime())) {
242
- throw new Error('Invalid date format. Please use ISO format (YYYY-MM-DD or full ISO 8601 datetime).');
243
- }
244
- // Validate date range
245
- if (startTime > endTime) {
246
- throw new Error(`Invalid date range: start date (${start_date}) must be before end date (${end_date}).`);
247
- }
248
- // Validate dates are not in the future
249
- const now = new Date();
250
- if (startTime > now) {
251
- throw new Error(`Start date (${start_date}) cannot be in the future. Current date is ${now.toISOString().split('T')[0]}.`);
252
- }
253
- if (endTime > now) {
254
- throw new Error(`End date (${end_date}) cannot be in the future. Current date is ${now.toISOString().split('T')[0]}.`);
255
- }
256
- // Determine which API to use based on date range
257
- // If start date is more than 7 days old, use CDO API for archival data
258
- const sevenDaysAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);
259
- const useArchivalData = startTime < sevenDaysAgo;
260
- if (useArchivalData) {
261
- // Use Open-Meteo API for historical/archival data
262
- try {
263
- // Determine whether to use hourly or daily data based on date range
264
- const daysDiff = Math.ceil((endTime.getTime() - startTime.getTime()) / (1000 * 60 * 60 * 24));
265
- const useHourly = daysDiff <= 31; // Use hourly for up to 31 days
266
- const weatherData = await openMeteoService.getHistoricalWeather(latitude, longitude, start_date.split('T')[0], // Ensure YYYY-MM-DD format
267
- end_date.split('T')[0], useHourly);
268
- // Format the response based on data granularity
269
- if (useHourly && weatherData.hourly) {
270
- // Format hourly observations
271
- let output = `# Historical Weather Observations (Hourly)\n\n`;
272
- output += `**Period:** ${startTime.toLocaleDateString()} to ${endTime.toLocaleDateString()}\n`;
273
- output += `**Location:** ${weatherData.latitude.toFixed(4)}°N, ${Math.abs(weatherData.longitude).toFixed(4)}°${weatherData.longitude >= 0 ? 'E' : 'W'} (${weatherData.elevation}m elevation)\n`;
274
- output += `**Number of observations:** ${weatherData.hourly.time.length}\n`;
275
- output += `**Data source:** Open-Meteo Historical Weather API (Reanalysis)\n\n`;
276
- const maxObservations = Math.min(limit, weatherData.hourly.time.length);
277
- for (let i = 0; i < maxObservations; i++) {
278
- const time = new Date(weatherData.hourly.time[i]);
279
- output += `## ${time.toLocaleString()}\n`;
280
- if (weatherData.hourly.temperature_2m?.[i] !== null && weatherData.hourly.temperature_2m?.[i] !== undefined) {
281
- output += `- **Temperature:** ${Math.round(weatherData.hourly.temperature_2m[i])}°F\n`;
282
- }
283
- if (weatherData.hourly.apparent_temperature?.[i] !== null && weatherData.hourly.apparent_temperature?.[i] !== undefined) {
284
- output += `- **Feels Like:** ${Math.round(weatherData.hourly.apparent_temperature[i])}°F\n`;
285
- }
286
- if (weatherData.hourly.weather_code?.[i] !== null && weatherData.hourly.weather_code?.[i] !== undefined) {
287
- output += `- **Conditions:** ${openMeteoService.getWeatherDescription(weatherData.hourly.weather_code[i])}\n`;
288
- }
289
- if (weatherData.hourly.precipitation?.[i] !== null && weatherData.hourly.precipitation?.[i] !== undefined && weatherData.hourly.precipitation[i] > 0) {
290
- output += `- **Precipitation:** ${weatherData.hourly.precipitation[i].toFixed(2)} in\n`;
291
- }
292
- if (weatherData.hourly.snowfall?.[i] !== null && weatherData.hourly.snowfall?.[i] !== undefined && weatherData.hourly.snowfall[i] > 0) {
293
- output += `- **Snowfall:** ${weatherData.hourly.snowfall[i].toFixed(1)} in\n`;
294
- }
295
- if (weatherData.hourly.wind_speed_10m?.[i] !== null && weatherData.hourly.wind_speed_10m?.[i] !== undefined) {
296
- output += `- **Wind:** ${Math.round(weatherData.hourly.wind_speed_10m[i])} mph`;
297
- if (weatherData.hourly.wind_direction_10m?.[i] !== null && weatherData.hourly.wind_direction_10m?.[i] !== undefined) {
298
- output += ` from ${Math.round(weatherData.hourly.wind_direction_10m[i])}°`;
299
- }
300
- output += `\n`;
301
- }
302
- if (weatherData.hourly.relative_humidity_2m?.[i] !== null && weatherData.hourly.relative_humidity_2m?.[i] !== undefined) {
303
- output += `- **Humidity:** ${Math.round(weatherData.hourly.relative_humidity_2m[i])}%\n`;
304
- }
305
- if (weatherData.hourly.pressure_msl?.[i] !== null && weatherData.hourly.pressure_msl?.[i] !== undefined) {
306
- const pressureInHg = weatherData.hourly.pressure_msl[i] * 0.02953;
307
- output += `- **Pressure:** ${pressureInHg.toFixed(2)} inHg\n`;
308
- }
309
- if (weatherData.hourly.cloud_cover?.[i] !== null && weatherData.hourly.cloud_cover?.[i] !== undefined) {
310
- output += `- **Cloud Cover:** ${weatherData.hourly.cloud_cover[i]}%\n`;
311
- }
312
- output += `\n`;
313
- }
314
- return {
315
- content: [
316
- {
317
- type: 'text',
318
- text: output
319
- }
320
- ]
321
- };
322
- }
323
- else if (weatherData.daily) {
324
- // Format daily summaries
325
- let output = `# Historical Weather Data (Daily Summaries)\n\n`;
326
- output += `**Period:** ${startTime.toLocaleDateString()} to ${endTime.toLocaleDateString()}\n`;
327
- output += `**Location:** ${weatherData.latitude.toFixed(4)}°N, ${Math.abs(weatherData.longitude).toFixed(4)}°${weatherData.longitude >= 0 ? 'E' : 'W'} (${weatherData.elevation}m elevation)\n`;
328
- output += `**Number of days:** ${weatherData.daily.time.length}\n`;
329
- output += `**Data source:** Open-Meteo Historical Weather API (Reanalysis)\n\n`;
330
- for (let i = 0; i < weatherData.daily.time.length; i++) {
331
- const date = new Date(weatherData.daily.time[i]);
332
- output += `## ${date.toLocaleDateString()}\n`;
333
- if (weatherData.daily.temperature_2m_max?.[i] !== null && weatherData.daily.temperature_2m_max?.[i] !== undefined) {
334
- output += `- **High Temperature:** ${Math.round(weatherData.daily.temperature_2m_max[i])}°F\n`;
335
- }
336
- if (weatherData.daily.temperature_2m_min?.[i] !== null && weatherData.daily.temperature_2m_min?.[i] !== undefined) {
337
- output += `- **Low Temperature:** ${Math.round(weatherData.daily.temperature_2m_min[i])}°F\n`;
338
- }
339
- if (weatherData.daily.temperature_2m_mean?.[i] !== null && weatherData.daily.temperature_2m_mean?.[i] !== undefined) {
340
- output += `- **Average Temperature:** ${Math.round(weatherData.daily.temperature_2m_mean[i])}°F\n`;
341
- }
342
- if (weatherData.daily.weather_code?.[i] !== null && weatherData.daily.weather_code?.[i] !== undefined) {
343
- output += `- **Conditions:** ${openMeteoService.getWeatherDescription(weatherData.daily.weather_code[i])}\n`;
344
- }
345
- if (weatherData.daily.precipitation_sum?.[i] !== null && weatherData.daily.precipitation_sum?.[i] !== undefined) {
346
- output += `- **Precipitation:** ${weatherData.daily.precipitation_sum[i].toFixed(2)} in\n`;
347
- }
348
- if (weatherData.daily.snowfall_sum?.[i] !== null && weatherData.daily.snowfall_sum?.[i] !== undefined && weatherData.daily.snowfall_sum[i] > 0) {
349
- output += `- **Snowfall:** ${weatherData.daily.snowfall_sum[i].toFixed(1)} in\n`;
350
- }
351
- if (weatherData.daily.wind_speed_10m_max?.[i] !== null && weatherData.daily.wind_speed_10m_max?.[i] !== undefined) {
352
- output += `- **Max Wind Speed:** ${Math.round(weatherData.daily.wind_speed_10m_max[i])} mph\n`;
353
- }
354
- output += `\n`;
355
- }
356
- return {
357
- content: [
358
- {
359
- type: 'text',
360
- text: output
361
- }
362
- ]
363
- };
364
- }
365
- else {
366
- throw new Error('No weather data available in response');
367
- }
368
- }
369
- catch (error) {
370
- // If Open-Meteo API fails, provide helpful error message
371
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
372
- throw new Error(`Unable to retrieve historical data: ${errorMessage}`);
373
- }
374
- }
375
- else {
376
- // Use real-time NOAA API for recent data (last 7 days)
377
- const observations = await noaaService.getHistoricalObservations(latitude, longitude, startTime, endTime, limit);
378
- if (!observations.features || observations.features.length === 0) {
379
- return {
380
- content: [
381
- {
382
- type: 'text',
383
- text: `No historical observations found for the specified date range (${start_date} to ${end_date}).\n\nThis may occur because:\n- The dates are outside the station's available data range\n- There are gaps in the observation records for this location\n- The weather station near this location may not have archived data for these dates\n\nNote: Historical weather data availability varies by location and weather station. Some stations have limited historical records.`
384
- }
385
- ]
386
- };
387
- }
388
- // Format the observations
389
- let output = `# Historical Weather Observations\n\n`;
390
- output += `**Period:** ${startTime.toLocaleDateString()} to ${endTime.toLocaleDateString()}\n`;
391
- output += `**Number of observations:** ${observations.features.length}\n`;
392
- output += `**Data source:** NOAA Real-time API\n\n`;
393
- for (const obs of observations.features) {
394
- const props = obs.properties;
395
- output += `## ${new Date(props.timestamp).toLocaleString()}\n`;
396
- if (props.temperature.value !== null) {
397
- const tempF = props.temperature.unitCode.includes('degC')
398
- ? (props.temperature.value * 9 / 5) + 32
399
- : props.temperature.value;
400
- output += `- **Temperature:** ${Math.round(tempF)}°F\n`;
401
- }
402
- if (props.textDescription) {
403
- output += `- **Conditions:** ${props.textDescription}\n`;
404
- }
405
- if (props.windSpeed.value !== null) {
406
- const windMph = props.windSpeed.unitCode.includes('km_h')
407
- ? props.windSpeed.value * 0.621371
408
- : props.windSpeed.value * 2.23694;
409
- output += `- **Wind:** ${Math.round(windMph)} mph\n`;
410
- }
411
- output += `\n`;
412
- }
413
- return {
414
- content: [
415
- {
416
- type: 'text',
417
- text: output
418
- }
419
- ]
420
- };
421
- }
422
- }
423
- case 'check_service_status': {
424
- // Check status of both services
425
- const noaaStatus = await noaaService.checkServiceStatus();
426
- const openMeteoStatus = await openMeteoService.checkServiceStatus();
427
- // Format the status report
428
- let output = `# Weather API Service Status\n\n`;
429
- output += `**Check Time:** ${new Date().toLocaleString()}\n\n`;
430
- // NOAA Status
431
- output += `## NOAA Weather API (Forecasts & Current Conditions)\n\n`;
432
- output += `**Status:** ${noaaStatus.operational ? '✅ Operational' : '❌ Issues Detected'}\n`;
433
- output += `**Message:** ${noaaStatus.message}\n`;
434
- output += `**Status Page:** ${noaaStatus.statusPage}\n`;
435
- output += `**Coverage:** United States locations only\n\n`;
436
- if (!noaaStatus.operational) {
437
- output += `**Recommended Actions:**\n`;
438
- output += `- Check planned outages: https://weather-gov.github.io/api/planned-outages\n`;
439
- output += `- View service notices: https://www.weather.gov/notification\n`;
440
- output += `- Report issues: nco.ops@noaa.gov or (301) 683-1518\n\n`;
441
- }
442
- // Open-Meteo Status
443
- output += `## Open-Meteo API (Historical Weather Data)\n\n`;
444
- output += `**Status:** ${openMeteoStatus.operational ? '✅ Operational' : '❌ Issues Detected'}\n`;
445
- output += `**Message:** ${openMeteoStatus.message}\n`;
446
- output += `**Status Page:** ${openMeteoStatus.statusPage}\n`;
447
- output += `**Coverage:** Global (worldwide locations)\n\n`;
448
- if (!openMeteoStatus.operational) {
449
- output += `**Recommended Actions:**\n`;
450
- output += `- Check production status: https://open-meteo.com/en/docs/model-updates\n`;
451
- output += `- View GitHub issues: https://github.com/open-meteo/open-meteo/issues\n`;
452
- output += `- Review documentation: https://open-meteo.com/en/docs\n\n`;
453
- }
454
- // Overall status summary
455
- const bothOperational = noaaStatus.operational && openMeteoStatus.operational;
456
- const neitherOperational = !noaaStatus.operational && !openMeteoStatus.operational;
457
- if (bothOperational) {
458
- output += `## Overall Status: ✅ All Services Operational\n\n`;
459
- output += `Both NOAA and Open-Meteo APIs are functioning normally. Weather data requests should succeed.\n`;
460
- }
461
- else if (neitherOperational) {
462
- output += `## Overall Status: ❌ Multiple Service Issues\n\n`;
463
- output += `Both weather APIs are experiencing issues. Please check the status pages above for updates.\n`;
464
- }
465
- else {
466
- output += `## Overall Status: ⚠️ Partial Service Availability\n\n`;
467
- if (noaaStatus.operational) {
468
- output += `NOAA API is operational: Forecasts and current conditions for US locations are available.\n`;
469
- output += `Open-Meteo API has issues: Historical weather data may be unavailable.\n`;
470
- }
471
- else {
472
- output += `Open-Meteo API is operational: Historical weather data is available globally.\n`;
473
- output += `NOAA API has issues: Forecasts and current conditions for US locations may be unavailable.\n`;
474
- }
475
- }
476
- return {
477
- content: [
478
- {
479
- type: 'text',
480
- text: output
481
- }
482
- ]
483
- };
484
- }
234
+ case 'get_forecast':
235
+ return await handleGetForecast(args, noaaService, openMeteoService);
236
+ case 'get_current_conditions':
237
+ return await handleGetCurrentConditions(args, noaaService);
238
+ case 'get_alerts':
239
+ return await handleGetAlerts(args, noaaService);
240
+ case 'get_historical_weather':
241
+ return await handleGetHistoricalWeather(args, noaaService, openMeteoService);
242
+ case 'check_service_status':
243
+ return await handleCheckServiceStatus(noaaService, openMeteoService);
244
+ case 'search_location':
245
+ return await handleSearchLocation(args, openMeteoService);
485
246
  default:
486
247
  throw new Error(`Unknown tool: ${name}`);
487
248
  }
488
249
  }
489
250
  catch (error) {
490
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
251
+ // Log the error with full details
252
+ logger.error('Tool execution error', error, {
253
+ tool: name,
254
+ args: args ? JSON.stringify(args) : undefined,
255
+ });
256
+ // Format error for user display (sanitized)
257
+ const userMessage = formatErrorForUser(error);
491
258
  return {
492
259
  content: [
493
260
  {
494
261
  type: 'text',
495
- text: `Error: ${errorMessage}`
262
+ text: userMessage
496
263
  }
497
264
  ],
498
265
  isError: true
@@ -504,12 +271,51 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
504
271
  */
505
272
  async function main() {
506
273
  const transport = new StdioServerTransport();
507
- await server.connect(transport);
508
- // Log to stderr so it doesn't interfere with MCP communication
509
- console.error('Weather MCP Server running on stdio');
274
+ // Set up graceful shutdown handlers
275
+ const shutdown = async (signal) => {
276
+ logger.info(`Received ${signal}, shutting down gracefully...`);
277
+ try {
278
+ // Clean up resources
279
+ noaaService.clearCache();
280
+ openMeteoService.clearCache();
281
+ logger.info('Cache cleared');
282
+ // Close server connection
283
+ await server.close();
284
+ logger.info('Server closed');
285
+ process.exit(0);
286
+ }
287
+ catch (error) {
288
+ logger.error('Error during shutdown', error);
289
+ process.exit(1);
290
+ }
291
+ };
292
+ process.on('SIGTERM', () => shutdown('SIGTERM'));
293
+ process.on('SIGINT', () => shutdown('SIGINT'));
294
+ try {
295
+ await server.connect(transport);
296
+ logger.info('Weather MCP Server started', {
297
+ version: SERVER_VERSION,
298
+ cacheEnabled: CacheConfig.enabled,
299
+ logLevel: process.env.LOG_LEVEL || 'INFO',
300
+ });
301
+ }
302
+ catch (error) {
303
+ logger.error('Failed to start server', error);
304
+ throw error;
305
+ }
510
306
  }
511
307
  main().catch((error) => {
512
- console.error('Fatal error in main():', error);
308
+ logger.error('Fatal error in main()', error);
309
+ // Log structured error for monitoring
310
+ console.error(JSON.stringify({
311
+ timestamp: new Date().toISOString(),
312
+ level: 'FATAL',
313
+ message: 'Application failed to start',
314
+ error: {
315
+ message: error instanceof Error ? error.message : String(error),
316
+ stack: error instanceof Error ? error.stack : undefined,
317
+ }
318
+ }));
513
319
  process.exit(1);
514
320
  });
515
321
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,oEAAoE;AACpE,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD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