maplibre-mcp
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
An MCP server that lets an AI agent see the MapLibre map it works on, check it, and show it to you.
A hiking style an agent made from one prompt, rendered with render_style from a camera placed above Zermatt.
A coding agent can write a MapLibre style, but it can't see the map. So it hands you untested work, or first spends minutes building a renderer of its own, and it reaches for what it remembers, like an older MapLibre GL JS or Mapbox. With maplibre-mcp the agent renders the style, looks at the image and fixes what it sees, and you get a link to a live map that redraws as it edits the file. It runs on your machine and needs no API key.
Two things it is good for:
- **Editing a style by chat while you watch the map change.** "Make the water darker", "thin the footpaths in the village". The agent edits the file and checks the render, and your open map follows.
- **Finding out why a layer doesn't draw.** The agent reads the real tiles, sees which layers draw at a place and why the others don't, and fixes the filter.
An agent with no shell to build its own tools, in a sandbox or a chat app, gets the most from it.
**Website** · Getting started · Examples · Tools
Install
It needs Node.js 22 or newer.
| Client | Command |
| --- | --- |
| Claude Code | claude mcp add maplibre -- npx -y maplibre-mcp |
| Codex | codex mcp add maplibre -- npx -y maplibre-mcp |
| Gemini CLI | gemini mcp add maplibre npx -- -y maplibre-mcp |
| Grok | grok mcp add maplibre -- npx -y maplibre-mcp |
| VS Code | code --add-mcp '{"name": "maplibre", "command": "npx", "args": ["-y", "maplibre-mcp"]}' |
Claude Desktop, Cursor, Windsurf and most other clients read this JSON. Getting started says where each one keeps it.
Rendering with MapLibre GL JS uses the installed Google Chrome. Without Chrome, the first render fails with the command that installs the Chromium it can use instead.
In a sandbox or in CI, where no browser can be installed, use the container image ghcr.io/birkskyum/maplibre-mcp, which has the server and its Chromium. Containers and sandboxes shows how.
Command line
Agents that work in a shell, and people, can also run the rendering and data tools, and the GL JS API lookup, as commands, without setting up MCP. A style is a file or a URL.
The images go to map.png, compare.png and renderers.png, or to --out. npx -y maplibre-mcp --help lists the options, and Command line has the details. To validate, format or migrate a style, use gl-style-validate, gl-style-format and gl-style-migrate from @maplibre/maplibre-gl-style-spec.
Tools
- validate_style checks a style against the MapLibre Style Specification, and lists each problem with the path to its property.
- describe_style_spec looks up a layer type, property, source type or expression, with its documentation and the GL JS and Native versions that support it. For a misspelled name, it suggests the closest real ones.
- describe_gl_js_api looks up a class, method, option or event of MapLibre GL JS, with its signature, documentation, default and examples, in the type definitions of the version the server renders with, or of another version. It also says when a method is not in MapLibre, like one from Mapbox GL JS.
- describe_sources reads the TileJSON, PMTiles header or GeoJSON of each source in a style, lists the source layers and fields, and finds layers that use a source layer or field that is not there.