首页
学习
活动
专区
圈层
工具
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
首页
学习
活动
专区
圈层
工具
MCP广场
MCP广场 >详情页
servers2025-05-265分享
github
基于谷歌地图API调用,提供搜索,线路规划等功能
By modelcontextprotocol
2025-05-265
github
详情内容

Google Maps MCP 服务器

用于 Google Maps API 的 MCP 服务器。

工具

  1. maps_geocode

    • 将地址转换为坐标
    • 输入:address(字符串)
    • 返回:位置、格式化地址、place_id
  2. maps_reverse_geocode

    • 将坐标转换为地址
    • 输入:
      • latitude(数字)
      • longitude(数字)
    • 返回:格式化地址、place_id、地址组件
  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>"
      }
    }
  }
}

与 VS Code 一起使用

为了快速安装,请使用下面的一键安装按钮...

在 VS Code 中使用 NPX 安装 在 VS Code Insiders 中使用 NPX 安装

在 VS Code 中使用 Docker 安装 在 VS Code Insiders 中使用 Docker 安装

对于手动安装,请将以下 JSON 块添加到 VS Code 的用户设置(JSON)文件中。您可以通过按 Ctrl + Shift + P 并输入 Preferences: Open User Settings (JSON) 来完成此操作。

或者,您可以将其添加到工作区中名为 .vscode/mcp.json 的文件中。这将允许您与他人共享配置。

请注意,.vscode/mcp.json 文件中不需要 mcp 键。

{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "maps_api_key",
        "description": "Google Maps API Key",
        "password": true
      }
    ],
    "servers": {
      "google-maps": {
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-google-maps"],
        "env": {
          "GOOGLE_MAPS_API_KEY": "${input:maps_api_key}"
        }
      }
    }
  }
}

对于 Docker 安装:

{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "maps_api_key",
        "description": "Google Maps API Key",
        "password": true
      }
    ],
    "servers": {
      "google-maps": {
        "command": "docker",
        "args": ["run", "-i", "--rm", "mcp/google-maps"],
        "env": {
          "GOOGLE_MAPS_API_KEY": "${input:maps_api_key}"
        }
      }
    }
  }
}

构建

Docker 构建:

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

许可证

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

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档