Skip to main content
Glama

高德地图 MCP Server

一个基于 Model Context Protocol (MCP) 的高德地图服务器,为 AI 应用提供地理编码、搜索、路径规划等地图服务功能。

功能特性

🗺️ 地理编码服务

  • 地理编码:将地址转换为经纬度坐标

  • 逆地理编码:将经纬度坐标转换为详细地址信息

🔍 搜索服务

  • 关键字搜索:根据关键字搜索 POI 信息

  • 周边搜索:在指定位置周围搜索 POI

  • 多边形搜索:在多边形区域内搜索 POI

  • ID 查询:根据 POI ID 获取详细信息

🛣️ 路径规划

  • 驾车路径规划:计算最优驾车路线

  • 步行路径规划:计算步行路线

  • 公交路径规划:查询公交换乘方案

  • 距离计算:计算两点间的直线距离和行驶距离

💡 输入提示

  • 智能提示:根据用户输入提供地点建议

🌍 坐标转换

  • 坐标系转换:支持 GPS、百度、MapBar 等坐标系转换为高德坐标

Related MCP server: Amap (Gaode Maps) MCP Server

快速开始

1. 获取高德地图 API Key

  1. 访问 高德开放平台

  2. 注册并登录账号

  3. 创建应用并申请 "Web 服务 API" Key

2. 安装依赖

npm install

3. 配置环境变量

cp .env.example .env

编辑 .env 文件,填入你的高德地图 API Key:

AMAP_API_KEY=your_amap_api_key_here

4. 构建项目

npm run build

5. 启动服务器

npm start

或者开发模式:

npm run dev

MCP 工具说明

地理编码工具

geocode

将地址转换为经纬度坐标

参数:

  • address (string): 要转换的地址

  • city (string, 可选): 指定城市,提高准确性

reverse_geocode

将经纬度坐标转换为地址信息

参数:

  • location (string): 经纬度坐标,格式:"经度,纬度"

  • radius (number, 可选): 搜索半径,默认 1000 米

搜索工具

search_poi

根据关键字搜索 POI

参数:

  • keywords (string): 搜索关键字

  • city (string, 可选): 指定城市

  • types (string, 可选): POI 类型代码

  • page_size (number, 可选): 每页结果数,默认 20

  • page_num (number, 可选): 页码,默认 1

search_around

周边搜索

参数:

  • location (string): 中心点坐标,格式:"经度,纬度"

  • keywords (string, 可选): 搜索关键字

  • types (string, 可选): POI 类型代码

  • radius (number, 可选): 搜索半径,默认 3000 米

  • page_size (number, 可选): 每页结果数,默认 20

路径规划工具

driving_route

驾车路径规划

参数:

  • origin (string): 起点坐标,格式:"经度,纬度"

  • destination (string): 终点坐标,格式:"经度,纬度"

  • waypoints (string, 可选): 途经点,多个点用 ";" 分隔

  • strategy (number, 可选): 路径策略,默认 0(速度优先)

walking_route

步行路径规划

参数:

  • origin (string): 起点坐标

  • destination (string): 终点坐标

transit_route

公交路径规划

参数:

  • origin (string): 起点坐标

  • destination (string): 终点坐标

  • city (string): 城市名称

  • strategy (number, 可选): 公交策略,默认 0(最快捷)

其他工具

input_tips

输入提示

参数:

  • keywords (string): 输入关键字

  • city (string, 可选): 指定城市

  • datatype (string, 可选): 返回数据类型,默认 "all"

coordinate_convert

坐标转换

参数:

  • locations (string): 要转换的坐标,多个坐标用 ";" 分隔

  • coordsys (string): 原坐标系类型(gps, mapbar, baidu)

distance_calculate

距离计算

参数:

  • origins (string): 起点坐标,多个点用 ";" 分隔

  • destination (string): 终点坐标

  • type (number, 可选): 距离类型,1=直线距离,3=驾车距离

在 Claude Desktop 中使用

  1. 确保 MCP 服务器正在运行

  2. 在 Claude Desktop 的配置文件中添加服务器配置:

{
  "mcpServers": {
    "amap": {
      "command": "node",
      "args": ["/path/to/mcp-amap/dist/index.js"],
      "env": {
        "AMAP_API_KEY": "your_amap_api_key_here"
      }
    }
  }
}
  1. 重启 Claude Desktop

  2. 现在你可以在对话中使用高德地图功能了!

示例用法

用户:帮我查找北京市朝阳区附近的咖啡厅
AI:我来帮你搜索北京市朝阳区附近的咖啡厅...

