hkopenai.hk-climate-mcp-server 0.3.0__tar.gz → 0.4.0__tar.gz

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 (52) hide show
  1. hkopenai_hk_climate_mcp_server-0.4.0/MANIFEST.in +3 -0
  2. {hkopenai_hk_climate_mcp_server-0.3.0 → hkopenai_hk_climate_mcp_server-0.4.0}/PKG-INFO +27 -14
  3. {hkopenai_hk_climate_mcp_server-0.3.0 → hkopenai_hk_climate_mcp_server-0.4.0}/README.md +26 -13
  4. hkopenai_hk_climate_mcp_server-0.4.0/hkopenai/hk_climate_mcp_server/__init__.py +6 -0
  5. hkopenai_hk_climate_mcp_server-0.4.0/hkopenai/hk_climate_mcp_server/__main__.py +4 -0
  6. hkopenai_hk_climate_mcp_server-0.3.0/hkopenai/hk_climate_mcp_server/app.py → hkopenai_hk_climate_mcp_server-0.4.0/hkopenai/hk_climate_mcp_server/server.py +61 -59
  7. hkopenai_hk_climate_mcp_server-0.4.0/hkopenai/hk_climate_mcp_server/tools/astronomical.py +109 -0
  8. hkopenai_hk_climate_mcp_server-0.4.0/hkopenai/hk_climate_mcp_server/tools/current_weather.py +106 -0
  9. hkopenai_hk_climate_mcp_server-0.4.0/hkopenai/hk_climate_mcp_server/tools/forecast.py +82 -0
  10. hkopenai_hk_climate_mcp_server-0.4.0/hkopenai/hk_climate_mcp_server/tools/lightning.py +20 -0
  11. hkopenai_hk_climate_mcp_server-0.4.0/hkopenai/hk_climate_mcp_server/tools/radiation.py +206 -0
  12. hkopenai_hk_climate_mcp_server-0.4.0/hkopenai/hk_climate_mcp_server/tools/temperature.py +119 -0
  13. hkopenai_hk_climate_mcp_server-0.4.0/hkopenai/hk_climate_mcp_server/tools/tides.py +165 -0
  14. hkopenai_hk_climate_mcp_server-0.4.0/hkopenai/hk_climate_mcp_server/tools/visibility.py +20 -0
  15. hkopenai_hk_climate_mcp_server-0.4.0/hkopenai/hk_climate_mcp_server/tools/warnings.py +77 -0
  16. {hkopenai_hk_climate_mcp_server-0.3.0 → hkopenai_hk_climate_mcp_server-0.4.0}/hkopenai.hk_climate_mcp_server.egg-info/PKG-INFO +27 -14
  17. hkopenai_hk_climate_mcp_server-0.4.0/hkopenai.hk_climate_mcp_server.egg-info/SOURCES.txt +43 -0
  18. {hkopenai_hk_climate_mcp_server-0.3.0 → hkopenai_hk_climate_mcp_server-0.4.0}/pyproject.toml +5 -2
  19. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_astronomical_live.py +35 -0
  20. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_calendar.py +28 -0
  21. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_current_weather.py +130 -0
  22. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_current_weather_live.py +34 -0
  23. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_forecast.py +80 -0
  24. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_forecast_live.py +33 -0
  25. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_lightning.py +27 -0
  26. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_lightning_live.py +33 -0
  27. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_moon_times.py +28 -0
  28. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_radiation.py +108 -0
  29. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_radiation_live.py +62 -0
  30. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_server.py +100 -0
  31. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_sun_times.py +28 -0
  32. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_temperature.py +70 -0
  33. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_temperature_live.py +79 -0
  34. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_tides.py +50 -0
  35. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_tides_live.py +55 -0
  36. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_visibility.py +27 -0
  37. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_visibility_live.py +33 -0
  38. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_warnings.py +64 -0
  39. hkopenai_hk_climate_mcp_server-0.4.0/tests/test_warnings_live.py +75 -0
  40. hkopenai_hk_climate_mcp_server-0.3.0/hkopenai/hk_climate_mcp_server/__init__.py +0 -43
  41. hkopenai_hk_climate_mcp_server-0.3.0/hkopenai/hk_climate_mcp_server/__main__.py +0 -4
  42. hkopenai_hk_climate_mcp_server-0.3.0/hkopenai/hk_climate_mcp_server/tool_weather.py +0 -600
  43. hkopenai_hk_climate_mcp_server-0.3.0/hkopenai.hk_climate_mcp_server.egg-info/SOURCES.txt +0 -16
  44. hkopenai_hk_climate_mcp_server-0.3.0/tests/test_app.py +0 -84
  45. hkopenai_hk_climate_mcp_server-0.3.0/tests/test_tools.py +0 -15
  46. hkopenai_hk_climate_mcp_server-0.3.0/tests/test_weather.py +0 -420
  47. {hkopenai_hk_climate_mcp_server-0.3.0 → hkopenai_hk_climate_mcp_server-0.4.0}/LICENSE +0 -0
  48. {hkopenai_hk_climate_mcp_server-0.3.0 → hkopenai_hk_climate_mcp_server-0.4.0}/hkopenai.hk_climate_mcp_server.egg-info/dependency_links.txt +0 -0
  49. {hkopenai_hk_climate_mcp_server-0.3.0 → hkopenai_hk_climate_mcp_server-0.4.0}/hkopenai.hk_climate_mcp_server.egg-info/entry_points.txt +0 -0
  50. {hkopenai_hk_climate_mcp_server-0.3.0 → hkopenai_hk_climate_mcp_server-0.4.0}/hkopenai.hk_climate_mcp_server.egg-info/requires.txt +0 -0
  51. {hkopenai_hk_climate_mcp_server-0.3.0 → hkopenai_hk_climate_mcp_server-0.4.0}/hkopenai.hk_climate_mcp_server.egg-info/top_level.txt +0 -0
  52. {hkopenai_hk_climate_mcp_server-0.3.0 → hkopenai_hk_climate_mcp_server-0.4.0}/setup.cfg +0 -0
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include hkopenai/hk_climate_mcp_server/tools *.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hkopenai.hk_climate_mcp_server
3
- Version: 0.3.0
3
+ Version: 0.4.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
@@ -107,37 +107,34 @@ This is an MCP server that provides access to climate and weather data through a
107
107
  - updateTime: Last update time
