maplibre-mcp

io.github.birkskyum由 GitHub 账号 birkskyum 发布v0.9.2更新于 Oct 24, 2026

An MCP server that lets AI agents check, render and show MapLibre styles

概览

AI 生成的概览

一个本地 MCP 服务器,让 AI 代理校验、检查、渲染和预览 MapLibre 样式,从而看到并修正它正在编辑的地图。

可以做什么
按 MapLibre 样式规范校验样式,查询规范与 GL JS API 细节,并对拼错的名称给出建议、指出不受支持的方法。读取数据源和矢量瓦片,列出源图层、字段和示例要素,找出引用了不存在数据的图层。诊断每个图层在某地点和缩放级别是否绘制及原因,包括过滤器、绘制属性和缺失的雪碧图或字体。按指定相机或范围把样式渲染成 PNG,并对比两个样式版本或两个渲染器。向用户提供随样式文件变化的实时地图链接,渲染含地图的整个网页,并在支持 MCP Apps 的客户端中显示 GeoJSON 地图。列出 Martin 服务器提供的瓦片、雪碧图、字体和样式。搜索 MapLibre 生态中的 SDK、插件、托管 API 和底图,并标明是否需要 API 密钥及署名要求。
适用场景
当代理编写或修改 MapLibre 样式、需要直观检查结果而不是凭猜测时使用;也适合图层无法绘制、需要从真实瓦片中查找原因的情况。尤其适合没有 shell、在沙箱或聊天应用中无法自行搭建渲染器的代理。
运行要求
通过 npx 运行的本地进程,需要 Node.js 22 或更高版本。使用 MapLibre GL JS 渲染依赖已安装的 Google Chrome,也可在首次渲染时安装 Chromium;沙箱和 CI 可使用提供的容器镜像。可选环境变量 MAPLIBRE_MCP_TOOLSETS 和 MARTIN_URL;martin 工具集需要 Martin 服务器,Native 渲染需要额外安装一个包。无需 API 密钥。
安装前请注意
渲染会通过网络获取样式的数据源和瓦片地址,render_page 可先在页面中执行脚本。可选的 HTTP 模式没有身份验证,且绑定非回环地址时仍会从自身网络获取给定 URL,应置于带身份验证的代理之后。样式路径相对于服务器运行目录读取。

安装

在 SourceWeft 中

  1. 打开 控制台中的 maplibre-mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

maplibre-mcp

[birkskyum/maplibre-mcp MCP server]

An MCP server that lets an AI agent see the MapLibre map it works on, check it, and show it to you.

[A hiking map of the Alps in 3D, with the Matterhorn against an evening sky]

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.

ClientCommand
Claude Codeclaude mcp add maplibre -- npx -y maplibre-mcp
Codexcodex mcp add maplibre -- npx -y maplibre-mcp
Gemini CLIgemini mcp add maplibre npx -- -y maplibre-mcp
Grokgrok mcp add maplibre -- npx -y maplibre-mcp
VS Codecode --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.

json
{  "mcpServers": {    "maplibre": {      "command": "npx",      "args": ["-y", "maplibre-mcp"]    }  }}

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.

sh
npx -y maplibre-mcp render style.json --center 12.57,55.68 --zoom 12npx -y maplibre-mcp compare before.json after.json --zoom 10npx -y maplibre-mcp compare-renderers style.json --renderers gl-js,nativenpx -y maplibre-mcp describe-sources style.jsonnpx -y maplibre-mcp debug-layers style.json --center 12.57,55.68 --zoom 14npx -y maplibre-mcp inspect-tile https://tiles.openfreemap.org/planet --center 12.57,55.68 --zoom 14npx -y maplibre-mcp describe-gl-js-api Map#flyTo

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.
  • inspect_tile reads the vector tile at a place and lists each source layer with its geometry types, the values of its fields and how often they occur, and a few example features, plus the zoom range of the source and the source layers the tile lacks. The source can be a source in a style, a TileJSON URL like a Martin source, a PMTiles archive or a tile URL, with MVT or MLT tiles.
  • debug_layers says for each layer of a style whether it draws at a place and zoom, and if not, why, like a missing source layer, a filter that matches nothing (next to the values the data has), a fill layer without polygons, paint that comes out as 0 or transparent, or icons missing from the sprite. It also notes text that falls back to local fonts, since the glyph server lacks its font stack.
  • render_style renders a style to a PNG, and reports map errors, missing fonts and missing icons. It takes a center, zoom, bearing and pitch, bounds to fit, or a camera position and a point to look at over 3D terrain.
  • preview_style gives the user a link to a live, interactive map of a style. The map follows the style file as it changes, and an agent with no files to write sends a changed style to the same link.
  • render_page renders a web page with a map, for what a style cannot hold, like plugins, controls and the page's code. It reports the page's errors and failed requests, and can run a script in the page first.
  • compare_styles renders two versions of a style at the same camera, and returns one image with the style before, after, and their differences in red.
  • compare_renderers does the same for one style in two renderers, for example to check that a style looks the same on the web and on mobile.
  • show_map shows the user an interactive map with GeoJSON layers and markers on an OpenFreeMap basemap, in clients that support MCP Apps.
  • martin_list_sources lists the tiles, sprites, fonts and styles a Martin server serves, with the URLs to use in a style.
  • search_ecosystem searches Make with MapLibre for SDKs, plugins, routing, geocoding, styling and tiling libraries, hosted APIs, products and consultancies, filtered by kind and platform, with their links and live demos.
  • find_basemaps lists the basemaps in Make with MapLibre with their style URLs or tile sources, whether they need an API key, and the attribution or logo their provider requires on the map.

The data of Make with MapLibre is © Birk Skyum, under CC BY 4.0, and both tools end with its credit.

The tools that take a style accept it as an object (style), a URL (url) or a file (path, relative to where the server runs). The tool reference lists every parameter.

Toolsets

The tools are grouped by the MapLibre project they belong to. style, gl-js and ecosystem are on by default. Choose others with --toolsets, or with the MAPLIBRE_MCP_TOOLSETS environment variable, and all turns on every toolset:

sh
npx -y maplibre-mcp --toolsets style,gl-js,martin
ToolsetWhat it adds
stylevalidate_style, describe_style_spec, describe_sources, inspect_tile, debug_layers
gl-jsRendering with MapLibre GL JS, render_page, preview_style, describe_gl_js_api and show_map
nativeRendering with MapLibre Native
martinRendering with a Martin server, and martin_list_sources
ecosystemsearch_ecosystem and find_basemaps, which read the catalog of Make with MapLibre

With any renderer on, there are render_style and compare_styles, and with two or more, compare_renderers. Rendering with MapLibre Native needs one more package, and rendering with Martin needs a Martin build with rendering. Rendering covers both.

Remote server

--http serves Streamable HTTP at http://127.0.0.1:3100/mcp instead of stdio, and --host and --port change the address. On a loopback address it only answers requests from localhost. On any other address it does not read or write files, it still fetches the URLs it is given from its own network, and it has no authentication, so put it behind a proxy that has. Remote server has the details.

Development

sh
npm installnpm testnpm run dev:site

License

MIT © 2026 Birk Skyum

来源:README.md,提交 af12637

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

7
  1. v0.9.2最新Oct 5, 2026
  2. v0.9.1Oct 5, 2026
  3. v0.8.1Oct 3, 2026
  4. v0.8.0Oct 3, 2026
  5. v0.7.1Sep 30, 2026
  6. v0.7.0Sep 30, 2026
  7. v0.6.1Sep 27, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分