writing · mcp

a uk land registry mcp server for claude

eighteen tools over thirty years of england and wales property data — what it does, what broke, and what it refuses to answer.

2 min

written with the assistance of ai.

  • mcp
  • claude
  • open data
  • duckdb

the tool

what it is

an mcp server that hands claude hm land registry open data as eighteen tools: every residential sale in england and wales since 1995, the official house price index, which companies own registered title, and the boundary polygon of most registered parcels. you ask in english; the tools do the awkward part.

eighteen tools in six families — price paid, house price index, ownership, boundaries, diligence, utility.

the build

one api cannot be queried at all

sold prices and the house price index sit behind a sparql endpoint, so they can be queried live — no key, no download. the ownership and boundary data cannot. that service has no query endpoint at all: it serves monthly bulk files and a signed url that expires in about ten seconds. so those datasets come down once and are queried locally, in an embedded duckdb database under ~/.hmlr-mcp.

downloading is two calls rather than one. the first reports the file name and size and fetches nothing; only the second commits. a model told "several hundred megabytes" asks first. a model that finds out afterwards does not.

what broke

the same query, 250× apart

the sparql endpoint evaluates patterns roughly in the order written. put the postcode filter after the optional blocks and it walks thirty million rows before narrowing, then times out. put it first and the same question answers in a quarter of a second.

identical question, identical answer. the only difference is which line the filter is written on — so the query builder emits selective triples first, and the test suite asserts the order, because nothing else would catch it regressing.

what it will not do

the join that costs £20,000

you cannot connect a boundary to its owner using open data. polygons carry an inspire id; ownership is keyed on a title number; hm land registry deliberately does not publish the mapping between them. that link is the national polygon service, at £20,000 + vat a year. the two identifiers are not even the same shape, so nothing about them can be quietly guessed.

the server answers the postcode-proximity version of the question instead, and says plainly that it is a different question.

saying no

where a plausible answer is a wrong one

the hard part was never fetching data. it was the places where the server has to decline instead of guessing:

  • a search too broad to narrow is refused locally, before it is sent — thirty million rows do not fail fast, they hang until something times out.
  • an empty ownership result means "no company owns registered title here". it does not mean unowned, and it does not mean unregistered — individuals are not published in bulk at all.
  • sale categories are kept apart. the additional category sweeps in repossessions and commercial deals; one £11.3m outlier will happily wreck a street average.

try it

run it

the live tier needs no key and no download

npx uk-land-registry-mcp