108
108
 
109
109
  ### Visibility Data
110
- `get_visibility_data(lang: str = "en", rformat: str = "json") -> Dict`
110
+ `get_visibility_data(lang: str = "en") -> Dict`
111
111
  - Get latest 10-minute mean visibility data for Hong Kong
112
112
  - Parameters:
113
113
  - lang: Language code (en/tc/sc, default: en)
114
- - rformat: Return format (json/csv, default: json)
115
114
  - Returns:
116
115
  - Dict containing visibility data with fields and data arrays
117
116
 
118
117
  ### Lightning Data
119
- `get_lightning_data(lang: str = "en", rformat: str = "json") -> Dict`
118
+ `get_lightning_data(lang: str = "en") -> Dict`
120
119
  - Get cloud-to-ground and cloud-to-cloud lightning count data
121
120
  - Parameters:
122
121
  - lang: Language code (en/tc/sc, default: en)
123
- - rformat: Return format (json/csv, default: json)
124
122
  - Returns:
125
123
  - Dict containing lightning data with fields and data arrays
126
124
 
127
125
  ### Moon Times
128
- `get_moon_times(year: int, month: Optional[int] = None, day: Optional[int] = None, lang: str = "en", rformat: str = "json") -> Dict`
126
+ `get_moon_times(year: int, month: Optional[int] = None, day: Optional[int] = None, lang: str = "en") -> Dict`
129
127
  - Get times of moonrise, moon transit and moonset
130
128
  - Parameters:
131
129
  - year: Year (2018-2024)
132
130
  - month: Optional month (1-12)
133
131
  - day: Optional day (1-31)
