Till innehållet
kart-api.se

MCP server

Building an agent? You don't need a client library. The MCP server is hosted by us and speaks streamable HTTP.

claude mcp add --transport http kart-api https://api.kart-api.se/mcp

In a client configured with JSON (Cursor, Windsurf, VS Code):

{
  "mcpServers": {
    "kart-api": { "type": "http", "url": "https://api.kart-api.se/mcp" }
  }
}

No key needed to get started — same quota as the rest of the API, 200 calls a day. For more, send the key as a header: "headers": { "X-API-Key": "ka_…" }.

The tools

ToolWhat it does
geocodeSwedish place or address → coordinate, with ambiguity spelled out.
reverse_geocodeCoordinate → nearest place name and municipality.
ortnamnSearch Lantmäteriet's 990 698 place names.
kommun_lookupWhich municipality and county is this point in?
hojdElevation in metres above sea level.
rendera_kartaBuilds a URL to a finished map image with a marker.

Two things that make it useful to an agent

The tool descriptions carry the licence requirement in plain text. An agent that fetches data through us therefore learns that attribution must be shown, and passes it on to its user. A tool that stays silent about the terms turns the user into a licence breaker without anyone noticing.

The answers are honest about uncertainty. geocode reports how many municipalities a name occurs in, so an agent can ask back instead of taking the first hit and drawing a map of the wrong town. That is precisely the failure that is otherwise invisible: the answer looks right, the map gets drawn, and nobody notices until the reader does.

Test the handshake

curl -s -X POST https://api.kart-api.se/mcp -H 'content-type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | head -c 400