/** * Weather MCP Server — server factory. * * Owns everything needed to answer MCP requests: the sixteen upstream service * singletons, the shared schema fragments, TOOL_DEFINITIONS, and the two * request handlers (tools/list and tools/call). createWeatherServer() builds a * Server with both handlers registered and returns it **unconnected** — the * caller chooses the transport. * * What this module deliberately does NOT do: it does not load `.env` (a library * module that reads a .env from the caller's cwd is a trap — see GOTCHAS G26), * it constructs no transport, and it registers no process signal handler and * calls no process.exit. Importing it is therefore inert, with one exception: * `withAnalytics` pulls in the analytics singleton built at module load in * src/analytics/config.ts:193, which reads ANALYTICS_SALT. A test that imports * this module pins ANALYTICS_ENABLED and ANALYTICS_SALT for that reason and no * other. * * The services are module-scope singletons on purpose: two createWeatherServer() * calls in one process share one set of upstream caches, which is what a * per-session transport wants. src/index.ts — the stdio entry — is the only * consumer today; the factory is not a published API. */ import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import type { LocationStore } from '../services/locationStore.js'; /** * Server information * * SERVER_VERSION comes from src/utils/version.ts, which reads package.json by * the one relative path that resolves from every build output. A private read * of `../package.json` from this directory would resolve to dist/package.json, * which does not exist. */ export declare const SERVER_NAME = "weather-mcp"; export declare const SERVER_VERSION: string; /** * Tool definitions - each tool defined separately for conditional registration */ export declare const TOOL_DEFINITIONS: { get_forecast: { name: 'get_forecast'; description: string; inputSchema: { type: 'object'; properties: { units: { type: 'string'; description: string; enum: string[]; }; temperature_unit: { type: 'string'; description: string; enum: string[]; }; wind_speed_unit: { type: 'string'; description: string; enum: string[]; }; precipitation_unit: { type: 'string'; description: string; enum: string[]; }; pressure_unit: { type: 'string'; description: string; enum: string[]; }; distance_unit: { type: 'string'; description: string; enum: string[]; }; time_format: { type: 'string'; description: string; enum: string[]; }; latitude: { type: 'number'; description: string; minimum: number; maximum: number; }; longitude: { type: 'number'; description: string; minimum: number; maximum: number; }; location_name: { type: 'string'; description: string; }; city_name: { type: 'string'; description: string; }; detail: { type: 'string'; description: string; enum: string[]; }; days: { type: 'number'; description: string; minimum: number; maximum: number; default: number; }; granularity: { type: 'string'; description: string; enum: string[]; default: string; }; include_precipitation_probability: { type: 'boolean'; description: string; default: boolean; }; include_severe_weather: { type: 'boolean'; description: string; default: boolean; }; include_normals: { type: 'boolean'; description: string; default: boolean; }; include_astronomy: { type: 'boolean'; description: string; default: boolean; }; source: { type: 'string'; description: string; enum: string[]; default: string; }; compare_models: { type: 'boolean'; default: boolean; description: string; }; ensemble_spread: { type: 'boolean'; description: string; default: boolean; }; }; required: never[]; }; }; get_current_conditions: { name: 'get_current_conditions'; description: string; inputSchema: { type: 'object'; properties: { units: { type: 'string'; description: string; enum: string[]; }; temperature_unit: { type: 'string'; description: string; enum: string[]; }; wind_speed_unit: { type: 'string'; description: string; enum: string[]; }; precipitation_unit: { type: 'string'; description: string; enum: string[]; }; pressure_unit: { type: 'string'; description: string; enum: string[]; }; distance_unit: { type: 'string'; description: string; enum: string[]; }; time_format: { type: 'string'; description: string; enum: string[]; }; latitude: { type: 'number'; description: string; minimum: number; maximum: number; }; longitude: { type: 'number'; description: string; minimum: number; maximum: number; }; location_name: { type: 'string'; description: string; }; city_name: { type: 'string'; description: string; }; include_fire_weather: { type: 'boolean'; description: string; default: boolean; }; include_normals: { type: 'boolean'; description: string; default: boolean; }; source: { type: 'string'; description: string; enum: string[]; default: string; }; }; required: never[]; }; }; get_alerts: { name: 'get_alerts'; description: string; inputSchema: { type: 'object'; properties: { latitude: { type: 'number'; description: string; minimum: number; maximum: number; }; longitude: { type: 'number'; description: string; minimum: number; maximum: number; }; location_name: { type: 'string'; description: string; }; city_name: { type: 'string'; description: string; }; detail: { type: 'string'; description: string; enum: string[]; }; active_only: { type: 'boolean'; description: string; default: boolean; }; }; required: never[]; }; }; get_historical_weather: { name: 'get_historical_weather'; description: string; inputSchema: { type: 'object'; properties: { units: { type: 'string'; description: string; enum: string[]; }; temperature_unit: { type: 'string'; description: string; enum: string[]; }; wind_speed_unit: { type: 'string'; description: string; enum: string[]; }; precipitation_unit: { type: 'string'; description: string; enum: string[]; }; pressure_unit: { type: 'string'; description: string; enum: string[]; }; distance_unit: { type: 'string'; description: string; enum: string[]; }; time_format: { type: 'string'; description: string; enum: string[]; }; latitude: { type: 'number'; description: string; minimum: number; maximum: number; }; longitude: { type: 'number'; description: string; minimum: number; maximum: number; }; location_name: { type: 'string'; description: string; }; city_name: { type: 'string'; description: string; }; start_date: { type: 'string'; description: string; }; end_date: { type: 'string'; description: string; }; limit: { type: 'number'; description: string; minimum: number; maximum: number; default: number; }; }; required: string[]; }; }; get_weather_summary: { name: 'get_weather_summary'; description: string; inputSchema: { type: 'object'; properties: { units: { type: 'string'; description: string; enum: string[]; }; temperature_unit: { type: 'string'; description: string; enum: string[]; }; wind_speed_unit: { type: 'string'; description: string; enum: string[]; }; precipitation_unit: { type: 'string'; description: string; enum: string[]; }; pressure_unit: { type: 'string'; description: string; enum: string[]; }; distance_unit: { type: 'string'; description: string; enum: string[]; }; time_format: { type: 'string'; description: string; enum: string[]; }; latitude: { type: 'number'; description: string; minimum: number; maximum: number; }; longitude: { type: 'number'; description: string; minimum: number; maximum: number; }; location_name: { type: 'string'; description: string; }; city_name: { type: 'string'; description: string; }; detail: { type: 'string'; description: string; enum: string[]; }; include: { type: 'array'; description: string; items: { type: 'string'; enum: string[]; }; }; days: { type: 'number'; description: string; minimum: number; maximum: number; default: number; }; source: { type: 'string'; description: string; enum: string[]; default: string; }; }; required: never[]; }; }; check_service_status: { name: 'check_service_status'; description: string; inputSchema: { type: 'object'; properties: {}; required: never[]; }; }; search_location: { name: 'search_location'; description: string; inputSchema: { type: 'object'; properties: { query: { type: 'string'; description: string; }; limit: { type: 'integer'; description: string; minimum: number; maximum: number; default: number; }; }; required: string[]; }; }; get_air_quality: { name: 'get_air_quality'; description: string; inputSchema: { type: 'object'; properties: { latitude: { type: 'number'; description: string; minimum: number; maximum: number; }; longitude: { type: 'number'; description: string; minimum: number; maximum: number; }; location_name: { type: 'string'; description: string; }; city_name: { type: 'string'; description: string; }; forecast: { type: 'boolean'; description: string; default: boolean; }; forecast_days: { type: 'number'; description: string; minimum: number; maximum: number; default: number; }; }; required: never[]; }; }; get_marine_conditions: { name: 'get_marine_conditions'; description: string; inputSchema: { type: 'object'; properties: { latitude: { type: 'number'; description: string; minimum: number; maximum: number; }; longitude: { type: 'number'; description: string; minimum: number; maximum: number; }; location_name: { type: 'string'; description: string; }; city_name: { type: 'string'; description: string; }; forecast: { type: 'boolean'; description: string; default: boolean; }; forecast_days: { type: 'number'; description: string; minimum: number; maximum: number; default: number; }; }; required: never[]; }; }; get_weather_imagery: { name: 'get_weather_imagery'; description: string; inputSchema: { type: 'object'; properties: { latitude: { type: 'number'; description: string; minimum: number; maximum: number; }; longitude: { type: 'number'; description: string; minimum: number; maximum: number; }; location_name: { type: 'string'; description: string; }; city_name: { type: 'string'; description: string; }; detail: { type: 'string'; description: string; enum: string[]; }; type: { type: 'string'; description: string; enum: string[]; default: string; }; animated: { type: 'boolean'; description: string; default: boolean; }; composite: { type: 'boolean'; description: string; default: boolean; }; }; required: never[]; }; }; get_lightning_activity: { name: 'get_lightning_activity'; description: string; inputSchema: { type: 'object'; properties: { latitude: { type: 'number'; description: string; minimum: number; maximum: number; }; longitude: { type: 'number'; description: string; minimum: number; maximum: number; }; location_name: { type: 'string'; description: string; }; city_name: { type: 'string'; description: string; }; detail: { type: 'string'; description: string; enum: string[]; }; radius: { type: 'number'; description: string; minimum: number; maximum: number; default: number; }; timeWindow: { type: 'number'; description: string; minimum: number; maximum: number; default: number; }; }; required: never[]; }; }; get_river_conditions: { name: 'get_river_conditions'; description: string; inputSchema: { type: 'object'; properties: { latitude: { type: 'number'; description: string; minimum: number; maximum: number; }; longitude: { type: 'number'; description: string; minimum: number; maximum: number; }; location_name: { type: 'string'; description: string; }; city_name: { type: 'string'; description: string; }; detail: { type: 'string'; description: string; enum: string[]; }; radius: { type: 'number'; description: string; minimum: number; maximum: number; default: number; }; source: { type: 'string'; description: string; enum: string[]; default: string; }; forecast_days: { type: 'number'; description: string; minimum: number; maximum: number; default: number; }; }; required: never[]; }; }; get_wildfire_info: { name: 'get_wildfire_info'; description: string; inputSchema: { type: 'object'; properties: { latitude: { type: 'number'; description: string; minimum: number; maximum: number; }; longitude: { type: 'number'; description: string; minimum: number; maximum: number; }; location_name: { type: 'string'; description: string; }; city_name: { type: 'string'; description: string; }; detail: { type: 'string'; description: string; enum: string[]; }; radius: { type: 'number'; description: string; minimum: number; maximum: number; default: number; }; source: { type: 'string'; description: string; enum: string[]; default: string; }; day_range: { type: 'number'; description: string; minimum: number; maximum: number; default: number; }; }; required: never[]; }; }; save_location: { name: 'save_location'; description: string; inputSchema: { type: 'object'; properties: { alias: { type: 'string'; description: string; maxLength: number; }; location_query: { type: 'string'; description: string; }; latitude: { type: 'number'; description: string; minimum: number; maximum: number; }; longitude: { type: 'number'; description: string; minimum: number; maximum: number; }; name: { type: 'string'; description: string; }; description: { type: 'string'; description: string; }; alternateNames: { type: 'array'; description: string; items: { type: 'string'; }; }; notes: { type: 'string'; description: string; }; activities: { type: 'array'; items: { type: 'string'; }; description: string; }; }; required: string[]; }; }; list_saved_locations: { name: 'list_saved_locations'; description: string; inputSchema: { type: 'object'; properties: {}; required: never[]; }; }; get_saved_location: { name: 'get_saved_location'; description: string; inputSchema: { type: 'object'; properties: { alias: { type: 'string'; description: string; }; }; required: string[]; }; }; remove_saved_location: { name: 'remove_saved_location'; description: string; inputSchema: { type: 'object'; properties: { alias: { type: 'string'; description: string; }; }; required: string[]; }; }; }; export interface WeatherServerOptions { /** The saved-location store every location-based tool resolves through. Required, not * defaulted: a defaulted store resolves to ~/.weather-mcp/locations.json, and an * in-process test that forgot to pass one would write the developer's real file. */ locationStore: LocationStore; } /** * Build an MCP Server with the enabled tools registered. * * The returned Server is **unconnected** — the caller attaches the transport it * wants. No signal handler is registered and no process state is touched, so a * caller may build more than one. */ export declare function createWeatherServer(options: WeatherServerOptions): Server; /** * Clear the upstream caches the entry point's shutdown path has always cleared. * * Two of the sixteen services, in the same order src/index.ts used before this * module existed: NOAA and Open-Meteo are the only ones whose caches shutdown * ever touched. Exposed as one named function rather than by exporting the two * singletons, so callers get a seam and not a mutable handle. */ export declare function clearServiceCaches(): void; //# sourceMappingURL=weatherServer.d.ts.map