hk-spatial-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| ARCGIS_URL | No | Portal base URL, for ArcGIS Enterprise deployments | https://www.arcgis.com |
| HK_MCP_DIR | No | Workspace for the catalogue cache, downloaded GeoJSON and the generated map | ./hk-spatial |
| HK_MCP_BIND | No | Bind address for the map preview server; set 0.0.0.0 only behind a reverse proxy | 127.0.0.1 |
| HK_MCP_HOST | No | Bind address for the HTTP transport | 127.0.0.1 |
| HK_MCP_PORT | No | Port for the map preview server | 8777 |
| ARCGIS_TOKEN | No | ArcGIS Online user/OAuth token; required only for the content and publishing tools | |
| HK_MCP_HTTP_PORT | No | Port for the HTTP transport (endpoint /mcp) | 8788 |
| HK_MCP_TRANSPORT | No | Transport mode: stdio, streamable-http or sse | stdio |
| HK_MCP_PUBLIC_URL | No | Public base URL that build_map returns, e.g. https://maps.example.hk/ |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| search_hk_dataA | Search ALL ~1150 CSDI datasets locally (English or Chinese), ranked. No keyword = browse. Chinese and English both work — Chinese terms are expanded with Hong Kong usage (廁所 -> 洗手間, 行人路 -> pedestrian, 電動車 -> electric vehicle charging, …). Returns dataset_id + bilingual title + why it matched. Feed dataset_id to load_hk_data(). |
| load_hk_dataA | Download one CSDI dataset as GeoJSON (WGS84) into the workspace. Returns a SUMMARY, not the data itself — never paste the features into the chat, put them on a map with build_map(). The local copy is reused on later calls; pass refresh=True to re-download. |
| query_hk_dataA | Read a FEW individual features, so a single value can be verified without opening the GeoJSON.
|
| summarise_hk_dataA | Answer a question about a dataset in TEXT (and a bar chart), without putting features in the chat.
|
| build_mapB | Build an interactive 2D web map (ArcGIS Maps SDK, keyless basemap) from loaded datasets and serve it on localhost. Open the returned URL in your client's browser or preview pane. |
| build_sceneA | Same datasets, rendered in a 3D scene: terrain relief, tilted camera, layers draped on the ground. Keyless (public imagery + Terrain3D elevation). Use it when relief, height or a walk-through view matters — towers, slopes, trails, coastal context. |
| geocode_addressA | Geocode an address/place to coordinates, or reverse-geocode a coordinate to an address.
Esri public world geocoder — no key required. Reverse mode: pass |
| geometry_opA | Project, buffer or simplify one GeoJSON geometry with Esri's public Geometry service — no key. operation: "project" (in_sr -> out_sr, e.g. 2326 -> 4326), "buffer" (distance in |
| elevation_atB | Ground elevation in metres at a coordinate, from Esri's public Terrain3D service — no key. Handy for hiking/relief context (e.g. trail comfort, slope warnings) alongside CSDI layers. |
| export_static_mapA | Render a basemap-only PNG (no key) into the workspace — for reports, decks and docs.
Give either |
| export_static_svgB | Write a printable static map WITH the data drawn, as one self-contained SVG page. Basemap tiles are referenced by URL (they load in any browser with internet), features are drawn as real vector shapes on top — so the result prints cleanly to PDF from the browser's print dialog. No key, no headless browser, no image library. |
| arcgis_requestB | Call any ArcGIS Online REST endpoint with the configured token. Examples: path="search", params={"q": 'title:"my layer"', "num": 5} → find items path="content/items//data", params={} → item JSON path="content/items/", params={} → item metadata path="/0/query", params={"where":"1=1","outFields":"*","f":"json","returnCountOnly":"true"} → count analysis: run a GP task under //submitJob (then /jobs/) |
| publish_layerA | Publish a loaded CSDI dataset to ArcGIS Online as a hosted feature layer. Needs ARCGIS_TOKEN. Returns itemId + the new service URL. |
| dataset_statusA | Are these datasets still being served, and how stale are they? No dataset_id -> lists the Treat catalogue date and data freshness as SEPARATE things: the date below is CSDI's dct:modified (when the record was revised), not the statistical reference period of the data. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 14 tools
The core pipeline is clearly staged: search_hk_data -> load_hk_data -> query_hk_data / summarise_hk_data -> build_map / build_scene, with each step's role spelled out (verify a value vs. aggregate vs. visualize). The only real soft spots are the three output tools (build_map, export_static_map, export_static_svg), differentiated mainly by paragraph-level caveats rather than by name, and arcgis_request, which is a generic escape hatch that can duplicate geocode/publish/query functions.
Most tools are verb_noun (search_hk_data, load_hk_data, build_map, export_static_map, publish_layer), with a nice *_hk_data family for the data lifecycle. But four tools break the verb-first pattern entirely (geometry_op, elevation_at, arcgis_request, dataset_status), and the hk_ prefix is applied inconsistently to the geo tools, so the convention is readable but not predictable.
Fourteen tools is a reasonable, well-scoped size for a geospatial data server covering discovery, retrieval, analysis, visualization and publishing. There is mild redundancy in having three separate map-output tools (interactive, PNG, SVG), one of which is basemap-only and arguably an edge case.
The surface covers the full discovery-to-output lifecycle plus analysis helpers (geocode, buffer/project/simplify, elevation), raw REST access and a data-freshness check — no dead ends for the stated purpose. Minor gaps: no tool to list or clean up datasets already loaded in the workspace, and no way to export a filtered subset back out as data (CSV/GeoJSON) rather than an image or map.