134
132
  - lang: Language code (en/tc/sc, default: en)
135
- - rformat: Return format (json/csv, default: json)
136
133
  - Returns:
137
134
  - Dict containing moon times data with fields and data arrays
138
135
 
139
136
  ### 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`
137
+ `get_hourly_tides(station: str, year: int, month: Optional[int] = None, day: Optional[int] = None, hour: Optional[int] = None, lang: str = "en") -> Dict`
141
138
  - Get hourly heights of astronomical tides for a specific station
142
139
  - Parameters:
143
140
  - station: Station code (e.g. 'CCH' for Cheung Chau)
@@ -146,12 +143,11 @@ This is an MCP server that provides access to climate and weather data through a
146
143
  - day: Optional day (1-31)
147
144
  - hour: Optional hour (1-24)
148
145
  - lang: Language code (en/tc/sc, default: en)
149
- - rformat: Return format (json/csv, default: json)
150
146
  - Returns:
151
147
  - Dict containing tide data with fields and data arrays
152
148
 
153
149
  ### 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`
150
+ `get_high_low_tides(station: str, year: int, month: Optional[int] = None, day: Optional[int] = None, hour: Optional[int] = None, lang: str = "en") -> Dict`
155
151
  - Get times and heights of astronomical high and low tides
156
152
  - Parameters:
157
153
  - station: Station code (e.g. 'CCH' for Cheung Chau)
@@ -160,10 +156,27 @@ This is an MCP server that provides access to climate and weather data through a
160
156
  - day: Optional day (1-31)
161
157
  - hour: Optional hour (1-24)
162
158
  - lang: Language code (en/tc/sc, default: en)
163
- - rformat: Return format (json/csv, default: json)
164
159
  - Returns:
165
160
  - Dict containing tide data with fields and data arrays
166
161
 
162
+ ### Weather and Radiation Report
163
+ `get_weather_radiation_report(date: str, station: str, lang: str = "en") -> Dict`
164
+ - Get weather and radiation level report for Hong Kong
165
+ - Parameters:
166
+ - date: Mandatory date in YYYYMMDD format (e.g., 20250618)
167
+ - station: Mandatory station code (e.g., 'HKO' for Hong Kong Observatory)
168
+ - lang: Language code (en/tc/sc, default: en)
169
+ - Returns:
170
+ - Dict containing weather and radiation data or error message if parameters are invalid
171
+
172
+ ### Station Codes
173
+ `get_radiation_station_codes() -> Dict`
174
+ - Get a list of station codes and their corresponding names for weather and radiation reports in Hong Kong
175
+ - Parameters:
176
+ - None
177
+ - Returns:
178
+ - Dict mapping station codes to station names
179
+
167
180
  ## Setup
168
181
 
169
182
  1. Clone this repository
@@ -173,13 +186,13 @@ This is an MCP server that provides access to climate and weather data through a
173
186
  ```
174
187
  3. Run the server:
175
188
  ```bash
