Skip to main content
Glama

Castlemap MCP server

A Model Context Protocol server for the Castlemap atlas: castles, fortresses, palaces and ruins worldwide (the counts move with every release; get_statistics reports the current ones), with coordinates, founding dates, categories, fame ranking and Wikipedia summaries.

It is already running. Point a client at the hosted endpoint — there is no install, no signup and no API key:

https://thecastlemap.com/mcp

Streamable HTTP, stateless, POST-only (a GET returning 405 is correct). Protocol revisions 2025-06-18 and 2025-03-26 are accepted.

Client configuration

{
  "mcpServers": {
    "castles": {
      "type": "http",
      "url": "https://thecastlemap.com/mcp"
    }
  }
}

Registry entry: com.thecastlemap/castles.

Related MCP server: TrainRouter Atlas

Tools

Tool

What it does

search_castles

Find castles by name, country or category

get_castle

Full record for one castle

castles_near

Nearest castles to a coordinate (haversine); geocode first

top_castles

Best-known castles, by fame rank

list_countries

Every country on the map, with counts

get_statistics

Live aggregates — totals, per-country, per-century

random_castle

One castle at random

Data

Derived from Wikidata, with summaries from Wikipedia and images from Wikimedia Commons. The atlas is curated rather than exhaustive: it covers castles with a documented history, a real photo and exact coordinates, not every earthwork and ruin.

The factual records are released as CC0 and downloadable as GeoJSON and CSV from thecastlemap.com/data — also mirrored on GitHub, Hugging Face, Kaggle and Zenodo (concept DOI 10.5281/zenodo.21322359, which always resolves to the newest version).

Running it yourself

server.mjs has zero dependencies — no SDK, no node_modules. It needs Node 18+ and a castles.geojson to read (download one from /data):

CASTLES_GEOJSON=/path/to/castles.geojson PORT=8891 node server.mjs

It binds 127.0.0.1:8891 by default; HOST, PORT and CASTLES_GEOJSON override that. The file is re-read when its mtime changes (throttled to 60s), so updating the data needs no restart.

castlemap-mcp.service is the systemd unit used in production — loopback-bound, DynamicUser, ProtectSystem=strict, with nginx terminating TLS in front. Set ExecStart to your own node path and ReadOnlyPaths/CASTLES_GEOJSON to wherever the data lives.

Provenance

Built by flightmussy with AI assistance: the concept, direction and review are mine; much of the implementation was written with Claude. The underlying data is not generated — it comes from Wikidata, and every record is traceable to its Wikidata item.

License

Code: MIT (see LICENSE). Data: CC0. Wikipedia summary text remains CC BY-SA and is attributed per record.

Available Tools

7 tools
castles_nearFind castles near a pointAInspect

List landmarks within a radius of a WGS84 coordinate, nearest first, each with distance_km. Radius defaults to 100 km (max 2,000). For "castles near ", geocode the place yourself, then call this with its latitude/longitude.

Inputs: latitude (required), longitude (required), limit, category, +1 more.

get_castleGet one castle in fullAInspect

Fetch one landmark’s full record by slug (preferred, e.g. "palace-of-versailles") or exact name: coordinates, founding year and century, worldwide fame rank, photo URL, Wikipedia link and its readership signals (Wikidata sitelinks, annual Wikipedia pageviews). Unsure of the slug? Call search_castles first.

Inputs: castle (required).

get_statisticsAtlas statisticsAInspect

Headline statistics computed live from the atlas: totals by type, top countries, busiest founding century, oldest landmarks, geographic extremes and the most famous entry. The source for claims like "which country has the most castles" or "when were castles built"; the full write-up lives at thecastlemap.com/statistics/.

Inputs: no named parameters.

list_countriesCountries with castle countsAInspect

Every country in the atlas with its landmark count, most first — answers "which country has the most castles" (France leads). Returns country name and ISO code per row; country pages are browsable from the countries_index URL.

Inputs: no named parameters.

random_castleA random castleAInspect

One random landmark with its full record, optionally limited to a country — for discovery, quizzes and "castle of the day" features.

Inputs: country.

search_castlesSearch castles by nameAInspect

Search the atlas’s 2,400 castles, fortresses, palaces and ruins by name (accent- and case-insensitive substring match). Optionally filter by country (name or ISO code) and category. Results come best-match-first, then by fame; each has coordinates, founding century, fame rank and links to its atlas page and Wikipedia. If nothing matches, retry with a shorter fragment of the name.

Inputs: query (required), limit, country, category.

top_castlesMost famous castlesAInspect

The most famous landmarks worldwide or in one country, ordered by Castlemap fame rank — a blend of Wikipedia language coverage and readership; rank 1 is the most famous (Palace of Versailles). The direct answer to "most famous castles in "; filter by country and/or category.

Inputs: limit, country, category.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: geographic search (castles_near), record retrieval (get_castle), aggregate statistics (get_statistics), country listing (list_countries), random sample (random_castle), name search (search_castles), and fame-ranked listing (top_castles). No overlap exists.

    Naming Consistency3/5

    Most tools follow a verb_noun pattern (e.g., get_castle, search_castles, list_countries), but 'castles_near' breaks the pattern with a noun_prep structure. Singular/plural usage is inconsistent (get_castle vs. search_castles), though readability is maintained.

    Tool Count5/5

    Seven tools is well-scoped for a read-only atlas of 2,400 landmarks. Each tool covers a distinct access pattern (search, random, near, stats, etc.) without redundancy or bloat.

    Completeness4/5

    The tool surface covers key operations: search, retrieval, statistics, and exploration. A minor gap is the lack of a generic 'list all' endpoint with pagination, but search may fill this role. The set is largely complete for its domain.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      Enables exploration of geographical data including countries, cities, states/provinces, and regions through a SQLite database. Supports searches by name, location coordinates, currency, and regional groupings with comprehensive statistical queries.
      15
      7
      -
    • A
      license
      A
      quality
      A
      maintenance
      The world railway atlas as read-only MCP tools: search 744+ legendary train routes (high-speed, classic, night, scenic) and get per-route facts, rankings and journey times. Runs from the repo's open dataset (CC BY 4.0); a free hosted endpoint is also live at https://trainrouter.com/mcp.
      7
      6
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Historical geography for AI agents: 1,000+ polities with real GeoJSON borders, dynastic succession chains, events, cities and trade routes from 4500 BCE to today, each with cited academic sources and a confidence score. Wraps the free AtlasPI REST API (https://atlaspi.it) as 39 MCP tools — no API key required, Apache-2.0.
      39
      1
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Serves country facts, administrative boundary GeoJSON, and per-region population, area, and capital statistics as structured data, letting an AI assistant build interactive maps, comparisons, and multilingual geography content instead of reciting prose. It also normalises region names across sources so boundary shapes can be joined to their statistics.
      3
      MIT