VM

version44/mapbox-mcp-0.15.1-unofficial-patch

Developer tools
0 stars 0 forks Quality 78 Trend 20MIT

Unofficial patch for Mapbox MCP server 0.15.1 (LM Studio): turn-by-turn tables, fuel and 407 ETR toll estimates, static route maps. Not affiliated with Mapbox.

Overview

Use at your own risk. Toll and fuel figures are estimates, not quotes. This patch replaces a few files inside @mapbox/mcp-server so that local models in LM Studio (tested with Gemma 4 12B and GPT-OSS-20B) get usable turn-by-turn directions, costs and maps. 1. Install the stock server once: npm install @mapbox/[email protected] 2. Back up node_modules\@mapbox\mcp-server\dist. 3. Extract this zip node_modules\@mapbox\mcp-server\ so its dist\ merges over the existing one (tools\, TESTING.md and this README are extras). 4. In LM Studio's mcp.json: 5. Restart LM Studio fully. Reinstalling or updating @mapbox/mcp-server overwrites the patch. It only works with . The 13 interchange points in 407etr-rates.json decide which zone each kilometre falls in. Check them with your own token (it's only sent to api.mapbox.com and never printed): Each row should say .

README

Unofficial LM Studio patch for the Mapbox MCP server 0.15.1

Unofficial. Not affiliated with or endorsed by Mapbox or 407 ETR. Use at your own risk. Toll and fuel figures are estimates, not quotes.

This patch replaces a few files inside @mapbox/mcp-server version 0.15.1 so that local models in LM Studio (tested with Gemma 4 12B and GPT-OSS-20B) get usable turn-by-turn directions, costs and maps.

What it changes

Area Behaviour after the patch
Turn-by-turn directions directions_tool returns a ready-made Markdown table (#, instruction, distance, time) with a Total row. Stock 0.15.1 drops the steps entirely.
Coordinates Accepts [longitude, latitude] arrays, {lat, lng} and keys with stray quotes, which small models often send. LM Studio no longer rejects these calls.
Costs Only when costs are asked for (include_costs: true and/or the fuel options): a per-row Segment Fuel and Toll column, totals, and an “Estimated trip cost” line. Plain directions show neither column. Fuel options: fuel_consumption_l_per_100km, fuel_price_per_litre, fuel_currency. Prices above 20 are read as cents per litre. If fuel wasn’t passed, the result tells the model to call again rather than calculate it itself.
Tolls In the Toll column: blank = free road, - = toll road without a price, otherwise the estimate.
407 ETR (Ontario) Per-segment 407 ETR estimates from the 2026 light-vehicle rate chart: zone, direction, weekday/weekend and time band, plus the $1.00 trip charge (and the $5.30 camera charge with has_407_transponder: false). Rates live in 407etr-rates.json.
Response size directions_tool never returns raw route geometry to the model (it can be megabytes on long trips); maps are drawn server-side instead.
Stopovers Intermediate waypoints show as “Arrive at stop N” / “Leave stop N” instead of a mid-route “You have arrived”.
“Via highway” requests The tool description tells models not to invent waypoints for “via 407” style requests.
Maps render_map_tool also returns a static PNG with the route drawn in blue (A/B pins), because LM Studio can’t display the interactive MCP-Apps map. directions_tool with include_map: true attaches the same image in one call. If a model damages the route reference, the map falls back to the most recent route (and says so).

Install (Windows example)

  1. Install the stock server once: npm install @mapbox/[email protected]
  2. Back up node_modules\@mapbox\mcp-server\dist.
  3. Extract this zip into node_modules\@mapbox\mcp-server\ so its dist\ merges over the existing one (tools\, TESTING.md and this README are extras).
  4. In LM Studio’s mcp.json:
    "mapbox": {
      "command": "node",
      "args": ["C:\\path\\to\\node_modules\\@mapbox\\mcp-server\\dist\\esm\\index.js"],
      "env": { "MAPBOX_ACCESS_TOKEN": "pk.your_public_token" }
    }
    
  5. Restart LM Studio fully.

Reinstalling or updating @mapbox/mcp-server overwrites the patch. It only works with 0.15.1.

Checking the 407 zone boundaries

The 13 interchange points in 407etr-rates.json decide which zone each kilometre falls in. Check them with your own token (it’s only sent to api.mapbox.com and never printed):

cd node_modules\@mapbox\mcp-server
$env:MAPBOX_ACCESS_TOKEN="pk.your_token"
node tools\check-407-boundaries.mjs

Each row should say OK. For a FIX row, open the Google Maps link, find where the crossing road meets the 407, right-click on the 407 lanes at that spot, click the coordinates to copy them, paste them as lat/lon, and run the checker again. When all rows are OK, set "approximate": false on each point.

Updating 407 ETR rates

Edit dist/esm/tools/directions-tool/407etr-rates.json. Each line is one row of the 407 ETR rate chart (Zone 1 to Zone 12, cents/km). Change valid_from / valid_through for the new year. Outside those dates, toll cells show -. Most boundary_points (the interchanges between zones) are approximate. Correct them with exact coordinates and set "approximate": false.

Testing

See TESTING.md for the full live test plan.

Files

  • dist/esm/schemas/shared.js: coordinate normalisation
  • dist/esm/tools/directions-tool/cleanResponseData.js: table, fuel, toll column, stopovers
  • dist/esm/tools/directions-tool/DirectionsTool.js: table delivery and model guidance
  • dist/esm/tools/directions-tool/DirectionsTool.input.schema.js: fuel / 407 options
  • dist/esm/tools/directions-tool/etr407Tolls.js + 407etr-rates.json: 407 ETR pricing
  • dist/esm/tools/render-map-tool/RenderMapTool.js: static map with the route in blue
  • dist/esm/utils/staticRoutePreview.js: shared static-map helper (new file)
  • dist/esm/tools/static-map-image-tool/StaticMapImageTool.js: description tweak
  • tools/check-407-boundaries.mjs: checks the 407 zone boundary points against Mapbox (needs your token, run locally)

Limitations

  • Estimates exclude taxes, monthly/annual 407 fees and unflagged holidays. Only the 407 ETR is priced; other toll roads (e.g. US toll roads, bridges) show -.
  • Each map adds one extra Directions request to your Mapbox usage.
  • Very long routes may be too detailed for a static map image.

License

The original Mapbox MCP server is MIT-licensed (see LICENSE.md, Copyright © 2025 Mapbox, Inc.). The modified files keep that license. The patch additions are offered under the same MIT terms.

View this README on GitHub

Install

This server does not publish a one-line install command.

Open the repository installation guide