176
- python app.py
189
+ python server.py
177
190
  ```
178
191
 
179
192
  ### Running Options
180
193
 
181
- - Default stdio mode: `python app.py`
182
- - SSE mode (port 8000): `python app.py --sse`
194
+ - Default stdio mode: `python server.py`
195
+ - SSE mode (port 8000): `python server.py --sse`
183
196
 
184
197
  ## Cline Integration
185
198
 
@@ -89,37 +89,34 @@ This is an MCP server that provides access to climate and weather data through a
89
89
  - updateTime: Last update time
90
90
 
91
91
  ### Visibility Data
92
- `get_visibility_data(lang: str = "en", rformat: str = "json") -> Dict`
92
+ `get_visibility_data(lang: str = "en") -> Dict`
93
93
  - Get latest 10-minute mean visibility data for Hong Kong
94
94
  - Parameters:
95
95
  - lang: Language code (en/tc/sc, default: en)
96
- - rformat: Return format (json/csv, default: json)
97
96
  - Returns:
98
97
  - Dict containing visibility data with fields and data arrays
99
98
 
100
99
  ### Lightning Data
101
- `get_lightning_data(lang: str = "en", rformat: str = "json") -> Dict`
100
+ `get_lightning_data(lang: str = "en") -> Dict`
102
101
  - Get cloud-to-ground and cloud-to-cloud lightning count data
103
102
  - Parameters:
104
103
  - lang: Language code (en/tc/sc, default: en)
105
- - rformat: Return format (json/csv, default: json)
106
104
  - Returns:
107
105
  - Dict containing lightning data with fields and data arrays
108
106
 
109
107
  ### Moon Times
110
- `get_moon_times(year: int, month: Optional[int] = None, day: Optional[int] = None, lang: str = "en", rformat: str = "json") -> Dict`
108
+ `get_moon_times(year: int, month: Optional[int] = None, day: Optional[int] = None, lang: str = "en") -> Dict`
111
109
  - Get times of moonrise, moon transit and moonset
112
110
  - Parameters:
113
111
  - year: Year (2018-2024)
114
112
  - month: Optional month (1-12)
115
113
  - day: Optional day (1-31)
116
114
  - lang: Language code (en/tc/sc, default: en)
117
- - rformat: Return format (json/csv, default: json)
118
115
  - Returns:
119
116
  - Dict containing moon times data with fields and data arrays
120
117
 
121
118
  ### Hourly Tides
122
- `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`
119
+ `get_hourly_tides(station: str, year: int, month: Optional[int] = None, day: Optional[int] = None, hour: Optional[int] = None, lang: str = "en") -> Dict`
123
120
  - Get hourly heights of astronomical tides for a specific station
124
121
  - Parameters:
125
122
  - station: Station code (e.g. 'CCH' for Cheung Chau)
@@ -128,12 +125,11 @@ This is an MCP server that provides access to climate and weather data through a
128
125
  - day: Optional day (1-31)
129
126
  - hour: Optional hour (1-24)
130
127
  - lang: Language code (en/tc/sc, default: en)
131
- - rformat: Return format (json/csv, default: json)
132
128
  - Returns:
133
129
  - Dict containing tide data with fields and data arrays
134
130
 
135
131
  ### High/Low Tides
136
- `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`
132
+ `get_high_low_tides(station: str, year: int, month: Optional[int] = None, day: Optional[int] = None, hour: Optional[int] = None, lang: str = "en") -> Dict`
137
133
  - Get times and heights of astronomical high and low tides
138
134
  - Parameters:
139
135
  - station: Station code (e.g. 'CCH' for Cheung Chau)
@@ -142,10 +138,27 @@ This is an MCP server that provides access to climate and weather data through a
142
138
  - day: Optional day (1-31)
143
139
  - hour: Optional hour (1-24)
144
140
  - lang: Language code (en/tc/sc, default: en)
145
- - rformat: Return format (json/csv, default: json)
146
141
  - Returns:
147
142
  - Dict containing tide data with fields and data arrays
148
143
 
144
+ ### Weather and Radiation Report
145
+ `get_weather_radiation_report(date: str, station: str, lang: str = "en") -> Dict`
146
+ - Get weather and radiation level report for Hong Kong
147
+ - Parameters:
148
+ - date: Mandatory date in YYYYMMDD format (e.g., 20250618)
149
+ - station: Mandatory station code (e.g., 'HKO' for Hong Kong Observatory)
150
+ - lang: Language code (en/tc/sc, default: en)
151
+ - Returns:
152
+ - Dict containing weather and radiation data or error message if parameters are invalid
153
+
154
+ ### Station Codes
155
+ `get_radiation_station_codes() -> Dict`
156
+ - Get a list of station codes and their corresponding names for weather and radiation reports in Hong Kong
157
+ - Parameters:
158
+ - None
159
+ - Returns:
160
+ - Dict mapping station codes to station names
161
+
149
162
  ## Setup
150
163
 
151
164
  1. Clone this repository
@@ -155,13 +168,13 @@ This is an MCP server that provides access to climate and weather data through a
155
168
  ```
156
169
  3. Run the server:
157
170
  ```bash
158
- python app.py
171
+ python server.py
159
172
  ```
160
173
 
161
174
  ### Running Options
162
175
 
163
- - Default stdio mode: `python app.py`
164
- - SSE mode (port 8000): `python app.py --sse`
176
+ - Default stdio mode: `python server.py`
177
+ - SSE mode (port 8000): `python server.py --sse`
165
178
 
166
179
  ## Cline Integration
167
180
 
@@ -0,0 +1,6 @@
1
+ """Hong Kong climate MCP Server package."""
2
+ from .server import main
3
+
4
+
5
+ __version__ = "0.1.0"
6
+ __all__ = ['main']
@@ -0,0 +1,4 @@
1
+ from hkopenai.hk_climate_mcp_server.server import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
@@ -1,8 +1,16 @@
1
1
  import argparse
2
2
  from fastmcp import FastMCP
3
- from hkopenai.hk_climate_mcp_server import tool_weather
4
3
  from typing import Dict, Annotated, Optional
5
4
  from pydantic import Field
5
+ from hkopenai.hk_climate_mcp_server.tools import astronomical
6
+ from hkopenai.hk_climate_mcp_server.tools import current_weather
7
+ from hkopenai.hk_climate_mcp_server.tools import forecast
8
+ from hkopenai.hk_climate_mcp_server.tools import lightning
9
+ from hkopenai.hk_climate_mcp_server.tools import radiation
10
+ from hkopenai.hk_climate_mcp_server.tools import temperature
11
+ from hkopenai.hk_climate_mcp_server.tools import tides
12
+ from hkopenai.hk_climate_mcp_server.tools import visibility
13
+ from hkopenai.hk_climate_mcp_server.tools import warnings
6
14
 
7
15
  def create_mcp_server():
8
16
  """Create and configure the HKO MCP server"""
@@ -12,49 +20,49 @@ def create_mcp_server():
12
20
  description="Get current weather observations, warnings, temperature, humidity and rainfall in Hong Kong from Hong Kong Observatory, with optional region or place in Hong Kong",
13
21
  )
14
22
  def get_current_weather(region: str = "Hong Kong Observatory") -> Dict:
15
- return tool_weather.get_current_weather(region)
23
+ return current_weather.get_current_weather(region)
16
24
 
17
25
  @mcp.tool(
18
26
  description="Get the 9-day weather forecast for Hong Kong including general situation, daily forecasts, sea and soil temperatures",
19
27
  )
20
28
  def get_9_day_weather_forecast(lang: str = "en") -> Dict:
21
- return tool_weather.get_9_day_weather_forecast(lang)
29
+ return forecast.get_9_day_weather_forecast(lang)
22
30
 
23
31
  @mcp.tool(
24
32
  description="Get local weather forecast for Hong Kong including forecast description, outlook and update time",
25
33
  )
26
34
  def get_local_weather_forecast(lang: str = "en") -> Dict:
27
- return tool_weather.get_local_weather_forecast(lang)
35
+ return forecast.get_local_weather_forecast(lang)
28
36
 
29
37
  @mcp.tool(
30
38
  description="Get weather warning summary for Hong Kong including warning messages and update time",
31
39
  )
32
40
  def get_weather_warning_summary(lang: str = "en") -> Dict:
33
- return tool_weather.get_weather_warning_summary(lang)
41
+ return warnings.get_weather_warning_summary(lang)
34
42
 
35
43
  @mcp.tool(
36
44
  description="Get detailed weather warning information for Hong Kong including warning statement and update time",
37
45
  )
38
46
  def get_weather_warning_info(lang: str = "en") -> Dict:
39
- return tool_weather.get_weather_warning_info(lang)
47
+ return warnings.get_weather_warning_info(lang)
40
48
 
41
49
  @mcp.tool(
42
50
  description="Get special weather tips for Hong Kong including tips list and update time",
43
51
  )
44
52
  def get_special_weather_tips(lang: str = "en") -> Dict:
