.gitignore | ||
hko_mcp.py | ||
README.md | ||
test.py |
Hong Kong Observatory MCP Server
A Model Context Protocol (MCP) server that provides weather information of Hong Kong Observatory.
Features
- Weather information (forecasts, warnings, current conditions)
- Earthquake information
- Gregorian to Lunar calendar conversion
- Rainfall data from monitoring stations
Data Source
This project utilizes the official HKO Open Data API:
- Weather Information base URL: https://data.weather.gov.hk/weatherAPI/opendata/weather.php
- Earthquake Information base URL: https://data.weather.gov.hk/weatherAPI/opendata/earthquake.php
- Gregorian-Lunar Calendar Conversion base URL: https://data.weather.gov.hk/weatherAPI/opendata/lunardate.php
- Rainfall in the Past Hour from Automatic Weather Station base URL: https://data.weather.gov.hk/weatherAPI/opendata/hourlyRainfall.php
- HKO Open Data API Documentation
Prerequisites
- Python 3.10 or higher
Installation
-
Install Python
-
Clone this repository:
git clone https://github.com/pongiotdevelop/hko_mcp.git
Usage
- Add the below to your MCP configuration:
{
"mcpServers": {
"HKO_MCP": {
"command": "python",
"args": [
"<directory of the project>"
]
}
}
}
- The server provides several tools that can be used by Language Models to query HKO information:
get_weather_info(dataType: str, lang: str = "en")
: Get weather information from the Hong Kong Observatory.get_earthquake_info(dataType: str, lang: str = "en")
: Get earthquake information from the Hong Kong Observatory.Gregorian_Lunar_Calendar_Conversion(date: str)
: Convert Gregorian date to Lunar date.rainfall_past_hour_from_station(lang: str = "en")
: Get rainfall past hour from the Hong Kong Observatory.
Testing
Run the test.py for testing the API functions of MCP server:
python test.py
Dependencies
requests
: For HTTP requestsfastmcp
: For MCP server implementation
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Acknowledgments
- Hong Kong Observatory for providing the open data API
- The MCP protocol developers