APIs
MCP server for geocoding, routing and maps
An MCP server lets an AI agent call a service’s functions as tools. oslew runs one at /mcp on api.oslew.com over streamable HTTP, authenticated with the same bearer key as the REST API, and offers 30 read-only tools — geocode, reverse, validate, route, admin, here and the rest — that return exactly what the matching HTTP routes return. The key’s plan decides which tools an agent is shown, and every request draws on the Address rate that every plan includes.
Last reviewed
Location questions are a natural fit for agents — “how far is this from that”, “which municipality is this in”, “is this a real postcode” — and a natural source of confident mistakes. The oslew server is built so that the answer an agent receives carries the evidence it needs to know when to stop and ask, and so that nothing an agent does with it can change the data or the bill.
Connecting an agent
The endpoint is https://api.oslew.com/mcp, over the streamable HTTP transport, with Authorization: Bearer <key> on every request. It is the same key the REST routes take, created in the console. Clients handle the session themselves: they send initialize, keep the session id the server returns, and list the tools.
claude mcp add --transport http oslew https://api.oslew.com/mcp \
--header "Authorization: Bearer $OSLEW_KEY"For a configuration file you commit, name the environment variable rather than pasting the secret, and let the client expand it at start-up. Other clients take the same three things — the URL, the HTTP transport and the header — under their own key names. Without a key the endpoint answers 401; if a client will not connect, a curl of initialize by hand separates a key problem from a configuration problem.
The plan decides what an agent is shown
tools/list returns only the tools whose product the key’s plan includes, using the same gate as the HTTP routes. An agent that cannot see a tool does not try to call it, so the plan shapes the conversation instead of interrupting it. A direct call to a hidden tool is still refused, with a message naming the plan that would answer, so the agent can tell its user what to change.
| Plan | Products | Tools shown |
|---|---|---|
| Free, Address | Address | geocode, reverse, validate, postcode, timezone, health |
| Search | Address, Search | The address tools plus autocomplete and nearby |
| Routing | Address, Routing | The address tools plus route, matrix, isochrone, snap, match, optimize, stops, departures and journeys |
| Platform, Scale | Address, Search, Routing, Platform | All of the above plus admin, here, elevation, raster, scenes, conditions, observations, locate, vessels, vessel, track, crossings and aggregate |
What it costs
Every HTTP request to /mcp — initialize, tools/list and each tools/call — takes one token from the key’s Address bucket, whichever tool is called. On the Address plan, $99 a month, that is 20 requests a second sustained, burst 100; on larger plans it is the Address rate they include, so a route call over MCP draws on the Address rate rather than the Routing one. On the Free plan, at 1 requests a second sustained, burst 5, an agent’s setup requests alone use most of the burst. Going faster returns HTTP 429 with Retry-After before any tool runs, and the client should wait and retry. The pricing page lists the rate on each plan.
What the server teaches an agent
The server sends instructions with its initialize reply, before the agent reads a single tool schema. The parts that change behaviour:
- A tie means ask. When
tied_at_topis greater than one, the text does not determine a single place; the agent should ask the user or add context, not report the first result as the answer. - A dropped context must be said. When
context_resolution.fallbackis true, the city or region the user named matched nothing and the results ignore it. - Confidence is calibrated, not comparative.
confidenceis how often answers of that shape have been right;autocompleteclaims none. - Some counts are bounds. Vessel counts in traffic density are a
[min, max]range, and a Wi-Fi fix from few beacons is coarse. - Licences are per result. Every answer carries
provenancewith a licence code on each row. - Missing data is an error, not an empty list. A route that cannot answer without a layer — roads, transit, elevation, satellite catalogues, beacons, station series or trajectories — refuses with an error naming it, such as “no roads layer loaded”; a lookup that combines layers, such as /v1/here, leaves out what is not loaded. Two combined tools are the exception the instructions leave out:
hereomits any layer that is not loaded, andadminwith no divisions layer answers an empty chain.
If your agent has its own system prompt, repeating the first two rules there costs a sentence and prevents the most common geocoding mistake.
Three tasks agents actually do
Geocode, then route. A user asks how long the drive is from a warehouse to a customer. The agent calls geocode for each address, checks tied_at_top and the fallback flag, and asks which one was meant if either is ambiguous. With two confident coordinates it calls route, and reports the distance and duration — timed at posted or class speeds, without traffic, as the answer’s engine field states. Unless an operator applies a feed, that is the free-flow time, and the agent should say so. The key needs the Routing product; see the routing API.
Enrich a point. A user pastes a coordinate from a log and asks what is there. One here call returns the administrative chain, the time zone, the nearest places and road, elevation and any nearby station readings, and the agent can summarise them while noting that the administrative chain, the road and the time zone are share-alike data. The point enrichment use case covers the same call over a whole table.
Check a postcode. A user asks whether a postcode exists and where it is. postcode answers with its centroid, bounding box, administrative chain and how many addresses the centroid was computed from, which tells the agent how much to trust it; validate then checks a full address against it. Both are Address tools, so this works on every plan, Free included, and the geocoding API explains the fields behind each result.
Read-only by construction
Every MCP tool is read-only; the write paths, POST /v1/traffic and POST /v1/transit_rt, are operator HTTP routes and not tools. Batch jobs, tiles, static maps and the migration checker are not tools either: they return files or job lifecycles rather than answers to reason over. An agent cannot be talked into applying a traffic feed, because no tool would do it.
What remains is rate. A key grants every product its plan includes: there are no per-key scopes, IP allowlists or referrer restrictions. So give each agent its own key: A revoked key is refused within about a second: every pod polls for revocations once a second, and a database notification shortcuts the poll. Revoking one agent’s key then touches nothing else.
What is recorded
An MCP request is logged as one bare event for the endpoint mcp, without the tool’s name or its arguments. That is coarser than the log of an ordinary HTTP request, which keeps masked query tokens and a coarse cell. The security page sets out the whole schema.
Self-hosted agents
A deployment inside your own network can serve the same tools two ways. Over HTTP, the /mcp endpoint works as hosted, with one condition: Behind an ingress, /mcp refuses requests with a 400 unless its public host name is listed in GEO_MCP_ALLOWED_HOSTS, because the transport’s DNS-rebinding guard admits only localhost by default. Over stdio: geo-mcp serves the same MCP tools over stdio, from a local directory or an http(s) store, for an agent that launches its servers as subprocesses. That second path suits an agent that runs beside the data with no network connection to oslew at all.
Limits worth knowing
- The client must support remote HTTP servers with a custom header; stdio is only for self-hosted deployments.
- A tool’s arguments are its route’s parameters, sometimes fewer, as JSON rather than a query string; coordinates are still
lat,lonstrings. - Routing tools answer free-flow times unless an operator has applied a traffic feed on an Enterprise deployment.
- Every request, including the handshake, draws on the Address rate, so a busy agent on a small plan meets HTTP 429 early.
Bottom line
Point any MCP client that sends headers at api.oslew.com/mcp with a key of its own, pick the plan whose tools the agent needs, and repeat the tie and fallback rules in its prompt. The answers carry their own confidence and licence, the tools cannot write, and the cost is a rate, not a meter.
Questions
Which MCP clients can connect to the oslew server?
Any client that speaks the streamable HTTP transport and can send an Authorization header, which includes Claude Code and other clients that support remote HTTP servers. A client that can only launch servers as local subprocesses cannot reach the hosted endpoint; a self-hosted deployment can serve the same tools over stdio instead.
Can an agent change data or run up a bill through the tools?
Neither. Every tool reads from the loaded index and none writes to it, and a plan is a sustained rate rather than a metered allowance, so an agent that loops is slowed by HTTP 429 responses instead of adding to an invoice. The worst it can do is use up its key’s rate for a while.
Which tools will my agent see?
Those in the products its key’s plan includes. Every plan includes Address, so every agent sees geocode, reverse, validate, postcode and timezone, plus health. Search adds autocomplete and nearby, Routing adds the road and transit tools, and Platform adds the administrative, earth, maritime and device-location tools.
Does oslew log what my agent asks?
An MCP request is logged as one bare event for the mcp endpoint, without the tool name or its arguments. The query log never has a field for an IP address, a key or the text of a query, so an agent’s questions are not recorded in a form that could be read back.
Can I run the MCP server on my own infrastructure?
Yes, as part of a self-hosted deployment, which is arranged on request. geo-mcp serves the same tools over stdio from a local directory or an object store, for agents that launch their servers as subprocesses. Behind an ingress, the HTTP endpoint needs its public host name listed before it will accept requests.