Amap Maps Skill
Call Amap services via Streamable HTTP MCP.
Quick Start
1. Install Dependencies
CODEBLOCK0
2. Set Environment Variables
CODEBLOCK1
Get Key: https://lbs.amap.com/api/javascript-api-v2/guide/abc/register
3. Use Command Line Tool
CODEBLOCK2
Tool List (15 tools)
| Category | Command | Description |
|---|
| Weather | INLINECODE0 | Query city weather |
| Geocoding |
geo encode <address> [city] | Address → Coordinates |
| |
geo decode <coordinates> | Coordinates → Address |
|
Search |
search text <keyword> [city] | Keyword search POI |
| |
search around <coordinates> <keyword> [radius] | Nearby search |
| |
search detail <POI_ID> | POI details |
|
Routes |
route driving <origin> <destination> | Driving route planning |
| |
route walking <origin> <destination> | Walking route planning |
| |
route bicycling <origin> <destination> | Cycling route planning |
| |
route transit <origin> <destination> <city> <cityd> | Transit route planning |
|
Distance |
distance <origin> <destination> [type] | Distance measurement (0=linear, 1=driving, 3=walking) |
|
Location |
ip-location <IP> | IP location |
|
Schema |
navi <lon> <lat> | Generate navigation URI |
| |
taxi <lon> <lat> <name> | Generate taxi URI |
Common Workflows
Workflow 1: Search Place → Plan Route
CODEBLOCK3
Workflow 2: Current Location Weather
CODEBLOCK4
Workflow 3: Nearby Exploration
CODEBLOCK5
Error Handling
Common Errors
| Error | Cause | Solution |
|---|
| INLINECODE14 | Missing environment variable | Run INLINECODE15 |
| INLINECODE16 |
Key is invalid or expired | Check if Key is correct |
|
Missing parameters | Missing required parameters | Check command format |
|
Rate limit exceeded | Request rate limit exceeded | Reduce request frequency |
References
高德地图技能
通过Streamable HTTP MCP调用高德地图服务。
快速开始
1. 安装依赖
bash
cd amap-maps
npm install
2. 设置环境变量
bash
export AMAP_KEY=你的高德地图Key
获取Key:https://lbs.amap.com/api/javascript-api-v2/guide/abc/register
3. 使用命令行工具
bash
查看所有命令
node scripts/amap.js help
查询天气
node scripts/amap.js weather 北京
地址转坐标
node scripts/amap.js geo encode 北京市朝阳区望京 SOHO 北京
坐标转地址
node scripts/amap.js geo decode 116.482384,39.998383
搜索POI
node scripts/amap.js search text 麦当劳 北京
周边搜索
node scripts/amap.js search around 116.48,39.99 餐厅 1000
路线规划
node scripts/amap.js route driving 116.48,39.99 116.40,39.91
node scripts/amap.js route walking 116.48,39.99 116.40,39.91
node scripts/amap.js route bicycling 116.48,39.99 116.40,39.91
node scripts/amap.js route transit 116.48,39.99 116.40,39.91 北京 北京
距离测量
node scripts/amap.js distance 116.48,39.99 116.40,39.91 1
IP定位
node scripts/amap.js ip-location 114.114.114.114
导航协议(生成高德地图URI)
node scripts/amap.js navi 116.397428 39.90923
打车协议
node scripts/amap.js taxi 116.397428 39.90923 天安门
工具列表(共15个)
| 分类 | 命令 | 描述 |
|---|
| 天气 | weather <城市> | 查询城市天气 |
| 地理编码 |
geo encode <地址> [城市] | 地址 → 坐标 |
| | geo decode <坐标> | 坐标 → 地址 |
|
搜索 | search text <关键词> [城市] | 关键词搜索POI |
| | search around <坐标> <关键词> [半径] | 周边搜索 |
| | search detail
| POI详情 |
| 路线 | route driving <起点> <终点> | 驾车路线规划 |
| | route walking <起点> <终点> | 步行路线规划 |
| | route bicycling <起点> <终点> | 骑行路线规划 |
| | route transit <起点> <终点> <城市> <目的城市> | 公交路线规划 |
| 距离 | distance <起点> <终点> [类型] | 距离测量(0=直线,1=驾车,3=步行) |
| 定位 | ip-location | IP定位 |
| 协议 | navi <经度> <纬度> | 生成导航URI |
| | taxi <经度> <纬度> <名称> | 生成打车URI |
常见工作流程
工作流程1:搜索地点 → 规划路线
bash
1. 搜索目的地
node scripts/amap.js search text 天安门 北京
2. 从结果中获取位置(坐标)
3. 规划驾车路线
node scripts/amap.js route driving 116.48,39.99 116.397428,39.90923
工作流程2:当前位置天气
bash
1. 通过IP定位获取城市
node scripts/amap.js ip-location 114.114.114.114
2. 查询该城市天气
node scripts/amap.js weather 南京
工作流程3:周边探索
bash
1. 地址转坐标
node scripts/amap.js geo encode 北京市朝阳区望京 SOHO
2. 搜索周边餐厅
node scripts/amap.js search around 116.47,39.99 餐厅 1000
错误处理
常见错误
| 错误 | 原因 | 解决方案 |
|---|
| AMAPKEY not set | 缺少环境变量 | 运行 export AMAPKEY=... |
| Invalid API Key |
Key无效或已过期 | 检查Key是否正确 |
| Missing parameters | 缺少必要参数 | 检查命令格式 |
| Rate limit exceeded | 请求频率超限 | 降低请求频率 |
参考资料