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
| Field | Value |
|---|---|
| URL | https://geolith.app/mcp or https://api.geolith.app/mcp (the same server) |
| Transport | Streamable HTTP, stateless: one JSON-RPC message per POST, answered as text/event-stream |
| Protocol version | 2025-06-18 |
| Server name | geolith-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.
| Tool | What it does | Parameters (required in bold) |
|---|---|---|
search | Forward geocoding: places, addresses and points of interest that match free text, ranked by relevance | text, size, layers, country (ISO 3166-1 alpha-2 codes), focus_lat, focus_lon |
autocomplete | Type-ahead suggestions for partial text | text, size, layers, country, focus_lat, focus_lon |
structured_search | Forward geocoding from address parts | address, neighbourhood, locality, county, region, postalcode, country (name or ISO code), size, layers |
reverse | Places and addresses nearest to a coordinate, closest first | lat, lon (WGS 84), radius_km (default 1, at most 100), size, layers |
place | Details of places by id, optionally with their outlines | ids (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"
}
}
| Status | Code | When |
|---|---|---|
| 401 | missing_api_key | No key or token; the answer carries the WWW-Authenticate challenge |
| 401 | invalid_api_key | Malformed, unknown or revoked key |
| 401 | invalid_token | OAuth token expired or for another resource |
| 403 | insufficient_scope | OAuth token without the geocode scope |
| 403 | origin_not_allowed | Publishable key without an allowed origin |
| 429 | rate_limited | Too 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.