hkopenai.hk-climate-mcp-server 0.2.0__py3-none-any.whl → 0.3.0__py3-none-any.whl
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.
- hkopenai/hk_climate_mcp_server/__init__.py +24 -2
- hkopenai/hk_climate_mcp_server/app.py +180 -0
- hkopenai/hk_climate_mcp_server/tool_weather.py +360 -1
- {hkopenai_hk_climate_mcp_server-0.2.0.dist-info → hkopenai_hk_climate_mcp_server-0.3.0.dist-info}/METADATA +62 -3
- hkopenai_hk_climate_mcp_server-0.3.0.dist-info/RECORD +10 -0
- hkopenai_hk_climate_mcp_server-0.2.0.dist-info/RECORD +0 -10
- {hkopenai_hk_climate_mcp_server-0.2.0.dist-info → hkopenai_hk_climate_mcp_server-0.3.0.dist-info}/WHEEL +0 -0
- {hkopenai_hk_climate_mcp_server-0.2.0.dist-info → hkopenai_hk_climate_mcp_server-0.3.0.dist-info}/entry_points.txt +0 -0
- {hkopenai_hk_climate_mcp_server-0.2.0.dist-info → hkopenai_hk_climate_mcp_server-0.3.0.dist-info}/licenses/LICENSE +0 -0
- {hkopenai_hk_climate_mcp_server-0.2.0.dist-info → hkopenai_hk_climate_mcp_server-0.3.0.dist-info}/top_level.txt +0 -0
@@ -6,7 +6,18 @@ from .tool_weather import (
|
|
6
6
|
get_local_weather_forecast,
|
7
7
|
get_weather_warning_summary,
|
8
8
|
get_weather_warning_info,
|
9
|
-
get_special_weather_tips
|
9
|
+
get_special_weather_tips,
|
10
|
+
get_visibility_data,
|
11
|
+
get_lightning_data,
|
12
|
+
get_moon_times,
|
13
|
+
get_hourly_tides,
|
14
|
+
get_high_low_tides,
|
15
|
+
get_sunrise_sunset_times,
|
16
|
+
get_gregorian_lunar_calendar,
|
17
|
+
get_daily_mean_temperature,
|
18
|
+
get_daily_max_temperature,
|
19
|
+
get_daily_min_temperature,
|
20
|
+
get_weather_radiation_report
|
10
21
|
)
|
11
22
|
|
12
23
|
__version__ = "0.1.0"
|
@@ -17,5 +28,16 @@ __all__ = [
|
|
17
28
|
'get_local_weather_forecast',
|
18
29
|
'get_weather_warning_summary',
|
19
30
|
'get_weather_warning_info',
|
20
|
-
'get_special_weather_tips'
|
31
|
+
'get_special_weather_tips',
|
32
|
+
'get_visibility_data',
|
33
|
+
'get_lightning_data',
|
34
|
+
'get_moon_times',
|
35
|
+
'get_hourly_tides',
|
36
|
+
'get_high_low_tides',
|
37
|
+
'get_sunrise_sunset_times',
|
38
|
+
'get_gregorian_lunar_calendar',
|
39
|
+
'get_daily_mean_temperature',
|
40
|
+
'get_daily_max_temperature',
|
41
|
+
'get_daily_min_temperature',
|
42
|
+
'get_weather_radiation_report'
|
21
43
|
]
|
@@ -43,6 +43,186 @@ def create_mcp_server():
|
|
43
43
|
)
|
44
44
|
def get_special_weather_tips(lang: str = "en") -> Dict:
|
45
45
|
return tool_weather.get_special_weather_tips(lang)
|
46
|
+
|
47
|
+
@mcp.tool(
|
48
|
+
description="Get latest 10-minute mean visibility data for Hong Kong",
|
49
|
+
)
|
50
|
+
def get_visibility_data(lang: str = "en", rformat: str = "json") -> Dict:
|
51
|
+
return tool_weather.get_visibility_data(lang, rformat)
|
52
|
+
|
53
|
+
@mcp.tool(
|
54
|
+
description="Get cloud-to-ground and cloud-to-cloud lightning count data",
|
55
|
+
)
|
56
|
+
def get_lightning_data(lang: str = "en", rformat: str = "json") -> Dict:
|
57
|
+
return tool_weather.get_lightning_data(lang, rformat)
|
58
|
+
|
59
|
+
@mcp.tool(
|
60
|
+
description="Get times of moonrise, moon transit and moonset",
|
61
|
+
)
|
62
|
+
def get_moon_times(
|
63
|
+
year: int,
|
64
|
+
month: Optional[int] = None,
|
65
|
+
day: Optional[int] = None,
|
66
|
+
lang: str = "en",
|
67
|
+
rformat: str = "json"
|
68
|
+
) -> Dict:
|
69
|
+
return tool_weather.get_moon_times(
|
70
|
+
year=year,
|
71
|
+
month=month,
|
72
|
+
day=day,
|
73
|
+
lang=lang,
|
74
|
+
rformat=rformat
|
75
|
+
)
|
76
|
+
|
77
|
+
@mcp.tool(
|
78
|
+
description="Get hourly heights of astronomical tides for a specific station in Hong Kong",
|
79
|
+
)
|
80
|
+
def get_hourly_tides(
|
81
|
+
station: str,
|
82
|
+
year: int,
|
83
|
+
month: Optional[int] = None,
|
84
|
+
day: Optional[int] = None,
|
85
|
+
hour: Optional[int] = None,
|
86
|
+
lang: str = "en",
|
87
|
+
rformat: str = "json"
|
88
|
+
) -> Dict:
|
89
|
+
return tool_weather.get_hourly_tides(
|
90
|
+
station=station,
|
91
|
+
year=year,
|
92
|
+
month=month,
|
93
|
+
day=day,
|
94
|
+
hour=hour,
|
95
|
+
lang=lang,
|
96
|
+
rformat=rformat
|
97
|
+
)
|
98
|
+
|
99
|
+
@mcp.tool(
|
100
|
+
description="Get times and heights of astronomical high and low tides for a specific station in Hong Kong",
|
101
|
+
)
|
102
|
+
def get_high_low_tides(
|
103
|
+
station: str,
|
104
|
+
year: int,
|
105
|
+
month: Optional[int] = None,
|
106
|
+
day: Optional[int] = None,
|
107
|
+
hour: Optional[int] = None,
|
108
|
+
lang: str = "en",
|
109
|
+
rformat: str = "json"
|
110
|
+
) -> Dict:
|
111
|
+
return tool_weather.get_high_low_tides(
|
112
|
+
station=station,
|
113
|
+
year=year,
|
114
|
+
month=month,
|
115
|
+
day=day,
|
116
|
+
hour=hour,
|
117
|
+
lang=lang,
|
118
|
+
rformat=rformat
|
119
|
+
)
|
120
|
+
|
121
|
+
@mcp.tool(
|
122
|
+
description="Get times of sunrise, sun transit and sunset for Hong Kong",
|
123
|
+
)
|
124
|
+
def get_sunrise_sunset_times(
|
125
|
+
year: int,
|
126
|
+
month: Optional[int] = None,
|
127
|
+
day: Optional[int] = None,
|
128
|
+
lang: str = "en",
|
129
|
+
rformat: str = "json"
|
130
|
+
) -> Dict:
|
131
|
+
return tool_weather.get_sunrise_sunset_times(
|
132
|
+
year=year,
|
133
|
+
month=month,
|
134
|
+
day=day,
|
135
|
+
lang=lang,
|
136
|
+
rformat=rformat
|
137
|
+
)
|
138
|
+
|
139
|
+
@mcp.tool(
|
140
|
+
description="Get Gregorian-Lunar calendar conversion data",
|
141
|
+
)
|
142
|
+
def get_gregorian_lunar_calendar(
|
143
|
+
year: int,
|
144
|
+
month: Optional[int] = None,
|
145
|
+
day: Optional[int] = None,
|
146
|
+
lang: str = "en",
|
147
|
+
rformat: str = "json"
|
148
|
+
) -> Dict:
|
149
|
+
return tool_weather.get_gregorian_lunar_calendar(
|
150
|
+
year=year,
|
151
|
+
month=month,
|
152
|
+
day=day,
|
153
|
+
lang=lang,
|
154
|
+
rformat=rformat
|
155
|
+
)
|
156
|
+
|
157
|
+
@mcp.tool(
|
158
|
+
description="Get daily mean temperature data for a specific station in Hong Kong",
|
159
|
+
)
|
160
|
+
def get_daily_mean_temperature(
|
161
|
+
station: str,
|
162
|
+
year: Optional[int] = None,
|
163
|
+
month: Optional[int] = None,
|
164
|
+
lang: str = "en",
|
165
|
+
rformat: str = "json"
|
166
|
+
) -> Dict:
|
167
|
+
return tool_weather.get_daily_mean_temperature(
|
168
|
+
station=station,
|
169
|
+
year=year,
|
170
|
+
month=month,
|
171
|
+
lang=lang,
|
172
|
+
rformat=rformat
|
173
|
+
)
|
174
|
+
|
175
|
+
@mcp.tool(
|
176
|
+
description="Get daily maximum temperature data for a specific station in Hong Kong",
|
177
|
+
)
|
178
|
+
def get_daily_max_temperature(
|
179
|
+
station: str,
|
180
|
+
year: Optional[int] = None,
|
181
|
+
month: Optional[int] = None,
|
182
|
+
lang: str = "en",
|
183
|
+
rformat: str = "json"
|
184
|
+
) -> Dict:
|
185
|
+
return tool_weather.get_daily_max_temperature(
|
186
|
+
station=station,
|
187
|
+
year=year,
|
188
|
+
month=month,
|
189
|
+
lang=lang,
|
190
|
+
rformat=rformat
|
191
|
+
)
|
192
|
+
|
193
|
+
@mcp.tool(
|
194
|
+
description="Get daily minimum temperature data for a specific station in Hong Kong",
|
195
|
+
)
|
196
|
+
def get_daily_min_temperature(
|
197
|
+
station: str,
|
198
|
+
year: Optional[int] = None,
|
199
|
+
month: Optional[int] = None,
|
200
|
+
lang: str = "en",
|
201
|
+
rformat: str = "json"
|
202
|
+
) -> Dict:
|
203
|
+
return tool_weather.get_daily_min_temperature(
|
204
|
+
station=station,
|
205
|
+
year=year,
|
206
|
+
month=month,
|
207
|
+
lang=lang,
|
208
|
+
rformat=rformat
|
209
|
+
)
|
210
|
+
|
211
|
+
@mcp.tool(
|
212
|
+
description="Get weather and radiation level report for Hong Kong",
|
213
|
+
)
|
214
|
+
def get_weather_radiation_report(
|
215
|
+
date: Optional[str] = None,
|
216
|
+
station: Optional[str] = None,
|
217
|
+
lang: str = "en",
|
218
|
+
rformat: str = "json"
|
219
|
+
) -> Dict:
|
220
|
+
return tool_weather.get_weather_radiation_report(
|
221
|
+
date=date,
|
222
|
+
station=station,
|
223
|
+
lang=lang,
|
224
|
+
rformat=rformat
|
225
|
+
)
|
46
226
|
|
47
227
|
return mcp
|
48
228
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import requests
|
2
|
-
from typing import Dict, List, Any
|
2
|
+
from typing import Dict, List, Any, Optional
|
3
3
|
|
4
4
|
def get_current_weather(region: str = "Hong Kong Observatory", lang: str = "en") -> Dict:
|
5
5
|
"""
|
@@ -239,3 +239,362 @@ def get_special_weather_tips(lang: str = "en") -> Dict[str, Any]:
|
|
239
239
|
"specialWeatherTips": data.get("specialWeatherTips", []),
|
240
240
|
"updateTime": data.get("updateTime", ""),
|
241
241
|
}
|
242
|
+
|
243
|
+
def get_visibility_data(lang: str = "en", rformat: str = "json") -> Dict[str, Any]:
|
244
|
+
"""
|
245
|
+
Get latest 10-minute mean visibility data for Hong Kong.
|
246
|
+
|
247
|
+
Args:
|
248
|
+
lang: Language code (en/tc/sc, default: en)
|
249
|
+
rformat: Return format (json/csv, default: json)
|
250
|
+
|
251
|
+
Returns:
|
252
|
+
Dict containing visibility data with fields and data arrays
|
253
|
+
"""
|
254
|
+
url = f"https://data.weather.gov.hk/weatherAPI/opendata/opendata.php?dataType=LTMV&lang={lang}&rformat={rformat}"
|
255
|
+
response = requests.get(url)
|
256
|
+
return response.json() if rformat == "json" else {"data": response.text}
|
257
|
+
|
258
|
+
def get_weather_radiation_report(
|
259
|
+
date: Optional[str] = None,
|
260
|
+
station: Optional[str] = None,
|
261
|
+
lang: str = "en",
|
262
|
+
rformat: str = "json"
|
263
|
+
) -> Dict[str, Any]:
|
264
|
+
"""
|
265
|
+
Get weather and radiation level report for Hong Kong.
|
266
|
+
|
267
|
+
Args:
|
268
|
+
date: Optional date in YYYYMMDD format (default: yesterday)
|
269
|
+
station: Optional station code (e.g. 'HKO' for Hong Kong Observatory)
|
270
|
+
lang: Language code (en/tc/sc, default: en)
|
271
|
+
rformat: Return format (json/csv, default: json)
|
272
|
+
|
273
|
+
Returns:
|
274
|
+
Dict containing weather and radiation data
|
275
|
+
"""
|
276
|
+
params = {
|
277
|
+
'dataType': 'RYES',
|
278
|
+
'lang': lang,
|
279
|
+
'rformat': rformat
|
280
|
+
}
|
281
|
+
if date: params['date'] = date
|
282
|
+
if station: params['station'] = station
|
283
|
+
|
284
|
+
response = requests.get(
|
285
|
+
'https://data.weather.gov.hk/weatherAPI/opendata/opendata.php',
|
286
|
+
params=params
|
287
|
+
)
|
288
|
+
response.raise_for_status()
|
289
|
+
return response.json() if rformat == "json" else {"data": response.text}
|
290
|
+
|
291
|
+
def get_daily_mean_temperature(
|
292
|
+
station: str,
|
293
|
+
year: Optional[int] = None,
|
294
|
+
month: Optional[int] = None,
|
295
|
+
lang: str = "en",
|
296
|
+
rformat: str = "json"
|
297
|
+
) -> Dict[str, Any]:
|
298
|
+
"""
|
299
|
+
Get daily mean temperature data for a specific station.
|
300
|
+
|
301
|
+
Args:
|
302
|
+
station: Station code (e.g. 'HKO' for Hong Kong Observatory)
|
303
|
+
year: Optional year (varies by station)
|
304
|
+
month: Optional month (1-12)
|
305
|
+
lang: Language code (en/tc/sc, default: en)
|
306
|
+
rformat: Return format (json/csv, default: json)
|
307
|
+
|
308
|
+
Returns:
|
309
|
+
Dict containing temperature data with fields and data arrays
|
310
|
+
"""
|
311
|
+
params = {
|
312
|
+
'dataType': 'CLMTEMP',
|
313
|
+
'lang': lang,
|
314
|
+
'rformat': rformat,
|
315
|
+
'station': station
|
316
|
+
}
|
317
|
+
if year: params['year'] = year
|
318
|
+
if month: params['month'] = month
|
319
|
+
|
320
|
+
response = requests.get(
|
321
|
+
'https://data.weather.gov.hk/weatherAPI/opendata/opendata.php',
|
322
|
+
params=params
|
323
|
+
)
|
324
|
+
response.raise_for_status()
|
325
|
+
return response.json() if rformat == "json" else {"data": response.text}
|
326
|
+
|
327
|
+
def get_daily_max_temperature(
|
328
|
+
station: str,
|
329
|
+
year: Optional[int] = None,
|
330
|
+
month: Optional[int] = None,
|
331
|
+
lang: str = "en",
|
332
|
+
rformat: str = "json"
|
333
|
+
) -> Dict[str, Any]:
|
334
|
+
"""
|
335
|
+
Get daily maximum temperature data for a specific station.
|
336
|
+
|
337
|
+
Args:
|
338
|
+
station: Station code (e.g. 'HKO' for Hong Kong Observatory)
|
339
|
+
year: Optional year (varies by station)
|
340
|
+
month: Optional month (1-12)
|
341
|
+
lang: Language code (en/tc/sc, default: en)
|
342
|
+
rformat: Return format (json/csv, default: json)
|
343
|
+
|
344
|
+
Returns:
|
345
|
+
Dict containing temperature data with fields and data arrays
|
346
|
+
"""
|
347
|
+
params = {
|
348
|
+
'dataType': 'CLMMAXT',
|
349
|
+
'lang': lang,
|
350
|
+
'rformat': rformat,
|
351
|
+
'station': station
|
352
|
+
}
|
353
|
+
if year: params['year'] = year
|
354
|
+
if month: params['month'] = month
|
355
|
+
|
356
|
+
response = requests.get(
|
357
|
+
'https://data.weather.gov.hk/weatherAPI/opendata/opendata.php',
|
358
|
+
params=params
|
359
|
+
)
|
360
|
+
response.raise_for_status()
|
361
|
+
return response.json() if rformat == "json" else {"data": response.text}
|
362
|
+
|
363
|
+
def get_daily_min_temperature(
|
364
|
+
station: str,
|
365
|
+
year: Optional[int] = None,
|
366
|
+
month: Optional[int] = None,
|
367
|
+
lang: str = "en",
|
368
|
+
rformat: str = "json"
|
369
|
+
) -> Dict[str, Any]:
|
370
|
+
"""
|
371
|
+
Get daily minimum temperature data for a specific station.
|
372
|
+
|
373
|
+
Args:
|
374
|
+
station: Station code (e.g. 'HKO' for Hong Kong Observatory)
|
375
|
+
year: Optional year (varies by station)
|
376
|
+
month: Optional month (1-12)
|
377
|
+
lang: Language code (en/tc/sc, default: en)
|
378
|
+
rformat: Return format (json/csv, default: json)
|
379
|
+
|
380
|
+
Returns:
|
381
|
+
Dict containing temperature data with fields and data arrays
|
382
|
+
"""
|
383
|
+
params = {
|
384
|
+
'dataType': 'CLMMINT',
|
385
|
+
'lang': lang,
|
386
|
+
'rformat': rformat,
|
387
|
+
'station': station
|
388
|
+
}
|
389
|
+
if year: params['year'] = year
|
390
|
+
if month: params['month'] = month
|
391
|
+
|
392
|
+
response = requests.get(
|
393
|
+
'https://data.weather.gov.hk/weatherAPI/opendata/opendata.php',
|
394
|
+
params=params
|
395
|
+
)
|
396
|
+
response.raise_for_status()
|
397
|
+
return response.json() if rformat == "json" else {"data": response.text}
|
398
|
+
|
399
|
+
def get_lightning_data(lang: str = "en", rformat: str = "json") -> Dict[str, Any]:
|
400
|
+
"""
|
401
|
+
Get cloud-to-ground and cloud-to-cloud lightning count data.
|
402
|
+
|
403
|
+
Args:
|
404
|
+
lang: Language code (en/tc/sc, default: en)
|
405
|
+
rformat: Return format (json/csv, default: json)
|
406
|
+
|
407
|
+
Returns:
|
408
|
+
Dict containing lightning data with fields and data arrays
|
409
|
+
"""
|
410
|
+
url = f"https://data.weather.gov.hk/weatherAPI/opendata/opendata.php?dataType=LHL&lang={lang}&rformat={rformat}"
|
411
|
+
response = requests.get(url)
|
412
|
+
return response.json() if rformat == "json" else {"data": response.text}
|
413
|
+
|
414
|
+
def get_moon_times(year: int, month: Optional[int] = None,
|
415
|
+
day: Optional[int] = None, lang: str = "en",
|
416
|
+
rformat: str = "json") -> Dict[str, Any]:
|
417
|
+
"""
|
418
|
+
Get times of moonrise, moon transit and moonset.
|
419
|
+
|
420
|
+
Args:
|
421
|
+
year: Year (2018-2024)
|
422
|
+
month: Optional month (1-12)
|
423
|
+
day: Optional day (1-31)
|
424
|
+
lang: Language code (en/tc/sc, default: en)
|
425
|
+
rformat: Return format (json/csv, default: json)
|
426
|
+
|
427
|
+
Returns:
|
428
|
+
Dict containing moon times data with fields and data arrays
|
429
|
+
"""
|
430
|
+
params = {
|
431
|
+
'dataType': 'MRS',
|
432
|
+
'lang': lang,
|
433
|
+
'rformat': rformat,
|
434
|
+
'year': year
|
435
|
+
}
|
436
|
+
if month: params['month'] = month
|
437
|
+
if day: params['day'] = day
|
438
|
+
|
439
|
+
response = requests.get(
|
440
|
+
'https://data.weather.gov.hk/weatherAPI/opendata/opendata.php',
|
441
|
+
params=params
|
442
|
+
)
|
443
|
+
response.raise_for_status()
|
444
|
+
return response.json() if rformat == "json" else {"data": response.text}
|
445
|
+
|
446
|
+
def get_hourly_tides(
|
447
|
+
station: str,
|
448
|
+
year: int,
|
449
|
+
month: Optional[int] = None,
|
450
|
+
day: Optional[int] = None,
|
451
|
+
hour: Optional[int] = None,
|
452
|
+
lang: str = "en",
|
453
|
+
rformat: str = "json"
|
454
|
+
) -> Dict[str, Any]:
|
455
|
+
"""
|
456
|
+
Get hourly heights of astronomical tides for a specific station in Hong Kong.
|
457
|
+
|
458
|
+
Args:
|
459
|
+
station: Station code (e.g. 'CCH' for Cheung Chau)
|
460
|
+
year: Year (2022-2024)
|
461
|
+
month: Optional month (1-12)
|
462
|
+
day: Optional day (1-31)
|
463
|
+
hour: Optional hour (1-24)
|
464
|
+
lang: Language code (en/tc/sc, default: en)
|
465
|
+
rformat: Return format (json/csv, default: json)
|
466
|
+
|
467
|
+
Returns:
|
468
|
+
Dict containing tide data with fields and data arrays
|
469
|
+
"""
|
470
|
+
params = {
|
471
|
+
'dataType': 'HHOT',
|
472
|
+
'lang': lang,
|
473
|
+
'rformat': rformat,
|
474
|
+
'station': station,
|
475
|
+
'year': year
|
476
|
+
}
|
477
|
+
if month: params['month'] = month
|
478
|
+
if day: params['day'] = day
|
479
|
+
if hour: params['hour'] = hour
|
480
|
+
|
481
|
+
response = requests.get(
|
482
|
+
'https://data.weather.gov.hk/weatherAPI/opendata/opendata.php',
|
483
|
+
params=params
|
484
|
+
)
|
485
|
+
response.raise_for_status()
|
486
|
+
return response.json() if rformat == "json" else {"data": response.text}
|
487
|
+
|
488
|
+
def get_high_low_tides(
|
489
|
+
station: str,
|
490
|
+
year: int,
|
491
|
+
month: Optional[int] = None,
|
492
|
+
day: Optional[int] = None,
|
493
|
+
hour: Optional[int] = None,
|
494
|
+
lang: str = "en",
|
495
|
+
rformat: str = "json"
|
496
|
+
) -> Dict[str, Any]:
|
497
|
+
"""
|
498
|
+
Get times and heights of astronomical high and low tides for a specific station.
|
499
|
+
|
500
|
+
Args:
|
501
|
+
station: Station code (e.g. 'CCH' for Cheung Chau)
|
502
|
+
year: Year (2022-2024)
|
503
|
+
month: Optional month (1-12)
|
504
|
+
day: Optional day (1-31)
|
505
|
+
hour: Optional hour (1-24)
|
506
|
+
lang: Language code (en/tc/sc, default: en)
|
507
|
+
rformat: Return format (json/csv, default: json)
|
508
|
+
|
509
|
+
Returns:
|
510
|
+
Dict containing tide data with fields and data arrays
|
511
|
+
"""
|
512
|
+
params = {
|
513
|
+
'dataType': 'HLT',
|
514
|
+
'lang': lang,
|
515
|
+
'rformat': rformat,
|
516
|
+
'station': station,
|
517
|
+
'year': year
|
518
|
+
}
|
519
|
+
if month: params['month'] = month
|
520
|
+
if day: params['day'] = day
|
521
|
+
if hour: params['hour'] = hour
|
522
|
+
|
523
|
+
response = requests.get(
|
524
|
+
'https://data.weather.gov.hk/weatherAPI/opendata/opendata.php',
|
525
|
+
params=params
|
526
|
+
)
|
527
|
+
response.raise_for_status()
|
528
|
+
return response.json() if rformat == "json" else {"data": response.text}
|
529
|
+
|
530
|
+
def get_sunrise_sunset_times(
|
531
|
+
year: int,
|
532
|
+
month: Optional[int] = None,
|
533
|
+
day: Optional[int] = None,
|
534
|
+
lang: str = "en",
|
535
|
+
rformat: str = "json"
|
536
|
+
) -> Dict[str, Any]:
|
537
|
+
"""
|
538
|
+
Get times of sunrise, sun transit and sunset.
|
539
|
+
|
540
|
+
Args:
|
541
|
+
year: Year (2018-2024)
|
542
|
+
month: Optional month (1-12)
|
543
|
+
day: Optional day (1-31)
|
544
|
+
lang: Language code (en/tc/sc, default: en)
|
545
|
+
rformat: Return format (json/csv, default: json)
|
546
|
+
|
547
|
+
Returns:
|
548
|
+
Dict containing sun times data with fields and data arrays
|
549
|
+
"""
|
550
|
+
params = {
|
551
|
+
'dataType': 'SRS',
|
552
|
+
'lang': lang,
|
553
|
+
'rformat': rformat,
|
554
|
+
'year': year
|
555
|
+
}
|
556
|
+
if month: params['month'] = month
|
557
|
+
if day: params['day'] = day
|
558
|
+
|
559
|
+
response = requests.get(
|
560
|
+
'https://data.weather.gov.hk/weatherAPI/opendata/opendata.php',
|
561
|
+
params=params
|
562
|
+
)
|
563
|
+
response.raise_for_status()
|
564
|
+
return response.json() if rformat == "json" else {"data": response.text}
|
565
|
+
|
566
|
+
def get_gregorian_lunar_calendar(
|
567
|
+
year: int,
|
568
|
+
month: Optional[int] = None,
|
569
|
+
day: Optional[int] = None,
|
570
|
+
lang: str = "en",
|
571
|
+
rformat: str = "json"
|
572
|
+
) -> Dict[str, Any]:
|
573
|
+
"""
|
574
|
+
Get Gregorian-Lunar calendar conversion data.
|
575
|
+
|
576
|
+
Args:
|
577
|
+
year: Year (1901-2100)
|
578
|
+
month: Optional month (1-12)
|
579
|
+
day: Optional day (1-31)
|
580
|
+
lang: Language code (en/tc/sc, default: en)
|
581
|
+
rformat: Return format (json/csv, default: json)
|
582
|
+
|
583
|
+
Returns:
|
584
|
+
Dict containing calendar conversion data
|
585
|
+
"""
|
586
|
+
params = {
|
587
|
+
'dataType': 'GLC',
|
588
|
+
'lang': lang,
|
589
|
+
'rformat': rformat,
|
590
|
+
'year': year
|
591
|
+
}
|
592
|
+
if month: params['month'] = month
|
593
|
+
if day: params['day'] = day
|
594
|
+
|
595
|
+
response = requests.get(
|
596
|
+
'https://data.weather.gov.hk/weatherAPI/opendata/opendata.php',
|
597
|
+
params=params
|
598
|
+
)
|
599
|
+
response.raise_for_status()
|
600
|
+
return response.json() if rformat == "json" else {"data": response.text}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hkopenai.hk_climate_mcp_server
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3.0
|
4
4
|
Summary: Hong Kong Weather MCP Server providing climate and weather data tools
|
5
5
|
Author-email: Neo Chow <neo@01man.com>
|
6
6
|
License-Expression: MIT
|
@@ -16,7 +16,7 @@ Requires-Dist: pytest>=8.2.0
|
|
16
16
|
Requires-Dist: pytest-cov>=6.1.1
|
17
17
|
Dynamic: license-file
|
18
18
|
|
19
|
-
#
|
19
|
+
# HK Climate and Weather MCP Server
|
20
20
|
|
21
21
|
[](https://github.com/hkopenai/hk-climate-mcp-server)
|
22
22
|
[](https://opensource.org/licenses/MIT)
|
@@ -106,6 +106,64 @@ This is an MCP server that provides access to climate and weather data through a
|
|
106
106
|
- specialWeatherTips: List of special weather tips
|
107
107
|
- updateTime: Last update time
|
108
108
|
|
109
|
+
### Visibility Data
|
110
|
+
`get_visibility_data(lang: str = "en", rformat: str = "json") -> Dict`
|
111
|
+
- Get latest 10-minute mean visibility data for Hong Kong
|
112
|
+
- Parameters:
|
113
|
+
- lang: Language code (en/tc/sc, default: en)
|
114
|
+
- rformat: Return format (json/csv, default: json)
|
115
|
+
- Returns:
|
116
|
+
- Dict containing visibility data with fields and data arrays
|
117
|
+
|
118
|
+
### Lightning Data
|
119
|
+
`get_lightning_data(lang: str = "en", rformat: str = "json") -> Dict`
|
120
|
+
- Get cloud-to-ground and cloud-to-cloud lightning count data
|
121
|
+
- Parameters:
|
122
|
+
- lang: Language code (en/tc/sc, default: en)
|
123
|
+
- rformat: Return format (json/csv, default: json)
|
124
|
+
- Returns:
|
125
|
+
- Dict containing lightning data with fields and data arrays
|
126
|
+
|
127
|
+
### Moon Times
|
128
|
+
`get_moon_times(year: int, month: Optional[int] = None, day: Optional[int] = None, lang: str = "en", rformat: str = "json") -> Dict`
|
129
|
+
- Get times of moonrise, moon transit and moonset
|
130
|
+
- Parameters:
|
131
|
+
- year: Year (2018-2024)
|
132
|
+
- month: Optional month (1-12)
|
133
|
+
- day: Optional day (1-31)
|
134
|
+
- lang: Language code (en/tc/sc, default: en)
|
135
|
+
- rformat: Return format (json/csv, default: json)
|
136
|
+
- Returns:
|
137
|
+
- Dict containing moon times data with fields and data arrays
|
138
|
+
|
139
|
+
### Hourly Tides
|
140
|
+
`get_hourly_tides(station: str, year: int, month: Optional[int] = None, day: Optional[int] = None, hour: Optional[int] = None, lang: str = "en", rformat: str = "json") -> Dict`
|
141
|
+
- Get hourly heights of astronomical tides for a specific station
|
142
|
+
- Parameters:
|
143
|
+
- station: Station code (e.g. 'CCH' for Cheung Chau)
|
144
|
+
- year: Year (2022-2024)
|
145
|
+
- month: Optional month (1-12)
|
146
|
+
- day: Optional day (1-31)
|
147
|
+
- hour: Optional hour (1-24)
|
148
|
+
- lang: Language code (en/tc/sc, default: en)
|
149
|
+
- rformat: Return format (json/csv, default: json)
|
150
|
+
- Returns:
|
151
|
+
- Dict containing tide data with fields and data arrays
|
152
|
+
|
153
|
+
### High/Low Tides
|
154
|
+
`get_high_low_tides(station: str, year: int, month: Optional[int] = None, day: Optional[int] = None, hour: Optional[int] = None, lang: str = "en", rformat: str = "json") -> Dict`
|
155
|
+
- Get times and heights of astronomical high and low tides
|
156
|
+
- Parameters:
|
157
|
+
- station: Station code (e.g. 'CCH' for Cheung Chau)
|
158
|
+
- year: Year (2022-2024)
|
159
|
+
- month: Optional month (1-12)
|
160
|
+
- day: Optional day (1-31)
|
161
|
+
- hour: Optional hour (1-24)
|
162
|
+
- lang: Language code (en/tc/sc, default: en)
|
163
|
+
- rformat: Return format (json/csv, default: json)
|
164
|
+
- Returns:
|
165
|
+
- Dict containing tide data with fields and data arrays
|
166
|
+
|
109
167
|
## Setup
|
110
168
|
|
111
169
|
1. Clone this repository
|
@@ -136,7 +194,8 @@ To connect this MCP server to Cline using stdio:
|
|
136
194
|
"type": "stdio",
|
137
195
|
"command": "python",
|
138
196
|
"args": [
|
139
|
-
"
|
197
|
+
"-m",
|
198
|
+
"hkopenai.hk_climate_mcp_server"
|
140
199
|
]
|
141
200
|
}
|
142
201
|
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
hkopenai/hk_climate_mcp_server/__init__.py,sha256=nJyrwz2k8WCam-VVqVAJTS4VqznFmlWW4-T9kdvl4k8,1155
|
2
|
+
hkopenai/hk_climate_mcp_server/__main__.py,sha256=2rpUSwIvU59qepKyDNMz6AtDrbsRVVIZZP0hL5LoZbs,91
|
3
|
+
hkopenai/hk_climate_mcp_server/app.py,sha256=hXfnjbwW-0PoAfsstIedwRqNKyDKBR-gdD2FljWs5VA,7574
|
4
|
+
hkopenai/hk_climate_mcp_server/tool_weather.py,sha256=0fzUFP7nuKeH4H-1ajLCiRB6Qvr4f_ZjA2GCXZGJrpI,18876
|
5
|
+
hkopenai_hk_climate_mcp_server-0.3.0.dist-info/licenses/LICENSE,sha256=RzryYGol65qd1yszjiy-hSUsX9EJJkpwEpNXnIs_Bv8,1070
|
6
|
+
hkopenai_hk_climate_mcp_server-0.3.0.dist-info/METADATA,sha256=bUAs5zVGVD18xr8TmB9l5MndnPaaq0q2plCecAzcJjs,6825
|
7
|
+
hkopenai_hk_climate_mcp_server-0.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
8
|
+
hkopenai_hk_climate_mcp_server-0.3.0.dist-info/entry_points.txt,sha256=2pPEyDw5KdrNNZIGQsSrY-5IRMgWaWvEQT_BQJhKPMQ,82
|
9
|
+
hkopenai_hk_climate_mcp_server-0.3.0.dist-info/top_level.txt,sha256=6PRVKRM9BiU5vzKKGnsq2t0-Bi0TrJvSY35llo4nLFA,9
|
10
|
+
hkopenai_hk_climate_mcp_server-0.3.0.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
hkopenai/hk_climate_mcp_server/__init__.py,sha256=QgSoOyNq_fnuED4FMOV9aj2ZDyEmezGRy2GCP427G5g,519
|
2
|
-
hkopenai/hk_climate_mcp_server/__main__.py,sha256=2rpUSwIvU59qepKyDNMz6AtDrbsRVVIZZP0hL5LoZbs,91
|
3
|
-
hkopenai/hk_climate_mcp_server/app.py,sha256=sTJS-eEBwyZz4KiGSEJ5QVzhiBNAGvUPAukhYNlkiEk,2479
|
4
|
-
hkopenai/hk_climate_mcp_server/tool_weather.py,sha256=MitwPrgdE08zszoIqezY-Cxo5Z5fN5HHiZ6T-IpP3N0,8180
|
5
|
-
hkopenai_hk_climate_mcp_server-0.2.0.dist-info/licenses/LICENSE,sha256=RzryYGol65qd1yszjiy-hSUsX9EJJkpwEpNXnIs_Bv8,1070
|
6
|
-
hkopenai_hk_climate_mcp_server-0.2.0.dist-info/METADATA,sha256=CQb8Er_uk1Ms9ZQEKfS7l7ytdBo_K06yWrV9d6t-7zI,4415
|
7
|
-
hkopenai_hk_climate_mcp_server-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
8
|
-
hkopenai_hk_climate_mcp_server-0.2.0.dist-info/entry_points.txt,sha256=2pPEyDw5KdrNNZIGQsSrY-5IRMgWaWvEQT_BQJhKPMQ,82
|
9
|
-
hkopenai_hk_climate_mcp_server-0.2.0.dist-info/top_level.txt,sha256=6PRVKRM9BiU5vzKKGnsq2t0-Bi0TrJvSY35llo4nLFA,9
|
10
|
-
hkopenai_hk_climate_mcp_server-0.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|