Search docs

MCP server

Connect Claude Code, Cursor or any MCP client to the geolith geocoding MCP server: five read-only tools, one API key, hard stop at the quota.

By · Updated

geolith runs a remote Model Context Protocol server. An agent connected to it can geocode with five read-only tools: search, autocomplete, structured_search, reverse and place. The tools answer from the same index as the hosted API.

The server is for geocoding only. It has no routing, map-tile or dataset tools.

Endpoint

FieldValue
URLhttps://geolith.app/mcp or https://api.geolith.app/mcp (the same server)
TransportStreamable HTTP, stateless: one JSON-RPC message per POST, answered as text/event-stream
Protocol version2025-06-18
Server namegeolith-geocoding

GET answers 405. JSON-RPC batches are refused with error -32600; send one message per request.

Authentication

Send a secret key (gc_sk_…) from the console as Authorization: Bearer YOUR_API_KEY. ?api_key= in the URL works too, but a header keeps the key out of logs.

A publishable key (gc_pk_…) works only from the browser origins it lists. A desktop client such as Claude Code or Cursor sends no origin, so it gets 403 origin_not_allowed.

The server also accepts OAuth 2.1 access tokens from console.geolith.app with the geocode scope. A client that supports MCP authorization finds the authorization server on its own: an unauthenticated request gets a WWW-Authenticate challenge that names the protected-resource metadata document.

curl -s https://api.geolith.app/.well-known/oauth-protected-resource/mcp
{
  "resource": "https://api.geolith.app/mcp",
  "resource_name": "geolith geocoding MCP server",
  "authorization_servers": ["https://console.geolith.app"],
  "scopes_supported": ["geocode"],
  "bearer_methods_supported": ["header"]
}

Connect a client

Claude Code

claude mcp add --transport http geolith https://geolith.app/mcp \
  --header "Authorization: Bearer $GEOLITH_API_KEY"

claude mcp list   # geolith: https://geolith.app/mcp (HTTP) - ✔ Connected

Cursor

Add geolith to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project). Cursor reads ${env:GEOLITH_API_KEY} from your environment, so the file holds no secret. This snippet follows the format in Cursor's MCP docs; we have not run it in Cursor ourselves.

{
  "mcpServers": {
    "geolith": {
      "url": "https://geolith.app/mcp",
      "headers": { "Authorization": "Bearer ${env:GEOLITH_API_KEY}" }
    }
  }
}

Other clients

A client that takes a remote server as a URL plus headers can use this mcp.json (the type field is the one Claude Code's project .mcp.json uses). Replace YOUR_API_KEY with your secret key:

{
  "mcpServers": {
    "geolith": {
      "type": "http",
      "url": "https://geolith.app/mcp",
      "headers": { "Authorization": "Bearer YOUR_API_KEY" }
    }
  }
}

To check the connection without a client, list the tools with curl:

curl -s https://geolith.app/mcp \
  -H "Authorization: Bearer $GEOLITH_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Tools

All five tools are read-only and idempotent. Each returns a GeoJSON FeatureCollection as structuredContent and as JSON text. Show "© OpenStreetMap contributors, Overture Maps Foundation" with the results (Attribution).

layers takes any of venue, address, street, locality, county, region, country. size is 1 to 40.

ToolWhat it doesParameters (required in bold)
searchForward geocoding: places, addresses and points of interest that match free text, ranked by relevancetext, size, layers, country (ISO 3166-1 alpha-2 codes), focus_lat, focus_lon
autocompleteType-ahead suggestions for partial texttext, size, layers, country, focus_lat, focus_lon
structured_searchForward geocoding from address partsaddress, neighbourhood, locality, county, region, postalcode, country (name or ISO code), size, layers
reversePlaces and addresses nearest to a coordinate, closest firstlat, lon (WGS 84), radius_km (default 1, at most 100), size, layers
placeDetails of places by id, optionally with their outlinesids (1 to 40 gids from earlier results, such as geolith:venue:123), geometry (include the polygon)

Each answer's _meta carries geolith/results (the number of features) and geolith/quotaRemaining (requests left this month).

Quota and errors

Each tool call counts as one request against the monthly geocoding allowance of your plan, the same as a REST request; initialize and tools/list are not counted. At the limit, calls stop; there are no overage charges. Allowances per plan are on pricing and in Quotas and errors.

Credential and rate refusals answer before MCP runs, with the HTTP status and the JSON body of the REST API:

{
  "error": {
    "code": "invalid_api_key",
    "message": "The API key is not valid. Check the key at https://console.geolith.app/dashboard/keys (keys start gc_sk_ or gc_pk_).",
    "docs": "https://docs.geolith.app/search/hosted/quotas-and-errors#errors"
  }
}
StatusCodeWhen
401missing_api_keyNo key or token; the answer carries the WWW-Authenticate challenge
401invalid_api_keyMalformed, unknown or revoked key
401invalid_tokenOAuth token expired or for another resource
403insufficient_scopeOAuth token without the geocode scope
403origin_not_allowedPublishable key without an allowed origin
429rate_limitedToo many requests a second; retry after Retry-After

A refused tool call is an MCP result with isError: true, not an HTTP error. Its text is the message, then the code and the errors page. Over the allowance it reads:

Monthly geocoding allowance of 50000 requests on the Free plan is used up. It resets on 1 Dec 00:00 UTC. Upgrade: https://console.geolith.app/dashboard/billing (code: quota_exceeded; see https://docs.geolith.app/search/hosted/quotas-and-errors#errors)

An argument out of range (for example lat above 90) is refused by the tool's input schema before any request is counted.