Skip to content
Cape Town Open Data

mcp · cape town · open data

Query Cape Town's open data, from your LLM.

A Model Context Protocol server that turns the City of Cape Town Open Data Portal's ArcGIS Feature Services into LLM-callable tools — with layer discovery, a generic query escape hatch, spatial & attribute filtering, and in-memory caching.

Works with Claude Desktop, Claude Code, and any MCP-compatible host.

capetown-opendata-mcp
$ capetown-opendata-mcp
mcp server ready · stdio · 18 tools · cache 5m

› water_quality limit=3
SITE               RESULT   SAMPLED
Zandvlei           ok       2026-06
Milnerton Lagoon   warn     2026-06
Camps Bay tidal    ok       2026-06
→ 3 features · next_cursor ↵

what you get

An MCP front door to the City's data service.

Wraps capetown-opendata and go-arcgis, so the Esri REST details stay out of your prompts.

Discovery

service_info and layer_info list and describe the roughly 150 published layers across thirteen services, plus five ArcGIS Online datasets (service requests as a table and as geocoded points, building plans, population estimates, taxi fares), with their fields, geometry, date ranges and the City's own description of each table.

Generic query

query_layer is an escape hatch over any layer by service and layer ID — WHERE, field selection, ordering, bbox, count-only, and cursor paging.

Spatial & attribute filters

Combine SQL where, a bbox, or a polygon. Spatial filters are sent as WGS84, so they work against any projection.

Right-sized responses

Results fit MCP tool-output limits: lean rows, simplified geometry, and a token budget you can raise. Opaque cursors keep paging stable, and a 5m cache spares the City's servers.

stdio + HTTP

Speaks the MCP stdio transport by default, or streamable-HTTP for remote and containerized deployments.

One-click MCP Bundle

Every release ships .mcpb bundles per platform — open one in Claude Desktop to install, with settings for server, response size, token, timeout & TTL.

eighteen tools

Datasets, discovery, a generic query, and aggregation.

load_shedding_blocks

Load shedding block polygons (block geometry and ID).

wards

Municipal ward boundaries (ward name, year).

land_parcels

Cadastral land parcels (erven); optional suburb filter.

official_suburbs

Official suburb boundary polygons; look one up by suburb, or plot them as centroids.

taxi_routes

Registered minibus taxi route lines.

water_quality

Inland water quality sampling results, newest first.

public_lighting

Public street lighting assets.

heritage_inventory

Heritage inventory sites and features.

service_requests

Citizen service requests since 2023, about 4.5 million rows on ArcGIS Online.

service_requests_spatial

Service requests with coordinates, as points; filter by bbox or polygon.

building_plan_approvals

Building plan applications since 2014, newest submission first.

population_estimates

Modelled population and household estimates per suburb; join to official_suburbs to map them.

taxi_fares

Minibus taxi fares surveyed between ranks, newest first; filter by origin_rank.

query_layer

Generic query over any layer by service and layer ID — where / fields / order / bbox / count-only.

field_values

List a field's distinct values to discover valid filter values.

service_info

List every layer and table across all services, each tagged with its service; name_contains filters the listing.

layer_info

Describe a layer's fields, geometry type, and page size.

summarize_layer

Server-side counts, sums and averages over any layer, grouped by any field.

Feature-returning tools share a filter set: limit (default 25, max 2000), where, fields, omit_nulls (default on) and use_aliases; spatial tools add bbox, polygon, include_geometry and geometry_detail (simplified, full or centroid). To page, pass next_cursor back as cursor. Layer IDs occasionally drift — use service_info / layer_info to find current IDs; daily live checks catch drift upstream.

install

Four ways to get it.

One-click for Claude Desktop. Download the .mcpb matching your OS and architecture from the releases page, then open it with Claude Desktop.

file capetown-opendata-mcp_<version>_darwin_arm64.mcpb

Browse releases → · The bundle's settings screen sets the City server, the response size budget, an optional ArcGIS token, request timeout, and cache TTL.

usage

Point your MCP host at the binary.

Add it to your Claude Desktop / Claude Code config:

// claude config · mcpServers
{
  "mcpServers": {
    "capetown-opendata": {
      "command": "capetown-opendata-mcp"
    }
  }
}

Or run the streamable-HTTP transport for remote deployments:

http capetown-opendata-mcp --transport http --http-addr :8080

Every flag also reads from a CAPETOWN_MCP_ environment variable:

FlagEnvDefaultDescription
--transportCAPETOWN_MCP_TRANSPORTstdiostdio or http.
--http-addrCAPETOWN_MCP_HTTP_ADDR:8080Listen address for the HTTP transport.
--timeoutCAPETOWN_MCP_TIMEOUT30sPer-request upstream timeout.
--cache-ttlCAPETOWN_MCP_CACHE_TTL5mResponse cache TTL (0 disables).
--arcgis-tokenCAPETOWN_MCP_ARCGIS_TOKEN—Optional token for authenticated services.
--serverCAPETOWN_MCP_SERVEResapqaCity server: esapqa, citymaps, or a services folder URL.
--max-response-tokensCAPETOWN_MCP_MAX_RESPONSE_TOKENS8000Approximate size budget for one tool response.