access_token query parameter. Create a token
at account.mapbox.com/access-tokens
(a default public pk. token works for every operation here), then save it for
the mapbox integration. A call with no saved token throws AuthMissingError.
The plugin never copies the token into an error. Mapbox has a free tier
(see its pricing page for the allowance per API), so the plugin is cheap to
try. Mapbox’s terms allow geocoding responses to be used only together with a
Mapbox map, and the plugin uses temporary geocoding, whose results must not
be cached or stored for later use.
Every operation is a read. Things to know:
- Longitude comes first. Coordinates are
{ longitude, latitude }objects, and the plugin writes them into URLs aslongitude,latitudeas Mapbox expects. A latitude outside -90 to 90 or a longitude outside -180 to 180 is rejected before a request is sent. - Profiles are
mapbox/driving-traffic,mapbox/driving,mapbox/walkingandmapbox/cycling, with themapbox/prefix. - No match is not an error for geocoding. A query with no result is a
successful answer with an empty
featureslist. - No route is an error for routing. Directions, matrix and trip calls
that Mapbox answers with HTTP 200 and
code: 'NoRoute','NoSegment'or'NotImplemented'throw aMapboxAPIErrorcarrying that code, rather than returning an emptyrouteslist. - Mapbox silently ignores some bad values, so the plugin rejects them
first: a geocoding
limitabove 10 (above 5 for reverse), isochrone contours that are not strictly increasing,annotationswithoutoverview: 'full',languagewithoutsteps: true, andexcludevalues the profile does not support. - Reverse geocoding needs exactly one entry in
typeswhenlimitis above 1. - Limits are per product and per minute, and Mapbox reports yours in
x-rate-limit-limit; a default token showed 1,000 for geocoding v6, 300 for directions and isochrone, 60 for matrix and 50 for tilequery. A 429 is retried twice, waiting forx-rate-limit-reset, or 60 seconds when Mapbox sends no timing header. - Left out. The Static Images API returns PNG bytes, which the shared HTTP
client cannot return intact. Optimization v2 (
/optimized-trips/v2, async jobs) answered 403Account does not have access to this serviceon a default token, so only Optimization v1, which answers immediately, is wrapped astrips.optimize. Geocoding’spermanentstorage flag, batch geocoding and structured input are not wrapped. - Webhooks. Mapbox sends none for these APIs, so the plugin handles none.
- 7 typed API operations
Setup
1
Install
2
Add the plugin
corsair.ts
multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.3
Choose authentication
- API Key (Recommended)
No setup required yet. When you make your first request as a tenant, Corsair prompts for the API key.More: API Key
4
Connect a tenant
Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.
Example API calls
Find a place by nameWhat’s next
API reference
Every
mapbox.api.* operation with input and output types.Connect / OAuth
createLink, Hub delivery, and tenant connect flows.
Use with agents
Expose this plugin’s operations as MCP tools.