45
- return tool_weather.get_special_weather_tips(lang)
53
+ return warnings.get_special_weather_tips(lang)
46
54
 
47
55
  @mcp.tool(
48
56
  description="Get latest 10-minute mean visibility data for Hong Kong",
49
57
  )
50
- def get_visibility_data(lang: str = "en", rformat: str = "json") -> Dict:
51
- return tool_weather.get_visibility_data(lang, rformat)
58
+ def get_visibility_data(lang: str = "en") -> Dict:
59
+ return visibility.get_visibility_data(lang)
52
60
 
53
61
  @mcp.tool(
54
62
  description="Get cloud-to-ground and cloud-to-cloud lightning count data",
55
63
  )
56
- def get_lightning_data(lang: str = "en", rformat: str = "json") -> Dict:
57
- return tool_weather.get_lightning_data(lang, rformat)
64
+ def get_lightning_data(lang: str = "en") -> Dict:
65
+ return lightning.get_lightning_data(lang)
58
66
 
59
67
  @mcp.tool(
60
68
  description="Get times of moonrise, moon transit and moonset",
@@ -63,15 +71,13 @@ def create_mcp_server():
63
71
  year: int,
64
72
  month: Optional[int] = None,
65
73
  day: Optional[int] = None,
66
- lang: str = "en",
67
- rformat: str = "json"
74
+ lang: str = "en"
68
75
  ) -> Dict:
