Street View MCP

by vlad-ds

Integrations

  • Uses the Google Maps API to fetch Street View data, requiring an API key with Street View API enabled.

  • Enables fetching and displaying Street View imagery by address, coordinates, or panorama ID, saving images to local files, and creating HTML pages that compile multiple Street View images into virtual tours.

街景 MCP

用于 Google 街景 API 的模型客户端协议 (MCP) 服务器,使 AI 模型能够获取和显示街景图像并创建虚拟游览。

与 Claude Desktop 一起使用

要将街景视图 MCP 与 Claude Desktop 结合使用:

  1. 确保已安装uvUV 安装指南
  2. 克隆此存储库:
    git clone https://github.com/vlad-ds/street-view-mcp.git cd street-view-mcp
  3. 安装依赖项:
    uv pip install -e ".[dev]"
  4. 获取 Google 地图 API 密钥(说明如下)
  5. 将以下内容添加到您的 Claude Desktop claude_desktop_config.json文件中:
"street_view": { "command": "uv", "args": [ "run", "--directory", "/path/to/street-view-mcp", // Replace with your actual path "mcp", "run", "src/street_view_mcp/server.py" ], "env": { "API_KEY": "your_google_maps_api_key_here" // Add your API key here } }

配置完成后,您只需在 Claude Desktop 中输入“/street_view”即可使用街景 MCP。

概述

街景 MCP 为 AI 模型提供了一个简单的界面,可以:

  1. 通过地址、坐标或全景图 ID 获取街景图像
  2. 将图像保存到本地文件
  3. 在默认查看器中打开已保存的图像
  4. 创建 HTML 页面,将多张街景图像编译成虚拟游览

要求

  • Python 3.9+
  • 已启用街景视图 API 的 Google 地图 API 密钥
  • fastmcp
  • uv包管理器(推荐)

安装

# Clone the repository git clone https://github.com/vlad-ds/street-view-mcp.git cd street-view-mcp # Create and activate a virtual environment with uv (recommended) uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate # Install dependencies uv pip install -e ".[dev]"

API 密钥设置

街景视图 MCP 需要启用街景视图 API 的 Google 地图 API 密钥:

  1. 访问Google Cloud Console
  2. 创建新项目或选择现有项目
  3. 在 API 库中启用“街景静态 API”
  4. 从凭证页面创建 API 密钥
  5. 将 API 密钥设置为环境变量:
# Set temporarily in your shell: export API_KEY=your_api_key_here # Or create a .env file in the project root: echo "API_KEY=your_api_key_here" > .env

用法

启动 MCP 服务器

python -m street_view_mcp.main --host 127.0.0.1 --port 8000

该服务器将可供指定主机和端口上的 AI 模型使用。

用作 CLI 工具

# Fetch Street View image by address python -m street_view_mcp.street_view --address "Empire State Building, NY" --output output/empire_state.jpg # Fetch Street View image by latitude/longitude python -m street_view_mcp.street_view --latlong "40.748817,-73.985428" --output output/coords.jpg --heading 180 # Fetch Street View image by panorama ID python -m street_view_mcp.street_view --pano PANO_ID --output output/panorama.jpg

MCP 工具

街景 MCP 为 AI 模型提供了以下工具:

get_street_view

根据位置、坐标或全景图 ID 获取街景图像并将其保存到文件中。

{ "filename": "empire_state.jpg", "location": "Empire State Building, NY", "size": "600x400", "heading": 90, "pitch": 10 }

参数:

  • filename (必填):保存图像的名称(不能存在)
  • location (可选):获取图像的地址
  • lat_lng (可选):逗号分隔的坐标(例如,“40.748817,-73.985428”)
  • pano_id (可选):具体全景图ID
  • size (可选):图像尺寸为“宽度x高度”(默认值:“600x400”)
  • heading (可选):相机航向(0-360,默认值:0)
  • pitch (可选):摄像机俯仰角(-90 至 90,默认值:0)
  • fov (可选):视野角度(10-120,默认值:90)
  • radius (可选):搜索半径(以米为单位)(默认值:50)
  • source (可选):图像来源(“默认”或“户外”,默认值:“默认”)

注意:必须提供locationlat_lngpano_id中的一个。

get_metadata

获取有关街景全景图的元数据。

{ "location": "Empire State Building, NY" }

参数:

  • get_street_view相同的位置参数
  • 返回包含状态、版权、日期、全景图 ID 和坐标的 JSON 元数据

open_image_locally

在默认应用程序中打开已保存的街景图像。

{ "filename": "empire_state.jpg" }

参数:

  • filename (必需):要打开的图像的文件名(必须存在于输出目录中)

create_html_page

创建一个 HTML 页面,以虚拟游览的形式显示多张街景图像。

{ "filename": "nyc_tour.html", "title": "New York City Tour", "html_elements": [ "<h1>New York City Landmarks Tour</h1>", "<p>Explore famous landmarks through Street View images.</p>", "<h2>Empire State Building</h2>", "<img src='../output/empire.jpg' alt='Empire State Building'>", "<p class='location'>350 Fifth Avenue, New York, NY</p>", "<p class='description'>This 102-story Art Deco skyscraper was completed in 1931.</p>" ] }

参数:

  • html_elements (必需):HTML 内容元素列表
  • filename (必填):HTML 文件的名称
  • title (可选):页面标题(默认:“街景游览”)

重要提示:引用图像时,请始终使用路径../output/filename.jpg

创建虚拟旅游

街景 MCP 通过将多张街景图像与 HTML 页面中的描述性文本相结合,可以创建虚拟游览。

创建游览的工作流程示例:

  1. 获取不同位置的图像:
get_street_view(filename="empire.jpg", location="Empire State Building, NY") get_street_view(filename="times_square.jpg", location="Times Square, NY") get_street_view(filename="central_park.jpg", location="Central Park, NY")
  1. 创建 HTML 游览页面:
create_html_page( filename="nyc_tour.html", title="New York City Tour", html_elements=[ "<h1>New York City Landmarks Tour</h1>", "<p>Explore these famous NYC landmarks through Street View images.</p>", "<h2>Empire State Building</h2>", "<img src='../output/empire.jpg' alt='Empire State Building'>", "<p class='location'>350 Fifth Avenue, New York, NY</p>", "<p class='description'>An iconic 102-story Art Deco skyscraper in Midtown Manhattan.</p>", "<h2>Times Square</h2>", "<img src='../output/times_square.jpg' alt='Times Square'>", "<p class='location'>Broadway & 7th Avenue, New York, NY</p>", "<p class='description'>Famous for its bright lights, Broadway theaters, and as the site of the annual New Year's Eve ball drop.</p>", "<h2>Central Park</h2>", "<img src='../output/central_park.jpg' alt='Central Park'>", "<p class='location'>Central Park, New York, NY</p>", "<p class='description'>An urban park spanning 843 acres in the heart of Manhattan.</p>" ] )

项目结构

  • street_view_mcp/
    • __init__.py :包初始化
    • main.py :MCP 服务器的入口点
    • server.py :MCP 服务器实现
    • street_view.py :核心街景 API 客户端

重要说明

  • 本地存储:此工具将所有街景图像和 HTML 文件本地保存在output/目录中
  • 没有自动清理:没有内置机制来删除已保存的文件
  • 手动清理:您应该定期清理output/目录以管理磁盘空间
  • API 使用情况:每个图像请求都会计入您的 Google Maps API 配额,并且可能会产生费用

发展

测试

pytest

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

该服务器使 AI 模型能够获取并显示 Google 街景图像,让用户可以通过从任何地方查看街道和地标来创建虚拟游览。

  1. 与 Claude Desktop 一起使用
    1. 概述
      1. 要求
        1. 安装
          1. API 密钥设置
            1. 用法
              1. 启动 MCP 服务器
              2. 用作 CLI 工具
            2. MCP 工具
              1. get_street_view
              2. get_metadata
              3. open_image_locally
              4. create_html_page
            3. 创建虚拟旅游
              1. 项目结构
                1. 重要说明
                  1. 发展
                    1. 测试
                  2. 执照

                    Related MCP Servers

                    • -
                      security
                      A
                      license
                      -
                      quality
                      A server that provides AI-powered image generation, modification, and processing capabilities through the Model Context Protocol, leveraging Google Gemini models and other image services.
                      Last updated -
                      6
                      Python
                      MIT License
                      • Linux
                      • Apple
                    • -
                      security
                      F
                      license
                      -
                      quality
                      A server that enables AI systems to browse, retrieve content from, and interact with web pages through the Model Context Protocol.
                      Last updated -
                    • A
                      security
                      A
                      license
                      A
                      quality
                      An MCP server that creates a virtual traveling environment on Google Maps, allowing users to guide an avatar on journeys with photo reports and SNS integration.
                      Last updated -
                      2
                      140
                      11
                      TypeScript
                      MIT License
                      • Linux
                      • Apple
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A server that enables AI models to access Kakao Map features (place search, address lookup, route finding) and Daum search services (web, image, blog, cafe) through Model Context Protocol.
                      Last updated -
                      3
                      TypeScript
                      MIT License

                    View all related MCP servers

                    ID: cbxo866pjw