AI agents over MCP
The same index the HTTP routes answer from, as Model Context Protocol tools. An agent calling geocode gets exactly what /v1/geocode returns — ranked results with calibrated confidence, tied_at_top, a decision to act, ask or refuse, the match evidence and provenance — as structured content, so it can tell a confident answer from a tie from a salvaged fuzzy match, and act on the difference.
- Endpoint:
https://api.oslew.com/mcp, over the Streamable HTTP transport. - Authentication:
Authorization: Bearer <key>, the same key as the HTTP routes. Without one,/mcpanswers401. - Tools: 31, every one read-only, listed with their arguments on MCP tools, which is generated from the server.
- What an agent sees is shaped by the key's plan: it is listed only the tools the plan includes.
- Where it has answers is where the data is: most tools answer Mexico City today. Tell the agent, or it will read an empty result as "nothing there". See coverage.
Connecting
Any MCP client that speaks Streamable HTTP and can send a request header will connect. The client sendsAccept: application/json, text/event-stream, and after initialize carries themcp-session-id the server returned on every later request — MCP clients do both themselves.
Claude Code
claude mcp add --transport http oslew https://api.oslew.com/mcp \
--header "Authorization: Bearer $GEO_API_KEY"--scope decides where the server is saved: local (the default) for you in this project,user for you in every project, project for everyone who works in it, written to.mcp.json at the project's root. Your shell expands $GEO_API_KEY when you run the command, so the saved configuration holds the key itself. For a configuration you commit, write.mcp.json by hand and let Claude Code expand the variable when it starts, so the file names the variable rather than the secret:
{
"mcpServers": {
"oslew": {
"type": "http",
"url": "https://api.oslew.com/mcp",
"headers": {
"Authorization": "Bearer ${GEO_API_KEY}"
}
}
}
}Other clients
Clients that support remote HTTP servers with headers are configured with the same three things: the URL, the transport, and the Authorization header. The shape below is generic — the key names differ between clients (type, transport, serverUrl…), so check your client's own documentation for the exact spelling:
{
"mcpServers": {
"oslew": {
"url": "https://api.oslew.com/mcp",
"headers": { "Authorization": "Bearer sk_live_…" }
}
}
}A client that can only launch servers as local subprocesses, or cannot send a header, cannot connect to this endpoint directly.
Checking by hand
When a client will not connect, the first two messages with curl separate a key problem from a client problem.-i shows the mcp-session-id header, which the second request must repeat:
curl -i https://api.oslew.com/mcp \
-H "Authorization: Bearer $GEO_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"curl","version":"0"}}}'
curl https://api.oslew.com/mcp \
-H "Authorization: Bearer $GEO_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "mcp-session-id: <the id from the first answer>" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'A 401 is the key; a 429 is the rate (below). A 200 whoseinitialize result names the server oslew means the key and the endpoint are fine, and the problem is in the client's configuration.
The plan decides what an agent is shown
tools/list returns only the tools the key's plan includes, by the same product table the HTTP routes are gated by — a tool and the route of the same name always need the same product. An agent that cannot see a tool does not try to call it, so the plan shapes the conversation rather than interrupting it.
A listing is a courtesy; the gate is enforced on the call. A tools/call for a tool outside the plan is refused with a JSON-RPC error whose message has the same form as the HTTP 403 —the {plan} plan does not include {product}; {the plan that does} does — so an agent can tell its user what would answer. By product:
| Product | Tools | For |
|---|---|---|
| Address | geocode, postcode, reverse, timezone, validate | finding places and addresses from text and points |
| Search | autocomplete, nearby | completing what a user is typing, and places by category |
| Routing | departures, isochrone, journeys, match, matrix, optimize, route, snap, stops | roads and transit |
| Platform | admin, aggregate, conditions, crossings, elevation, events, here, locate, observations, raster, scenes, track, vessel, vessels | everything else the index holds |
| No product | health | what is loaded |
Which plans include which products is on products and plans. Every self-serve plan includes Address, free included, so every such key sees at least the address tools and health.
How a tool answers
- A result is the HTTP route's JSON, twice: as text content, and as
structuredContentfor clients that read it. The tool reference links each tool to the operation whose answer it is. - Arguments are JSON, not query strings: numbers are numbers and booleans are booleans; coordinates are still
lat,lonstrings, andmatchtakes its trace as an array of{lat, lon, time}objects. A tool's arguments are its route's parameters, sometimes fewer — the reference lists each. - A bad argument, or a layer that is not loaded, is a JSON-RPC
invalid paramserror carrying the service's own sentence — the same words a400would have. A tool for a missing layer says so rather than answering emptily, with two exceptions:hereleaves out any layer that is not loaded, andadminanswers an empty chain, withlayers0, when no divisions layer is. - The
healthtool answers part of what/v1/healthdoes: the epoch, the number of segments and entities, the bytes, and whether the index is resident or ranged.
What the server tells an agent
The server's instructions arrive with initialize, before any tool is called, so an agent has them before it reads a single schema. They are printed in full on MCP tools. The parts that change what an agent should do:
tied_at_topgreater than 1: "the query does not determine one place — ask the user or add context". The first result is one of that many, not the answer. An agent that reports it as the answer has made the most common geocoding mistake there is.decision.action:act,askorrefuse.refusemeans "do not pick one" — a tie, or a best match too close to the next — anddecision.disambiguationlists the candidates to show the user;asknames what is missing inask_for.context_resolution.fallbacktrue: "nothing satisfied it and the results are the answer without it, so say so or ask". The city or region the user named was not found, and the results ignore it.confidenceis "the observed precision of results like this one", not a score to compare across queries;autocompleteclaims none.locate: "treat a fix with fewusedbeacons as coarse".- Roads are free-flow unless the call passes
traffic: "live"and a traffic feed is applied; with no feed,liveanswers at the same speeds, and each answer'senginesays which weights were used. - Every answer carries
provenance, with a licence code per result; the terms are atwww.oslew.com/licensing. Seedata and licensing.
If your agent has a system prompt of its own, repeating the first two rules there costs a sentence and prevents the confident wrong answer. Reading a result explains each field in full, andan agent over MCP is two complete programs, one on Claude and one on the OpenAI Responses API, that ask the user when an answer is a tie and wait out a 429.
What it costs
Each HTTP request to /mcp takes one token from the bucket of the cheapest product the key holds — Address first, which every self-serve plan includes. Every request counts — initialize,tools/list and each tools/call — and a route call over MCP draws on the address bucket, not the routing one. Going faster than the address rate is an HTTP 429 withRetry-After, before any JSON-RPC is read; nothing is used up, so the agent's client should wait and ask again. On the free plan, at one request a second, an agent's first few seconds of setup take most of the burst. See rate limits.
What is deliberately not a tool
- Feed ingestion — live traffic and GTFS-Realtime. These change what a pod answers; the tools only read. An agent cannot be talked into applying a traffic feed, because there is no tool that would do it.
- Batch jobs, tiles andstatic maps, which are files and job lifecycles rather than answers an agent reasons over.
/v1/migrate, which stays an HTTP route.
Endpoints
MCP is one endpoint rather than an HTTP operation of its own. The health tool mirrors: