When building agents that need access to specific external data, using APIs or web scraping directly is often inefficient. For the need to access the Hong Kong Government official open data portal DATA.GOV.HK, this article introduces the DeepSeek Harness (DSH) plugin xby-open-data-hk.
Plugin Overview¶
The plugin is an MCP server maintained by xby-skill, designed to simplify queries of datasets, categories, and format information on DATA.GOV.HK. It encapsulates core features such as dataset lists, detail queries, category lookups, and format filtering, with multi-language support (Simplified Chinese, Traditional Chinese, and English).
Installation and Enablement¶
Installing this plugin requires administrator privileges. It is recommended to review the source code and license (MIT) before installation.
dsh plugin --profile web add github:xby_skill/xby-open-data-hk
Core Features¶
1. Authentication and Key Management¶
- set_xby_apikey: Sets the API key in the chat context. Once set, the key is automatically persisted and remains valid after the process is restarted.
2. Dataset Queries¶
- list_datasets: Retrieves a list of dataset IDs.
- Supported parameters:
limit(default 1000),offset,language(en, tc, sc).
- Supported parameters:
- get_dataset_details: Retrieves detailed information for a specific dataset.
- Supported parameters:
dataset_id,language,include_tracking.
- Supported parameters:
- search_datasets: Searches datasets by query terms.
- Based on the package search API, it searches metadata such as titles and descriptions.
- Limitation: The default limit is 10, and the maximum is 1000.
- Supported parameters:
query(Solr query string),limit,offset,language.
- get_datasets_by_format: Retrieves datasets for a specific file format.
- Supported parameters:
file_format(e.g., CSV, JSON, GeoJSON),limit,language.
- Supported parameters:
3. Category and Facet Search¶
- list_categories: Retrieves a list of data categories (groups).
- Supported parameters:
sort(e.g., ‘name asc’, ‘package_count desc’),limit,offset,language.
- Supported parameters:
- get_category_details: Retrieves detailed information for a specific category.
- Supported parameters:
category_id,include_datasets,include_dataset_count, and others.
- Supported parameters:
- search_datasets_with_facets: Searches datasets and returns facet results for easier exploration.
- Supported parameters:
query,language.
- Supported parameters:
4. Utility Features¶
- get_supported_formats: Retrieves the list of file formats supported by DATA.GOV.HK.
Configuration and Usage¶
Obtaining an API Key¶
Before using the plugin, you must register on the Xiao Ben Yang official website to obtain an API key. Once the key is set, subsequent data query requests will use this credential.
Typical Usage Examples¶
Set Key
Enter the setup command in the chat to enable API access.
List Datasets
Retrieve the first 10 dataset IDs with the language set to English.
{
"limit": 10,
"offset": 0,
"language": "en"
}
Search Datasets
Search for datasets containing the keyword “transport”.
{
"query": "transport",
"language": "sc"
}
Get Datasets by Specific Format
Find all datasets in CSV format.
{
"file_format": "CSV",
"language": "tc"
}
Use Cases and Notes¶
- Use Cases: Suitable for agent development that requires analyzing Hong Kong public data (such as transportation, weather, and statistics), or automation scripts that need to dynamically retrieve structured data from DATA.GOV.HK.
- Runtime Permissions: The plugin runs with the permissions of the current DSH process.
- Notes:
list_datasetsreturns 1000 records by default, andsearch_datasetsreturns 10 by default.- Supported language codes include
en(English),tc(Traditional Chinese), andsc(Simplified Chinese). - Before use, be sure to read the GitHub source code to ensure compliance with the project’s usage guidelines.
Summary¶
xby-open-data-hk provides a standardized set of interfaces for accessing Hong Kong Government open data. For developers, this eliminates the need to manually parse web pages or handle complex API request details, allowing them to focus more on implementing business logic.