谷歌地图

@modelcontextprotocol/google-maps
Hosted
12 Stars 8.1k 次浏览 modelcontextprotocol 更新于 2026-08-23

Google Maps API 的 MCP 服务器。

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "google-maps": {
      "args": [
        "-y",
        "@modelcontextprotocol/server-google-maps"
      ],
      "command": "npx",
      "env": {
        "GOOGLE_MAPS_API_KEY": "\u003cYOUR_API_KEY\u003e"
      }
    }
  }
}

该服务需要配置环境变量:GOOGLE_MAPS_API_KEY

可用工具 (7 个)

该服务在 MCP 协议中暴露的工具,AI 可按需调用

maps_geocode 1 个参数 需填 1 项

Convert an address into geographic coordinates

必填参数:address

maps_reverse_geocode 2 个参数 需填 2 项

Convert coordinates into an address

必填参数:latitude、longitude

maps_search_places 3 个参数 需填 1 项

Search for places using Google Places API

必填参数:query

maps_place_details 1 个参数 需填 1 项

Get detailed information about a specific place

必填参数:place_id

maps_distance_matrix 3 个参数 需填 2 项

Calculate travel distance and time for multiple origins and destinations

必填参数:origins、destinations

maps_elevation 1 个参数 需填 1 项

Get elevation data for locations on the earth

必填参数:locations

maps_directions 3 个参数 需填 2 项

Get directions between two points

必填参数:origin、destination

服务介绍

Google Maps MCP 服务器

用于 Google Maps API 的 MCP 服务器。

工具

  1. maps_geocode

    • 将地址转换为坐标
    • 输入: address (字符串)
    • 返回: location, formatted_address, place_id
  2. maps_reverse_geocode

    • 将坐标转换为地址
    • 输入:
      • latitude (数字)
      • longitude (数字)
    • 返回: formatted_address, place_id, address_components
  3. maps_search_places

    • 使用文本查询搜索地点
    • 输入:
      • query (字符串)
      • location (可选): { latitude: 数字, longitude: 数字 }
      • radius (可选): 数字 (米,最大 50000)
    • 返回: 包含名称、地址和位置的地点数组
  4. maps_place_details

    • 获取关于某个地点的详细信息
    • 输入: place_id (字符串)
    • 返回: 名称、地址、联系信息、评分、评论、营业时间
  5. maps_distance_matrix

    • 计算点之间的距离和时间
    • 输入:
      • origins (字符串数组)
      • destinations (字符串数组)
      • mode (可选): "driving" | "walking" | "bicycling" | "transit"
    • 返回: 距离和持续时间矩阵
  6. maps_elevation

    • 获取地点的海拔数据
    • 输入: locations (包含 {latitude, longitude} 的数组)
    • 返回: 每个点的海拔数据
  7. maps_directions

    • 获取点之间的路线
    • 输入:
      • origin (字符串)
      • destination (字符串)
      • mode (可选): "driving" | "walking" | "bicycling" | "transit"
    • 返回: 包含步骤、距离和持续时间的路线详情

设置

API 密钥

按照这里的说明获取 Google Maps API 密钥。

与 Claude Desktop 一起使用

将以下内容添加到您的 claude_desktop_config.json 中:

Docker

{
  "mcpServers": {
    "google-maps": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "GOOGLE_MAPS_API_KEY",
        "mcp/google-maps"
      ],
      "env": {
        "GOOGLE_MAPS_API_KEY": "<YOUR_API_KEY>"
      }
    }
  }
}

NPX

{
  "mcpServers": {
    "google-maps": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-google-maps"
      ],
      "env": {
        "GOOGLE_MAPS_API_KEY": "<YOUR_API_KEY>"
      }
    }
  }
}

构建

Docker 构建命令:

docker build -t mcp/google-maps -f src/google-maps/Dockerfile .

许可证

此 MCP 服务器根据 MIT 许可证许可。这意味着您可以自由地使用、修改和分发该软件,但需遵守 MIT 许可证的条款和条件。有关更多详细信息,请参阅项目存储库中的 LICENSE 文件。

相关 MCP 服务