open-meteo-mcp-server 1.0.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/LICENSE +21 -0
- package/README.md +317 -0
- package/dist/client.d.ts +28 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +141 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +255 -0
- package/dist/index.js.map +1 -0
- package/dist/tools.d.ts +13 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +644 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +256 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +137 -0
- package/dist/types.js.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# Open-Meteo MCP Server
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/open-meteo-mcp-server)
|
|
4
|
+
[](https://github.com/cmer81/open-meteo-mcp/releases)
|
|
5
|
+
[](https://github.com/cmer81/open-meteo-mcp/actions)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
|
|
9
|
+
A comprehensive [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that provides access to Open-Meteo weather APIs for use with Large Language Models.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
This MCP server provides complete access to Open-Meteo APIs, including:
|
|
14
|
+
|
|
15
|
+
### Core Weather APIs
|
|
16
|
+
- **Weather Forecast** (`weather_forecast`) - 7-day forecasts with hourly and daily resolution
|
|
17
|
+
- **Weather Archive** (`weather_archive`) - Historical ERA5 data from 1940 to present
|
|
18
|
+
- **Air Quality** (`air_quality`) - PM2.5, PM10, ozone, nitrogen dioxide and other pollutants
|
|
19
|
+
- **Marine Weather** (`marine_weather`) - Wave height, wave period, wave direction and sea surface temperature
|
|
20
|
+
- **Elevation** (`elevation`) - Digital elevation model data for given coordinates
|
|
21
|
+
|
|
22
|
+
### Specialized Weather Models
|
|
23
|
+
- **DWD ICON** (`dwd_icon_forecast`) - German weather service high-resolution model for Europe
|
|
24
|
+
- **NOAA GFS** (`gfs_forecast`) - US weather service global model with high-resolution North America data
|
|
25
|
+
- **Météo-France** (`meteofrance_forecast`) - French weather service AROME and ARPEGE models
|
|
26
|
+
- **ECMWF** (`ecmwf_forecast`) - European Centre for Medium-Range Weather Forecasts
|
|
27
|
+
- **JMA** (`jma_forecast`) - Japan Meteorological Agency high-resolution model for Asia
|
|
28
|
+
- **MET Norway** (`metno_forecast`) - Norwegian weather service for Nordic countries
|
|
29
|
+
- **Environment Canada GEM** (`gem_forecast`) - Canadian weather service model
|
|
30
|
+
|
|
31
|
+
### Advanced Forecasting Tools
|
|
32
|
+
- **Flood Forecast** (`flood_forecast`) - River discharge and flood forecasts from GloFAS (Global Flood Awareness System)
|
|
33
|
+
- **Seasonal Forecast** (`seasonal_forecast`) - Long-range forecasts up to 9 months ahead
|
|
34
|
+
- **Climate Projections** (`climate_projection`) - CMIP6 climate change projections for different warming scenarios
|
|
35
|
+
- **Ensemble Forecast** (`ensemble_forecast`) - Multiple model runs showing forecast uncertainty
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
### From npm (Recommended)
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g open-meteo-mcp-server
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### From source
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Clone the repository
|
|
49
|
+
git clone https://github.com/cmer81/open-meteo-mcp.git
|
|
50
|
+
cd open-meteo-mcp
|
|
51
|
+
|
|
52
|
+
# Install dependencies
|
|
53
|
+
npm install
|
|
54
|
+
|
|
55
|
+
# Build the project
|
|
56
|
+
npm run build
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Configuration
|
|
60
|
+
|
|
61
|
+
### Environment Variables
|
|
62
|
+
|
|
63
|
+
- `OPEN_METEO_API_URL` (optional) - Base URL for Open-Meteo API (default: https://api.open-meteo.com)
|
|
64
|
+
|
|
65
|
+
### Claude Desktop Configuration
|
|
66
|
+
|
|
67
|
+
Add the following configuration to your Claude Desktop config file:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"mcpServers": {
|
|
72
|
+
"open-meteo": {
|
|
73
|
+
"command": "node",
|
|
74
|
+
"args": ["/path/to/open-meteo-mcp/dist/index.js"],
|
|
75
|
+
"env": {
|
|
76
|
+
"OPEN_METEO_API_URL": "https://api.open-meteo.com",
|
|
77
|
+
"OPEN_METEO_AIR_QUALITY_API_URL": "https://air-quality-api.open-meteo.com",
|
|
78
|
+
"OPEN_METEO_MARINE_API_URL": "https://marine-api.open-meteo.com",
|
|
79
|
+
"OPEN_METEO_ARCHIVE_API_URL": "https://archive-api.open-meteo.com",
|
|
80
|
+
"OPEN_METEO_SEASONAL_API_URL": "https://seasonal-api.open-meteo.com",
|
|
81
|
+
"OPEN_METEO_ENSEMBLE_API_URL": "https://ensemble-api.open-meteo.com"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Custom Instance Configuration
|
|
89
|
+
|
|
90
|
+
If you're using your own Open-Meteo instance:
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"mcpServers": {
|
|
95
|
+
"open-meteo": {
|
|
96
|
+
"command": "node",
|
|
97
|
+
"args": ["/path/to/open-meteo-mcp/dist/index.js"],
|
|
98
|
+
"env": {
|
|
99
|
+
"OPEN_METEO_API_URL": "https://your-meteo-api.example.com",
|
|
100
|
+
"OPEN_METEO_AIR_QUALITY_API_URL": "https://air-quality-api.example.com",
|
|
101
|
+
"OPEN_METEO_MARINE_API_URL": "https://marine-api.example.com",
|
|
102
|
+
"OPEN_METEO_ARCHIVE_API_URL": "https://archive-api.example.com",
|
|
103
|
+
"OPEN_METEO_SEASONAL_API_URL": "https://seasonal-api.example.com",
|
|
104
|
+
"OPEN_METEO_ENSEMBLE_API_URL": "https://ensemble-api.example.com"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Usage Examples
|
|
112
|
+
|
|
113
|
+
### Basic Weather Forecast
|
|
114
|
+
```
|
|
115
|
+
Can you get me the weather forecast for Paris (48.8566, 2.3522) with temperature, humidity, and precipitation for the next 3 days?
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Historical Weather Data
|
|
119
|
+
```
|
|
120
|
+
What were the temperatures in London during January 2023?
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Air Quality Monitoring
|
|
124
|
+
```
|
|
125
|
+
What's the current air quality in Beijing with PM2.5 and ozone levels?
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Marine Weather
|
|
129
|
+
```
|
|
130
|
+
Get me the wave height and sea surface temperature for coordinates 45.0, -125.0 for the next 5 days.
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Flood Monitoring
|
|
134
|
+
```
|
|
135
|
+
Check the river discharge forecast for coordinates 52.5, 13.4 for the next 30 days.
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Climate Projections
|
|
139
|
+
```
|
|
140
|
+
Show me temperature projections for New York from 2050 to 2070 using CMIP6 models.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## API Parameters
|
|
144
|
+
|
|
145
|
+
### Required Parameters
|
|
146
|
+
- `latitude` : Latitude in WGS84 coordinate system (-90 to 90)
|
|
147
|
+
- `longitude` : Longitude in WGS84 coordinate system (-180 to 180)
|
|
148
|
+
|
|
149
|
+
### Hourly Weather Variables
|
|
150
|
+
- `temperature_2m` : Temperature at 2 meters
|
|
151
|
+
- `relative_humidity_2m` : Relative humidity
|
|
152
|
+
- `precipitation` : Precipitation
|
|
153
|
+
- `wind_speed_10m` : Wind speed at 10 meters
|
|
154
|
+
- `wind_direction_10m` : Wind direction
|
|
155
|
+
- `pressure_msl` : Mean sea level pressure
|
|
156
|
+
- `cloud_cover` : Cloud cover percentage
|
|
157
|
+
- `weather_code` : Weather condition code
|
|
158
|
+
- `visibility` : Visibility
|
|
159
|
+
- `uv_index` : UV index
|
|
160
|
+
- And many more...
|
|
161
|
+
|
|
162
|
+
### Daily Weather Variables
|
|
163
|
+
- `temperature_2m_max/min` : Maximum/minimum temperatures
|
|
164
|
+
- `precipitation_sum` : Total precipitation
|
|
165
|
+
- `wind_speed_10m_max` : Maximum wind speed
|
|
166
|
+
- `sunrise/sunset` : Sunrise and sunset times
|
|
167
|
+
- `weather_code` : Weather condition code
|
|
168
|
+
- `uv_index_max` : Maximum UV index
|
|
169
|
+
|
|
170
|
+
### Air Quality Variables
|
|
171
|
+
- `pm10` : PM10 particles
|
|
172
|
+
- `pm2_5` : PM2.5 particles
|
|
173
|
+
- `carbon_monoxide` : Carbon monoxide
|
|
174
|
+
- `nitrogen_dioxide` : Nitrogen dioxide
|
|
175
|
+
- `ozone` : Ozone
|
|
176
|
+
- `sulphur_dioxide` : Sulfur dioxide
|
|
177
|
+
- `ammonia` : Ammonia
|
|
178
|
+
- `dust` : Dust particles
|
|
179
|
+
|
|
180
|
+
### Marine Weather Variables
|
|
181
|
+
- `wave_height` : Wave height
|
|
182
|
+
- `wave_direction` : Wave direction
|
|
183
|
+
- `wave_period` : Wave period
|
|
184
|
+
- `wind_wave_height` : Wind wave height
|
|
185
|
+
- `swell_wave_height` : Swell wave height
|
|
186
|
+
- `sea_surface_temperature` : Sea surface temperature
|
|
187
|
+
|
|
188
|
+
### Formatting Options
|
|
189
|
+
- `temperature_unit` : `celsius`, `fahrenheit`
|
|
190
|
+
- `wind_speed_unit` : `kmh`, `ms`, `mph`, `kn`
|
|
191
|
+
- `precipitation_unit` : `mm`, `inch`
|
|
192
|
+
- `timezone` : `Europe/Paris`, `America/New_York`, etc.
|
|
193
|
+
|
|
194
|
+
### Time Range Options
|
|
195
|
+
- `forecast_days` : Number of forecast days (varies by API)
|
|
196
|
+
- `past_days` : Include past days data
|
|
197
|
+
- `start_date` / `end_date` : Date range for historical data (YYYY-MM-DD format)
|
|
198
|
+
|
|
199
|
+
## Development Scripts
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Development with auto-reload
|
|
203
|
+
npm run dev
|
|
204
|
+
|
|
205
|
+
# Build TypeScript
|
|
206
|
+
npm run build
|
|
207
|
+
|
|
208
|
+
# Start production server
|
|
209
|
+
npm start
|
|
210
|
+
|
|
211
|
+
# Run tests
|
|
212
|
+
npm test
|
|
213
|
+
|
|
214
|
+
# Type checking
|
|
215
|
+
npm run typecheck
|
|
216
|
+
|
|
217
|
+
# Linting
|
|
218
|
+
npm run lint
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Project Structure
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
src/
|
|
225
|
+
├── index.ts # MCP server entry point
|
|
226
|
+
├── client.ts # HTTP client for Open-Meteo API
|
|
227
|
+
├── tools.ts # MCP tool definitions
|
|
228
|
+
└── types.ts # Zod validation schemas
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## API Coverage
|
|
232
|
+
|
|
233
|
+
This server provides access to all major Open-Meteo endpoints:
|
|
234
|
+
|
|
235
|
+
### Weather Data
|
|
236
|
+
- Current weather conditions
|
|
237
|
+
- Hourly forecasts (up to 16 days)
|
|
238
|
+
- Daily forecasts (up to 16 days)
|
|
239
|
+
- Historical weather data (1940-present)
|
|
240
|
+
|
|
241
|
+
### Specialized Models
|
|
242
|
+
- High-resolution regional models (DWD ICON, Météo-France AROME)
|
|
243
|
+
- Global models (NOAA GFS, ECMWF)
|
|
244
|
+
- Regional specialists (JMA for Asia, MET Norway for Nordics)
|
|
245
|
+
|
|
246
|
+
### Environmental Data
|
|
247
|
+
- Air quality forecasts
|
|
248
|
+
- Marine and ocean conditions
|
|
249
|
+
- River discharge and flood warnings
|
|
250
|
+
- Climate change projections
|
|
251
|
+
|
|
252
|
+
### Advanced Features
|
|
253
|
+
- Ensemble forecasts for uncertainty quantification
|
|
254
|
+
- Seasonal forecasts for long-term planning
|
|
255
|
+
- Multiple model comparison
|
|
256
|
+
- Customizable units and timezones
|
|
257
|
+
|
|
258
|
+
## Error Handling
|
|
259
|
+
|
|
260
|
+
The server provides comprehensive error handling with detailed error messages for:
|
|
261
|
+
- Invalid coordinates
|
|
262
|
+
- Missing required parameters
|
|
263
|
+
- API rate limits
|
|
264
|
+
- Network connectivity issues
|
|
265
|
+
- Invalid date ranges
|
|
266
|
+
|
|
267
|
+
## Performance
|
|
268
|
+
|
|
269
|
+
- Efficient HTTP client with connection pooling
|
|
270
|
+
- Request caching for repeated queries
|
|
271
|
+
- Optimized data serialization
|
|
272
|
+
- Minimal memory footprint
|
|
273
|
+
|
|
274
|
+
## API Documentation
|
|
275
|
+
|
|
276
|
+
For detailed API documentation, refer to the `openapi.yml` file and the [Open-Meteo API documentation](https://open-meteo.com/en/docs).
|
|
277
|
+
|
|
278
|
+
## Contributing
|
|
279
|
+
|
|
280
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
281
|
+
|
|
282
|
+
### Development Setup
|
|
283
|
+
|
|
284
|
+
1. Fork the repository
|
|
285
|
+
2. Clone your fork: `git clone https://github.com/your-username/open-meteo-mcp.git`
|
|
286
|
+
3. Install dependencies: `npm install`
|
|
287
|
+
4. Create a feature branch: `git checkout -b feature/amazing-feature`
|
|
288
|
+
5. Make your changes and add tests
|
|
289
|
+
6. Run tests: `npm test`
|
|
290
|
+
7. Commit your changes: `git commit -m 'Add amazing feature'`
|
|
291
|
+
8. Push to the branch: `git push origin feature/amazing-feature`
|
|
292
|
+
9. Open a Pull Request
|
|
293
|
+
|
|
294
|
+
### Releasing
|
|
295
|
+
|
|
296
|
+
This project uses automated releases via GitHub Actions. To create a new release:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
# For a patch release (1.0.0 -> 1.0.1)
|
|
300
|
+
npm run release:patch
|
|
301
|
+
|
|
302
|
+
# For a minor release (1.0.0 -> 1.1.0)
|
|
303
|
+
npm run release:minor
|
|
304
|
+
|
|
305
|
+
# For a major release (1.0.0 -> 2.0.0)
|
|
306
|
+
npm run release:major
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
The GitHub Action will automatically:
|
|
310
|
+
- Run tests and build the project
|
|
311
|
+
- Publish to npm with provenance
|
|
312
|
+
- Create a GitHub release
|
|
313
|
+
- Update version badges
|
|
314
|
+
|
|
315
|
+
## License
|
|
316
|
+
|
|
317
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ForecastParams, ArchiveParams, AirQualityParams, MarineParams, ElevationParams, WeatherResponse, ElevationResponse } from './types.js';
|
|
2
|
+
export declare class OpenMeteoClient {
|
|
3
|
+
private client;
|
|
4
|
+
private airQualityClient;
|
|
5
|
+
private marineClient;
|
|
6
|
+
private archiveClient;
|
|
7
|
+
private seasonalClient;
|
|
8
|
+
private ensembleClient;
|
|
9
|
+
constructor(baseURL?: string);
|
|
10
|
+
private buildParams;
|
|
11
|
+
getForecast(params: ForecastParams): Promise<WeatherResponse>;
|
|
12
|
+
getArchive(params: ArchiveParams): Promise<WeatherResponse>;
|
|
13
|
+
getDwdIcon(params: ForecastParams): Promise<WeatherResponse>;
|
|
14
|
+
getGfs(params: ForecastParams): Promise<WeatherResponse>;
|
|
15
|
+
getMeteoFrance(params: ForecastParams): Promise<WeatherResponse>;
|
|
16
|
+
getEcmwf(params: ForecastParams): Promise<WeatherResponse>;
|
|
17
|
+
getJma(params: ForecastParams): Promise<WeatherResponse>;
|
|
18
|
+
getMetno(params: ForecastParams): Promise<WeatherResponse>;
|
|
19
|
+
getGem(params: ForecastParams): Promise<WeatherResponse>;
|
|
20
|
+
getAirQuality(params: AirQualityParams): Promise<WeatherResponse>;
|
|
21
|
+
getMarine(params: MarineParams): Promise<WeatherResponse>;
|
|
22
|
+
getEnsemble(params: ForecastParams): Promise<WeatherResponse>;
|
|
23
|
+
getElevation(params: ElevationParams): Promise<ElevationResponse>;
|
|
24
|
+
getFlood(params: AirQualityParams): Promise<WeatherResponse>;
|
|
25
|
+
getSeasonal(params: ForecastParams): Promise<WeatherResponse>;
|
|
26
|
+
getClimate(params: ForecastParams): Promise<WeatherResponse>;
|
|
27
|
+
}
|
|
28
|
+
//# sour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O,CAAC,eAAe,CAAC;IAOzD,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAO7D,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAOjE,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAO5D,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAO7D,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;CAMnE"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
export class OpenMeteoClient {
|
|
3
|
+
client;
|
|
4
|
+
airQualityClient;
|
|
5
|
+
marineClient;
|
|
6
|
+
archiveClient;
|
|
7
|
+
seasonalClient;
|
|
8
|
+
ensembleClient;
|
|
9
|
+
constructor(baseURL = process.env.OPEN_METEO_API_URL || 'https://api.open-meteo.com') {
|
|
10
|
+
const config = {
|
|
11
|
+
timeout: 30000,
|
|
12
|
+
headers: {
|
|
13
|
+
'Accept': 'application/json',
|
|
14
|
+
'User-Agent': 'Open-Meteo-MCP-Server/1.0.0'
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
// Utilisation des variables d'environnement avec des valeurs par défaut
|
|
18
|
+
const airQualityURL = process.env.OPEN_METEO_AIR_QUALITY_API_URL || 'https://air-quality-api.open-meteo.com';
|
|
19
|
+
const marineURL = process.env.OPEN_METEO_MARINE_API_URL || 'https://marine-api.open-meteo.com';
|
|
20
|
+
const archiveURL = process.env.OPEN_METEO_ARCHIVE_API_URL || 'https://archive-api.open-meteo.com';
|
|
21
|
+
const seasonalURL = process.env.OPEN_METEO_SEASONAL_API_URL || 'https://seasonal-api.open-meteo.com';
|
|
22
|
+
const ensembleURL = process.env.OPEN_METEO_ENSEMBLE_API_URL || 'https://ensemble-api.open-meteo.com';
|
|
23
|
+
this.client = axios.create({ baseURL, ...config });
|
|
24
|
+
this.airQualityClient = axios.create({ baseURL: airQualityURL, ...config });
|
|
25
|
+
this.marineClient = axios.create({ baseURL: marineURL, ...config });
|
|
26
|
+
this.archiveClient = axios.create({ baseURL: archiveURL, ...config });
|
|
27
|
+
this.seasonalClient = axios.create({ baseURL: seasonalURL, ...config });
|
|
28
|
+
this.ensembleClient = axios.create({ baseURL: ensembleURL, ...config });
|
|
29
|
+
}
|
|
30
|
+
buildParams(params) {
|
|
31
|
+
const result = {};
|
|
32
|
+
for (const [key, value] of Object.entries(params)) {
|
|
33
|
+
if (value !== undefined && value !== null) {
|
|
34
|
+
if (Array.isArray(value)) {
|
|
35
|
+
result[key] = value.join(',');
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
result[key] = String(value);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
async getForecast(params) {
|
|
45
|
+
const response = await this.client.get('/v1/forecast', {
|
|
46
|
+
params: this.buildParams(params)
|
|
47
|
+
});
|
|
48
|
+
return response.data;
|
|
49
|
+
}
|
|
50
|
+
async getArchive(params) {
|
|
51
|
+
const response = await this.archiveClient.get('/v1/archive', {
|
|
52
|
+
params: this.buildParams(params)
|
|
53
|
+
});
|
|
54
|
+
return response.data;
|
|
55
|
+
}
|
|
56
|
+
async getDwdIcon(params) {
|
|
57
|
+
const response = await this.client.get('/v1/dwd-icon', {
|
|
58
|
+
params: this.buildParams(params)
|
|
59
|
+
});
|
|
60
|
+
return response.data;
|
|
61
|
+
}
|
|
62
|
+
async getGfs(params) {
|
|
63
|
+
const response = await this.client.get('/v1/gfs', {
|
|
64
|
+
params: this.buildParams(params)
|
|
65
|
+
});
|
|
66
|
+
return response.data;
|
|
67
|
+
}
|
|
68
|
+
async getMeteoFrance(params) {
|
|
69
|
+
const response = await this.client.get('/v1/meteofrance', {
|
|
70
|
+
params: this.buildParams(params)
|
|
71
|
+
});
|
|
72
|
+
return response.data;
|
|
73
|
+
}
|
|
74
|
+
async getEcmwf(params) {
|
|
75
|
+
const response = await this.client.get('/v1/ecmwf', {
|
|
76
|
+
params: this.buildParams(params)
|
|
77
|
+
});
|
|
78
|
+
return response.data;
|
|
79
|
+
}
|
|
80
|
+
async getJma(params) {
|
|
81
|
+
const response = await this.client.get('/v1/jma', {
|
|
82
|
+
params: this.buildParams(params)
|
|
83
|
+
});
|
|
84
|
+
return response.data;
|
|
85
|
+
}
|
|
86
|
+
async getMetno(params) {
|
|
87
|
+
const response = await this.client.get('/v1/metno', {
|
|
88
|
+
params: this.buildParams(params)
|
|
89
|
+
});
|
|
90
|
+
return response.data;
|
|
91
|
+
}
|
|
92
|
+
async getGem(params) {
|
|
93
|
+
const response = await this.client.get('/v1/gem', {
|
|
94
|
+
params: this.buildParams(params)
|
|
95
|
+
});
|
|
96
|
+
return response.data;
|
|
97
|
+
}
|
|
98
|
+
async getAirQuality(params) {
|
|
99
|
+
const response = await this.airQualityClient.get('/v1/air-quality', {
|
|
100
|
+
params: this.buildParams(params)
|
|
101
|
+
});
|
|
102
|
+
return response.data;
|
|
103
|
+
}
|
|
104
|
+
async getMarine(params) {
|
|
105
|
+
const response = await this.marineClient.get('/v1/marine', {
|
|
106
|
+
params: this.buildParams(params)
|
|
107
|
+
});
|
|
108
|
+
return response.data;
|
|
109
|
+
}
|
|
110
|
+
async getEnsemble(params) {
|
|
111
|
+
const response = await this.ensembleClient.get('/v1/ensemble', {
|
|
112
|
+
params: this.buildParams(params)
|
|
113
|
+
});
|
|
114
|
+
return response.data;
|
|
115
|
+
}
|
|
116
|
+
async getElevation(params) {
|
|
117
|
+
const response = await this.client.get('/v1/elevation', {
|
|
118
|
+
params: this.buildParams(params)
|
|
119
|
+
});
|
|
120
|
+
return response.data;
|
|
121
|
+
}
|
|
122
|
+
async getFlood(params) {
|
|
123
|
+
const response = await this.client.get('/v1/flood', {
|
|
124
|
+
params: this.buildParams(params)
|
|
125
|
+
});
|
|
126
|
+
return response.data;
|
|
127
|
+
}
|
|
128
|
+
async getSeasonal(params) {
|
|
129
|
+
const response = await this.seasonalClient.get('/v1/seasonal', {
|
|
130
|
+
params: this.buildParams(params)
|
|
131
|
+
});
|
|
132
|
+
return response.data;
|
|
133
|
+
}
|
|
134
|
+
async getClimate(params) {
|
|
135
|
+
const response = await this.client.get('/v1/climate', {
|
|
136
|
+
params: this.buildParams(params)
|
|
137
|
+
});
|
|
138
|
+
return response.data;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAW7C,MAAM,OAAO,eAAe;IAClB,MAAM,CAAgB;IACtB,gBAAgB,CAAgB;IAChC,YAAY,CAAgB;IAC5B,aAAa,CAAgB;IAC7B,cAAc,CAAgB;IAC9B,cAAc,CAAgB;IAEtC,YAAY,UAAkB,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,4BAA4B;QAC1F,MAAM,MAAM,GAAG;YACb,OAAO,EAAE,KAAK;YACd,OAAO,EAAE;gBACP,QAAQ,EAAE,kBAAkB;gBAC5B,YAAY,EAAE,6BAA6B;aAC5C;SACF,CAAC;QAEF,wEAAwE;QACxE,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,wCAAwC,CAAC;QAC7G,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,mCAAmC,CAAC;QAC/F,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,IAAI,oCAAoC,CAAC;QAClG,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,qCAAqC,CAAC;QACrG,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC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