Google Maps

Google Maps

提供定位服务、路线导航和地点详情。

简介

Google Maps MCP 服务器为 Claude 提供地理定位、导航和地点信息服务。

功能概览

  • 地理编码: 地址转坐标 (maps_geocode), 坐标转地址 (maps_reverse_geocode)
  • 地点搜索: 文本搜索 (maps_search_places), 地点详情 (maps_place_details)
  • 路线规划: 方向指引 (maps_directions), 距离计算 (maps_distance_matrix)
  • 地形数据: 海拔信息 (maps_elevation)

设置步骤

  1. 获取 Google Maps API 密钥
  2. 将服务器配置添加到 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>"
      }
    }
  }
}

使用示例

地址转坐标

# 将地址转换为坐标
result = await google_maps.maps_geocode(address="1600 Amphitheatre Parkway, Mountain View, CA")

搜索附近地点

# 查找特定位置附近的餐厅
places = await google_maps.maps_search_places(
    query="restaurants",
    location={"latitude": 37.7749, "longitude": -122.4194},
    radius=1000
)

获取路线

# 获取两点间的导航路线
directions = await google_maps.maps_directions(
    origin="San Francisco",
    destination="Mountain View",
    mode="driving"
)

许可证

MIT 许可证