69
- return tool_weather.get_moon_times(
76
+ return astronomical.get_moon_times(
70
77
  year=year,
71
78
  month=month,
72
79
  day=day,
73
- lang=lang,
74
- rformat=rformat
80
+ lang=lang
75
81
  )
76
82
 
77
83
  @mcp.tool(
@@ -83,17 +89,15 @@ def create_mcp_server():
83
89
  month: Optional[int] = None,
84
90
  day: Optional[int] = None,
85
91
  hour: Optional[int] = None,
86
- lang: str = "en",
87
- rformat: str = "json"
92
+ lang: str = "en"
88
93
  ) -> Dict:
89
- return tool_weather.get_hourly_tides(
94
+ return tides.get_hourly_tides(
90
95
  station=station,
91
96
  year=year,
92
97
  month=month,
93
98
  day=day,
94
99
  hour=hour,
95
- lang=lang,
96
- rformat=rformat
100
+ lang=lang
97
101
  )
98
102
 
99
103
  @mcp.tool(
@@ -105,19 +109,23 @@ def create_mcp_server():
105
109
  month: Optional[int] = None,
106
110
  day: Optional[int] = None,
107
111
  hour: Optional[int] = None,
108
- lang: str = "en",
109
- rformat: str = "json"
112
+ lang: str = "en"
110
113
  ) -> Dict:
111
- return tool_weather.get_high_low_tides(
114
+ return tides.get_high_low_tides(
112
115
  station=station,
113
116
  year=year,
114
117
  month=month,
115
118
  day=day,
116
119
  hour=hour,
117
- lang=lang,
118
- rformat=rformat
120
+ lang=lang
119
121
  )
120
122
 
123
+ @mcp.tool(
124
+ description="Get a list of tide station codes and their corresponding names for tide reports in Hong Kong.",
125
+ )
126
+ def get_tide_station_codes(lang: str = "en") -> Dict:
127
+ return tides.get_tide_station_codes(lang)
128
+
121
129
  @mcp.tool(
122
130
  description="Get times of sunrise, sun transit and sunset for Hong Kong",
123
131
  )
@@ -125,15 +133,13 @@ def create_mcp_server():
125
133
  year: int,
126
134
  month: Optional[int] = None,
127
135
  day: Optional[int] = None,
128
- lang: str = "en",
129
- rformat: str = "json"
136
+ lang: str = "en"
130
137
  ) -> Dict:
131
- return tool_weather.get_sunrise_sunset_times(
138
+ return astronomical.get_sunrise_sunset_times(
132
139
  year=year,
133
140
  month=month,
134
141
  day=day,
135
- lang=lang,
136
- rformat=rformat
142
+ lang=lang
137
143
  )
138
144
 
139
145
  @mcp.tool(
@@ -143,15 +149,13 @@ def create_mcp_server():
143
149
  year: int,
144
150
  month: Optional[int] = None,
145
151
  day: Optional[int] = None,
146
- lang: str = "en",
147
- rformat: str = "json"
152
+ lang: str = "en"
148
153
  ) -> Dict:
149
- return tool_weather.get_gregorian_lunar_calendar(
154
+ return astronomical.get_gregorian_lunar_calendar(
150
155
  year=year,
151
156
  month=month,
152
157
  day=day,
153
- lang=lang,
154
- rformat=rformat
158
+ lang=lang
155
159
  )
156
160
 
157
161
  @mcp.tool(
@@ -161,15 +165,13 @@ def create_mcp_server():
161
165
  station: str,
162
166
  year: Optional[int] = None,
163
167
  month: Optional[int] = None,
164
- lang: str = "en",
165
- rformat: str = "json"
168
+ lang: str = "en"
166
169
  ) -> Dict:
167
- return tool_weather.get_daily_mean_temperature(
170
+ return temperature.get_daily_mean_temperature(
168
171
  station=station,
169
172
  year=year,
170
173
  month=month,
171
- lang=lang,
172
- rformat=rformat
174
+ lang=lang
173
175
  )
174
176
 
175
177
  @mcp.tool(
@@ -179,15 +181,13 @@ def create_mcp_server():
179
181
  station: str,
180
182
  year: Optional[int] = None,
181
183
  month: Optional[int] = None,
182
- lang: str = "en",
183
- rformat: str = "json"
184
+ lang: str = "en"
184
185
  ) -> Dict:
185
- return tool_weather.get_daily_max_temperature(
186
+ return temperature.get_daily_max_temperature(
186
187
  station=station,
187
188
  year=year,
188
189
  month=month,
189
- lang=lang,
190
- rformat=rformat
190
+ lang=lang
191
191
  )
192
192
 
193
193
  @mcp.tool(
@@ -197,32 +197,34 @@ def create_mcp_server():
197
197
  station: str,
198
198
  year: Optional[int] = None,
199
199
  month: Optional[int] = None,
200
- lang: str = "en",
201
- rformat: str = "json"
200
+ lang: str = "en"
202
201
  ) -> Dict:
203
- return tool_weather.get_daily_min_temperature(
202
+ return temperature.get_daily_min_temperature(
204
203
  station=station,
205
204
  year=year,
206
205
  month=month,
207
- lang=lang,
208
- rformat=rformat
206
+ lang=lang
209
207
  )
210
208
 
211
209
  @mcp.tool(
212
- description="Get weather and radiation level report for Hong Kong",
210
+ description="Get weather and radiation level report for Hong Kong. Date must be in YYYYMMDD format and should be yesterday or before. Station must be a valid code like 'HKO' for Hong Kong Observatory.",
213
211
  )
214
212
  def get_weather_radiation_report(
215
- date: Optional[str] = None,
216
- station: Optional[str] = None,
217
- lang: str = "en",
218
- rformat: str = "json"
213
+ date: Annotated[str, Field(description="Date in yyyyMMdd format, eg, 20250618")],
214
+ station: Annotated[str, Field(description="Station code in 3 characters in capital letters, eg, HKO")],
215
+ lang: Annotated[Optional[str], Field(description="Language (en/tc/sc)", json_schema_extra={"enum": ["en", "tc", "sc"]})] = 'en',
219
216
  ) -> Dict:
220
- return tool_weather.get_weather_radiation_report(
217
+ return radiation.get_weather_radiation_report(
221
218
  date=date,
222
219
  station=station,
223
- lang=lang,
224
- rformat=rformat
220
+ lang=lang or 'en'
225
221
  )
222
+
223
+ @mcp.tool(
224
+ description="Get a list of weather station codes and their corresponding names for radiation reports in Hong Kong.",
225
+ )
226
+ def get_radiation_station_codes(lang: str = "en") -> Dict:
227
+ return radiation.get_radiation_station_codes(lang)
226
228
 
227
229
  return mcp
228
230
 
@@ -0,0 +1,109 @@
1
+ import requests
2
+ from typing import Dict, Any, Optional
3
+
4
+ def get_moon_times(year: int, month: Optional[int] = None,
5
+ day: Optional[int] = None, lang: str = "en") -> Dict[str, Any]:
6
+ """
7
+ Get times of moonrise, moon transit and moonset.
8
+
9
+ Args:
10
+ year: Year (2018-2024)
11
+ month: Optional month (1-12)
12
+ day: Optional day (1-31)
13
+ lang: Language code (en/tc/sc, default: en)
14
+
15
+ Returns:
16
+ Dict containing moon times data with fields and data arrays
17
+ """
18
+ params = {
19
+ 'dataType': 'MRS',
20
+ 'lang': lang,
21
+ 'rformat': 'json',
22
+ 'year': year
23
+ }
24
+ if month: params['month'] = str(month)
25
+ if day: params['day'] = str(day)
26
+
27
+ response = requests.get(
28
+ 'https://data.weather.gov.hk/weatherAPI/opendata/opendata.php',
29
+ params=params
30
+ )
31
+ try:
32
+ response.raise_for_status()
33
+ return response.json()
34
+ except (requests.RequestException, ValueError) as e:
35
+ return {"error": f"Failed to fetch data: {str(e)}."}
36
+
37
+ def get_sunrise_sunset_times(
38
+ year: int,
39
+ month: Optional[int] = None,
40
+ day: Optional[int] = None,
41
+ lang: str = "en"
42
+ ) -> Dict[str, Any]:
43
+ """
44
+ Get times of sunrise, sun transit and sunset.
45
+
46
+ Args:
47
+ year: Year (2018-2024)
48
+ month: Optional month (1-12)
49
+ day: Optional day (1-31)
50
+ lang: Language code (en/tc/sc, default: en)
51
+
52
+ Returns:
53
+ Dict containing sun times data with fields and data arrays
54
+ """
55
+ params = {
56
+ 'dataType': 'SRS',
57
+ 'lang': lang,
58
+ 'rformat': 'json',
59
+ 'year': year
60
+ }
61
+ if month: params['month'] = str(month)
62
+ if day: params['day'] = str(day)
63
+
64
+ response = requests.get(
65
+ 'https://data.weather.gov.hk/weatherAPI/opendata/opendata.php',
66
+ params=params
67
+ )
68
+ try:
69
+ response.raise_for_status()
70
+ return response.json()
71
+ except (requests.RequestException, ValueError) as e:
72
+ return {"error": f"Failed to fetch data: {str(e)}."}
73
+
74
+ def get_gregorian_lunar_calendar(
75
+ year: int,
76
+ month: Optional[int] = None,
77
+ day: Optional[int] = None,
78
+ lang: str = "en"
79
+ ) -> Dict[str, Any]:
80
+ """
81
+ Get Gregorian-Lunar calendar conversion data.
82
+
83
+ Args:
84
+ year: Year (1901-2100)
85
+ month: Optional month (1-12)
86
+ day: Optional day (1-31)
87
+ lang: Language code (en/tc/sc, default: en)
88
+
89
+ Returns:
90
+ Dict containing calendar conversion data
91
+ """
92
+ params = {
93
+ 'dataType': 'GLC',
94
+ 'lang': lang,
95
+ 'rformat': 'json',
96
+ 'year': year
97
+ }
98
+ if month: params['month'] = str(month)
99
+ if day: params['day'] = str(day)
100
+
101
+ response = requests.get(
102
+ 'https://data.weather.gov.hk/weatherAPI/opendata/opendata.php',
103
+ params=params
104
+ )
105
+ try:
106
+ response.raise_for_status()
107
+ return response.json()
108
+ except (requests.RequestException, ValueError) as e:
109
+ return {"error": f"Failed to fetch data: {str(e)}."}