用户:计算从天安门到故宫的步行路线
AI:我来为你规划从天安门到故宫的步行路线...

用户:这个坐标 116.397499,39.908722 是什么地方?
AI:我来查询这个坐标对应的地址信息...

开发

项目结构

mcp-amap/
├── src/
│   ├── index.ts          # 主入口文件
│   ├── server.ts         # MCP 服务器实现
│   ├── tools/            # 工具实现
│   │   ├── geocoding.ts  # 地理编码工具
│   │   ├── search.ts     # 搜索工具
│   │   ├── routing.ts    # 路径规划工具
│   │   └── utils.ts      # 通用工具
│   ├── types/            # 类型定义
│   │   └── amap.ts       # 高德地图 API 类型
│   └── utils/            # 工具函数
│       ├── api.ts        # API 客户端
│       └── logger.ts     # 日志工具
├── dist/                 # 编译输出
├── package.json
├── tsconfig.json
└── README.md

添加新功能

  1. 在 src/tools/ 目录下创建新的工具文件

  2. 在 src/server.ts 中注册新工具

  3. 更新类型定义和文档

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!

相关链接

Available Tools

12 tools
coordinate_convertA

将其他坐标系的坐标转换为高德坐标系(GCJ02),支持GPS、百度、图吧等多种坐标系。

Inputs: locations (required), coordsys.

distance_calculateA

计算多个起点到一个终点的距离和时间,支持直线距离和驾车距离。

Inputs: origins (required), destination (required), type.

driving_routeA

计算两点间的驾车路径,提供详细的导航信息、距离、时间和费用估算。

Inputs: origin (required), destination (required), ferry, plate, +5 more.

geocodeB

将地址转换为经纬度坐标。支持结构化地址和地标名称。

Inputs: address (required), city.

get_poi_detailB

根据POI ID获取兴趣点的详细信息,包括营业时间、联系方式、评分等。

Inputs: id (required).

input_tipsB

根据用户输入的关键字提供搜索建议,类似搜索框的自动补全功能。

Inputs: keywords (required), city, datatype, citylimit.

reverse_geocodeA

将经纬度坐标转换为详细的地址信息,包括结构化地址、周边POI、道路信息等。

Inputs: location (required), radius, extensions.

search_aroundA

在指定坐标点周围搜索兴趣点,适用于"附近的餐厅"、"周边加油站"等场景。

Inputs: location (required), types, radius, keywords, +3 more.

search_poiA

根据关键字搜索兴趣点(POI),如餐厅、酒店、景点等。支持按城市、类型筛选。

Inputs: keywords (required), city, types, page_num, +2 more.

search_polygonA

在指定多边形区域内搜索兴趣点,适用于特定区域范围的搜索。

Inputs: polygon (required), types, keywords, page_num, +1 more.

transit_routeB

计算两点间的公交换乘方案,包括地铁、公交车等公共交通。

Inputs: city (required), origin (required), destination (required), date, +4 more.

walking_routeA

计算两点间的步行路径,提供步行导航信息和预计时间。

Inputs: origin (required), destination (required), multipath.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 12 tools

    Disambiguation5/5

    Each tool targets a distinct operation: coordinate conversion, geocoding, POI search in different scopes, route planning by mode, and distance calculation. There is no functional overlap, so agents can easily select the correct tool.

    Naming Consistency5/5

    All tool names use snake_case with a clear verb-prefix (e.g., search_poi, calculate_distance) or standard geospatial terms (geocode, reverse_geocode). The pattern is consistent and predictable.

    Tool Count5/5

    12 tools is a well-scoped count for a mapping service. Each tool covers a necessary function without redundancy, making the server feel complete yet not bloated.

    Completeness5/5

    The toolset covers geocoding (both forward and reverse), POI search via keyword, radius, polygon, and detail lookup, plus driving/walking/transit routes, distance calculation, coordinate conversion, and search suggestions. There are no obvious gaps for a typical AMAP use case.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables location-based services through AMap/AutoNavi Maps API including geocoding, weather information, route planning, and POI searches. Supports multiple transportation modes and provides detailed geographic data for Chinese locations.
      12
      4
      Mulan Permissive Software , Version 2
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides a suite of tools for location retrieval and multi-modal route planning within China using the Baidu Maps API. It enables AI agents to perform address-to-coordinate conversions, nearby place searches, and calculate directions for driving, transit, walking, and cycling.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides comprehensive geographic information services and route planning for AI agents via the Amap (Gaode Maps) API. It supports geocoding, multi-modal navigation, POI searches, and administrative region queries.
      3
      -