关于 Mapsi Mcp
Mapsi Mcp 是面向 AI 编码助手的 MCP 服务,可调用基于 OpenStreetMap 的 Mapsi 地理空间 API。它提供 18 种工具,涵盖地址查询、路线、空间分析和地图输出,也支持批量操作。
主要功能
- 01地理编码与地址规范化
- 02路线规划与可达范围
- 03出行矩阵与 GPS 轨迹匹配
- 04地点、海拔与时区查询
- 05H3 网格与多边形查询
- 06批量地理编码与地图 URL
适用场景
- 01为地址数据集添加坐标
- 02查找附近地点或路线
- 03分析某地点的服务覆盖范围
- 04显示 Mapsi 瓦片或静态地图
MCP 相关
向兼容 MCP 的客户端提供 18 种 Mapsi 地理空间工具。服务使用配置的 Mapsi API 密钥验证 API 调用。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
18收录的工具列表 · 更新于 3 周前
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| q | string | 是 | 要进行地理编码的完整地址或地点名称。 |
| countries | string | 否 | 用于偏向搜索结果的 ISO 3166-1 alpha-2 国家/地区代码。以逗号分隔,最多 4 个。已知用户所在国家/地区时,请务必传入。 |
| limit | integer | 否 | 返回结果数上限。默认值为 5,最大值为 25。需要单个最佳匹配时使用 1。 |
| lang | string | 否 | 响应语言代码(BCP 47)。默认值:en。 |
| focus.lat | number | 否 | 用于偏置结果的纬度(例如,用户的当前位置)。范围:-90 至 90。 |
| focus.lon | number | 否 | 用于偏置结果的经度。范围:-180 至 180。 |
详细介绍
mapsi-mcp
适用于 Mapsi 的 MCP 服务 — 为 AI 编码助手提供 18 种地理空间工具。将 Claude Code、Cursor、Windsurf 或任何兼容 MCP 的 IDE 直接连接到 Mapsi API。
基于 OpenStreetMap · 可自托管的基础设施 · 不受 Google Maps 供应商锁定
快速开始
1. 获取 API 密钥,访问 mapsi.dev/console/api-keys(免费套餐:每天 1,000 次调用,无需信用卡)
2. 将配置添加到 IDE:
Claude Code / Claude Desktop
添加到 ~/.claude.json(或项目根目录中的 .mcp.json):
{
"mcpServers": {
"mapsi": {
"command": "npx",
"args": ["-y", "mapsi-mcp"],
"env": { "MAPSI_API_KEY": "msk_your_key_here" }
}
}
}
Cursor
添加到 ~/.cursor/mcp.json:
{
"mcpServers": {
"mapsi": {
"command": "npx",
"args": ["-y", "mapsi-mcp"],
"env": { "MAPSI_API_KEY": "msk_your_key_here" }
}
}
}
Windsurf
添加到 ~/.codeium/windsurf/mcp_config.json — JSON 格式与上方 Cursor 配置相同。
VS Code + Cline
打开 Cline 设置 → MCP Servers → Add server → 粘贴:
{
"mapsi": {
"command": "npx",
"args": ["-y", "mapsi-mcp"],
"env": { "MAPSI_API_KEY": "msk_your_key_here" }
}
}
Zed
在 Zed 设置的 "context_servers" 下添加:
{
"mapsi-mcp": {
"command": { "path": "npx", "args": ["-y", "mapsi-mcp"] },
"env": { "MAPSI_API_KEY": "msk_your_key_here" }
}
}
3. 重启 IDE — 然后用自然语言向 AI 提问。
可以向 AI 提出哪些请求
Geocode all addresses in my CSV and add lat/lon columns
Build an address autocomplete input for this React form using Mapsi
Draw a 20-minute drive isochrone from our warehouse at this coordinate
Find the 5 nearest hospitals to this coordinate
Migrate this Google Maps geocoding call to Mapsi
Add a MapLibre map with Mapsi light tiles and drop markers from this array
Calculate a distance matrix between 10 warehouses and 50 delivery stops
Snap this GPS trace to the road network and calculate total distance
可用工具(18 种)
地理编码
| 工具 | 描述 |
|---|---|
geocode | 地址或地点名称 → 纬度/经度。返回置信度分数(0–1);低于 0.6 的分数应视为存在歧义。 |
reverse_geocode | 纬度/经度 → 格式化地址、街道、城市、邮编、国家/地区。 |
autocomplete | 用户输入时实时提供地址建议(至少 2 个字符)。适用于 UI 输入字段。 |
normalize_address | 规范化杂乱或不一致的地址。返回结构化字段和坐标。 |
timezone | 任意坐标对应的 IANA 时区名称、UTC 偏移量和夏令时状态。 |
elevation | 任意坐标的海拔(米)(全球分辨率约为 30 米)。 |
路线规划
| 工具 | 描述 |
|---|---|
route | 转弯导航。模式:auto、truck、bicycle、pedestrian、motor_scooter。 |
isochrone | N 分钟或 N 米范围内的可达区域多边形。返回适用于 MapLibre/Leaflet 的 GeoJSON。 |
matrix | 一次调用即可计算最多 50×50 个起点-终点组合的行程时间和距离矩阵。 |
map_match | 将 GPS 轨迹匹配到道路网络。坐标顺序为 [lon, lat](GeoJSON)。 |
nearest_road | 查找最近的可导航道路点。如果 route 返回“no route found”,请调用此工具。 |
地点
| 工具 | 描述 |
|---|---|
places_search | 按类别查找附近的兴趣点(餐厅、医院、药店、ATM 等)。返回名称、坐标和类别。 |
空间
| 工具 | 描述 |
|---|---|
point_in_polygon | 查询坐标对应的行政区划层级:国家/地区、区域、城市、街区。 |
h3_index | 将坐标转换为分辨率 0–15 的 H3 六边形网格单元。 |
批处理
| 工具 | 描述 |
|---|---|
batch_geocode | 一次调用即可对最多 30,000 个地址进行地理编码。批量处理数据时,切勿循环调用 geocode。 |
batch_reverse_geocode | 一次调用即可对多个坐标进行反向地理编码。 |
瓦片
| 工具 | 描述 |
|---|---|
get_tile_style_url | MapLibre GL 样式 URL。样式:light、dark、streets、topo、grayscale、black、white、liberty。 |
get_static_map_url | 静态 PNG 地图 URL,可用于 <img> 标签、电子邮件和 PDF。 |
身份验证
- API 调用:
X-API-Key请求头(由 MCP 服务自动处理) - 瓦片 URL:
?key=查询参数(适用于浏览器;由get_tile_style_url返回)
Agent 常用模式
地理编码一次,重复使用结果:
Don't re-geocode the same address twice within a session. Cache the lat/lon and pass it directly to route, isochrone, and places_search.
批量数据 → 使用批处理工具:
For more than 1 address or coordinate pair, always use batch_geocode / batch_reverse_geocode.
路线规划失败 → 先调用 nearest_road:
If route returns an error near the origin or destination, call nearest_road to snap the point to a routable road, then retry route with the snapped coordinates.
等时圈 — 时间还是距离:
Use contours_minutes for time-based reachability (delivery ETAs, commute zones).
Use contours_meters for fixed-radius circles on the road network.
Provide only one, not both.
定价
| 套餐 | 每日调用次数 | 批次大小 |
|---|---|---|
| 免费 | 1,000 | 10 |
| Growth | 50,000 | 5,000 |
| Business | 无限制 | 30,000 |
完整定价请访问 mapsi.dev/pricing
Links
- Website: mapsi.dev
- API docs: mapsi.dev/docs
- AI prompts: mapsi.dev/prompts-for-ai
- npm: npmjs.com/package/mapsi-mcp
- GitHub: github.com/algolayer/mapsi-mcp
- Support: [email protected]
License
MIT — algolayer.com
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。