HKO_MCP/README.md
2025-05-25 17:15:04 +08:00

2.2 KiB

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:

Prerequisites

  • Python 3.10 or higher

Installation

  1. Install Python

  2. Clone this repository:

git clone https://github.com/pongiotdevelop/hko_mcp.git

Usage

  1. Add the below to your MCP configuration:
{
    "mcpServers": {
        "HKO_MCP": {
            "command": "python",
            "args": [
                "<directory of the project>"
            ]
        }    
    }
}
  1. 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 requests
  • fastmcp: 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