mcp-map-server
The mcp-map-server provides map and location-based services to LLM clients by integrating Amap (高德/Gaode) and Baidu Maps Web Service APIs. Here's what you can do:
Geocoding (
map_geocode): Convert addresses to coordinates, administrative district info, and adcodes.Reverse Geocoding (
map_reverse_geocode): Convert coordinates back into human-readable addresses.POI Keyword Search (
map_search_poi): Search for points of interest by keyword, optionally scoped to a city, with pagination support.Nearby/Around Search (
map_search_around): Search for POIs within a specified radius around a given location.Route Planning (
map_direction): Plan routes for driving, walking, public transit, or cycling, with distance, duration, and turn-by-turn steps.Distance Measurement (
map_distance): Calculate distance and estimated travel time between two coordinates.Weather Query (
map_weather): Retrieve real-time weather and multi-day forecasts for an administrative region via adcode.IP Geolocation (
map_ip_location): Determine the approximate province/city for a given IP address.Platform Status Check (
map_get_platform_status): Query which map platforms are enabled and have valid API keys configured.
Key features:
Dynamically switch between Amap (GCJ-02) and Baidu Maps (BD-09) coordinate systems per tool call via a
platformparameter.Unified coordinate format: longitude,latitude across all tools.
Two transport modes:
stdio(local) andSSE(remote HTTP).
Provides tools for map services including geocoding, POI search, route planning, weather, and IP location using the Baidu Maps API.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-map-server what's the weather in Beijing?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Map Server
为 LLM 大模型提供地图能力的 MCP (Model Context Protocol) Server。支持高德地图与百度地图的 Web 服务 API,涵盖地理编码、逆地理编码、POI 搜索、周边搜索、路径规划、距离测量、天气查询和 IP 定位。部署后可直接被支持 MCP 的大模型客户端(Claude、Cherry Studio、Cline 等)调用。
功能
地理编码 / 逆地理编码(地址 ⇄ 坐标)
关键字 POI 搜索与周边搜索
路径规划:驾车 / 步行 / 公交 / 骑行
距离与耗时测量
天气查询(实时 + 未来预报)
IP 定位
双平台支持:高德(amap)、百度(baidu),可按工具调用动态切换
两种传输模式:
stdio(本地)和sse(远程 HTTP)统一坐标格式
经度,纬度,屏蔽两家 API 的坐标顺序差异
Related MCP server: Amap MCP Server
快速开始
1. 申请 API Key
平台 | 申请地址 | 环境变量 |
高德地图 | https://console.amap.com/dev/key/app (创建「Web 服务」类型 Key) |
|
百度地图 | https://lbsyun.baidu.com/apiconsole/key (创建「服务端」应用,得到 AK) |
|
两个平台至少配置一个即可。未配置的平台会自动标记为不可用。
⚠️ 高德 Key 的服务平台必须选「Web服务」,用 Web端(JS)/Android/iOS 类型的 Key 调用 Web 服务 API 会报
USERKEY_PLAT_NOMATCH。若该 Key 开启了「数字签名」,还需把私钥填入MCP_AMAP_SECRET。
2. 克隆仓库
git clone https://github.com/ganyu123456/mcp-map-server.git
cd mcp-map-server3. 本地开发运行
# 安装依赖
pip install -e ".[sse]"
# 配置环境变量
cp .env.example .env
vim .env # 填入 MCP_AMAP_KEY / MCP_BAIDU_KEY
# stdio 模式(本地 MCP 客户端)
MCP_TRANSPORT=stdio python -m mcp_map_server.server
# SSE 模式(远程 MCP 客户端)
MCP_TRANSPORT=sse python -m mcp_map_server.server部署
Docker Compose
cp .env.example .env
# 编辑 .env:填入 API Key,并设置 MCP_IMAGE 指向你的镜像
docker compose up -dCI/CD 自动构建发布
在仓库 Settings → Secrets and variables → Actions 中添加以下 Secrets(用于推送镜像到 Harbor):
Secret | 示例值 | 说明 |
|
| Harbor 用户名 |
|
| Harbor 密码或访问令牌 |
镜像仓库地址已固定为
harbor.zkjgy.online/library(写死在 workflow 中),无需再配置HARBOR_REGISTRY/HARBOR_PROJECT。
打 tag 触发构建:
git tag v1.0.0
git push origin v1.0.0GitHub Actions 将自动构建 linux/amd64 与 linux/arm64 多架构镜像、推送到 Harbor,并创建带离线镜像的 GitHub Release。
MCP 客户端配置
SSE(远程)
{
"mcpServers": {
"map": {
"url": "http://<your-server-ip>:8091/sse"
}
}
}stdio(本地)
{
"mcpServers": {
"map": {
"command": "python",
"args": ["-m", "mcp_map_server.server"],
"env": {
"MCP_TRANSPORT": "stdio",
"MCP_AMAP_KEY": "your_amap_key",
"MCP_BAIDU_KEY": "your_baidu_ak"
}
}
}
}环境变量
变量 | 默认值 | 说明 |
|
| Docker 镜像地址 |
|
| 传输模式: |
|
| SSE 模式监听地址 |
|
| SSE 模式监听端口 |
|
| 启用的地图平台 |
|
| 工具调用未指定平台时的默认平台 |
| (空) | 高德地图 Web 服务 Key(服务平台须为「Web服务」) |
| (空) | 高德数字签名私钥(仅当 Key 开启「数字签名」时填写) |
| (空) | 百度地图 Web 服务 AK |
|
| 版本标签 |
MCP 工具列表
工具 | 说明 |
| 地理编码:地址 → 坐标(含 adcode,可用于天气) |
| 逆地理编码:坐标 → 地址 |
| 关键字 POI 搜索 |
| 周边搜索(指定中心 + 半径) |
| 路径规划(驾车/步行/公交/骑行) |
| 距离与耗时测量 |
| 天气查询(adcode) |
| IP 定位 |
| 查询平台可用状态 |
每个工具(除状态查询外)都支持 platform 参数(amap 或 baidu),省略时使用 MCP_DEFAULT_PLATFORM。
坐标说明
所有工具的坐标统一使用
经度,纬度格式,如116.481,39.990。坐标与平台绑定:高德返回 GCJ-02,百度返回 BD-09,两者不可跨平台混用。请使用哪个平台产生的坐标,就在哪个平台上继续使用。
工具调用示例
地理编码: map_geocode(address="北京市朝阳区阜通东大街6号")
逆地理编码:map_reverse_geocode(location="116.481,39.990", platform="amap")
POI 搜索: map_search_poi(keyword="星巴克", city="上海", limit=10)
周边搜索: map_search_around(location="116.481,39.990", keyword="地铁站", radius=1000)
路径规划: map_direction(origin="116.481,39.990", destination="116.434,39.909", mode="driving")
天气查询: map_weather(city="110000")典型工作流:先用 map_geocode 把地址转成坐标和 adcode → 再用坐标做路径规划 / 周边搜索,或用 adcode 查天气。
项目结构
mcp-map-server/
├── src/mcp_map_server/
│ ├── server.py # MCP 服务器入口,工具定义与分发
│ └── platforms/
│ ├── base.py # 平台抽象层与统一数据模型
│ ├── amap.py # 高德地图实现
│ └── baidu.py # 百度地图实现
├── Dockerfile
├── docker-compose.yaml
├── .github/workflows/
│ └── build-release.yaml # CI/CD 工作流
├── requirements.txt
├── pyproject.toml
└── .env.exampleLicense
MIT
Available Tools
9 toolsmap_directionA
路径规划:计算两点间的路线,支持驾车(driving)、步行(walking)、公交(transit)、骑行(riding)。返回总距离、总时长和分段导航。起终点为'经度,纬度'坐标。
Inputs: origin (required), destination (required), city, mode, +1 more.
map_distanceB
距离测量:计算两点间的距离和预计耗时。mode 为 driving(驾车)或 walking(步行)。起终点为'经度,纬度'坐标。
Inputs: origin (required), destination (required), mode, platform.
map_geocodeB
地理编码:将结构化地址(如'北京市朝阳区阜通东大街6号')转换为经纬度坐标。返回坐标、行政区划和 adcode(可用于天气查询)。
Inputs: address (required), city, platform.
map_get_platform_statusA
查询各地图平台的启用与可用状态(是否已配置 API Key)。
Inputs: no named parameters.
map_ip_locationA
IP 定位:根据 IP 地址返回其大致所在的省市。留空则定位请求来源 IP。
Inputs: ip, platform.
map_reverse_geocodeA
逆地理编码:将经纬度坐标转换为可读地址。坐标格式为'经度,纬度'(如'116.481,39.990')。注意坐标与平台绑定:高德为 GCJ-02,百度为 BD-09,不可跨平台混用。
Inputs: location (required), platform.
map_search_aroundA
周边搜索:以某坐标为中心,在指定半径内搜索 POI(如附近的餐厅、地铁站)。坐标格式'经度,纬度'。
Inputs: location (required), limit, radius, keyword, +1 more.
map_search_poiA
关键字 POI 搜索:按关键字搜索地点(如'星巴克'、'医院'),可限定城市。返回名称、地址、坐标、电话等。
Inputs: keyword (required), city, page, limit, +1 more.
map_weatherA
天气查询:查询某行政区的实时天气与未来几日预报。city 参数需传行政区划编码 adcode(可先用 map_geocode 获取)。
Inputs: city (required), platform.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a distinct mapping operation: route planning, distance, geocoding, reverse geocoding, POI search, nearby search, IP location, weather, and platform status. No overlapping purposes; agents can clearly distinguish them.
All tools share the 'map_' prefix and use underscores, but the verb-noun pattern is not uniform (e.g., 'map_direction' vs 'map_get_platform_status'). Minor inconsistency, but still predictable.
9 tools cover the core mapping domain well: geocoding, routing, POI search, weather, etc. Not too many or too few; each tool serves a clear purpose.
The tool set covers essential mapping functionalities including geocoding, reverse geocoding, routing, distance, POI search, nearby search, IP location, and weather. No obvious gaps.
Maintenance
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
MCP server for China administrative divisions: province/city/district lookup, adcode resolution and
MCP server for GLM chat completions using Zhipu AI models via AceDataCloud
Related MCP Servers
- AlicenseBqualityBmaintenance高德地图MCP Server,支持stdio, sse和streamable-http1613,964 PyPI134MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server that wraps the Amap (高德地图) Web Service APIs, giving AI assistants like Claude Code 9 map tools: geocoding, route planning (driving/transit/walking/cycling), POI search, nearby search, distance measurement, and IP location.1234 npm1MIT
- AlicenseNot gradedqualityDmaintenance基于高德地图API的MCP天气预报服务器,提供中国城市的实时天气和天气预报查询功能。14 npm4MIT
- AlicenseAqualityDmaintenance这是一个面向中文圈的MCP服务器,将中国互联网常用能力(如地图、快递、RSS、B站等)封装为标准MCP工具,方便AI Agent安全调用。132MIT