SG

savethepolarbears/google-photos-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

56 stars 18 forks 质量 77 趋势 34

savethepolarbears/google-photos-mcp 是从 https://github.com/savethepolarbears/google-photos-mcp. 导入的 MCP 服务器候选服务器。

概览

savethepolarbears/google-photos-mcp 是从 https://github.com/savethepolarbears/google-photos-mcp. 导入的 MCP 服务器候选服务器。

概述(AI 翻译)

一个用于谷歌相册集成的模型上下文协议(MCP)服务器,使Claude、Gemini及其他AI助手能够阅读、写作和挑选您的谷歌相册库中的照片。

✅ Picker API 支持(2025年3月+)

该服务器实现了Google Photos Picker API,即使在2025年3月31日某些库API范围被弃用后,仍提供完整的图书馆访问权限。

能力 状态 API
浏览完整照片库 ✅ Picker API
按文本/日期/类别搜索照片 ✅ 图书馆API
创建相册并上传照片 ✅ 图书馆API
访问应用创作内容 ✅ 库 API

Picker API 的工作原理

  1. 调用 create_picker_session — 返回用户在浏览器中打开的认证会话 URL(pickerUri)。
  2. 用户可交互式地从其个人 Google 相册库中选择照片和视频。
  3. 调用 poll_picker_session — 检查会话状态。当 mediaItemsSet 为真时,所选项目的 ID、文件名、MIME 类型、维度和基础 URL 会返回。
  4. 调用download_picker_media — 使用OAuth承载令牌下载认证媒体字节:

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Google Photos MCP Server

A Model Context Protocol (MCP) server for Google Photos integration, enabling Claude, Gemini, and other AI assistants to read, write, and pick photos from your Google Photos library.

✅ Picker API Support (March 2025+)

This server implements the Google Photos Picker API, providing full library access even after the March 31, 2025 deprecation of certain Library API scopes.

Capability Status API
Browse full photo library ✅ Picker API
Search photos by text/date/category ✅ Library API
Create albums & upload photos ✅ Library API
Access app-created content ✅ Library API

How the Picker API works

  1. Call create_picker_session — returns an authenticated session URL (pickerUri) that the user opens in their browser.
  2. The user interactively selects photos and videos from their entire personal Google Photos library.
  3. Call poll_picker_session — checks session status. When mediaItemsSet is true, the selected items’ IDs, filenames, MIME types, dimensions, and base URLs are returned.
  4. Call download_picker_media — downloads authenticated media bytes using OAuth bearer tokens:
    • Image downloads: Downloads original full-resolution files (=d) by default. Supports custom bounding boxes via width and height parameters (=w{width}-h{height}, range: 1–16,383 pixels). When downloadOriginal: false is supplied without explicit dimensions, defaults to =w2048-h2048 preview.
    • Video downloads: Google Photos base URLs exclusively provide high-quality transcoded MP4 streams (=dv). Unmodified original video files are not exposed via base URLs per Google API design; responses include isTranscoded: true. Video bytes can only be requested once video processingStatus is explicitly READY.
    • Session & identity validation: When specifying baseUrl alongside sessionId, the server verifies the item exists in the session. If mediaItemId is also provided, both must identify the same selected item.
    • Storage & memory safety: Media bytes can be streamed directly to disk via savePath with O(1) heap overhead (strongly recommended for large files and videos). In-memory base64 responses (includeBase64: true) are capped at 10MB to avoid process heap exhaustion (raw binary payloads exceeding ~7.5MB, which expand to >10MB in base64, are rejected with guidance to use savePath). When includeBase64: false is specified, savePath is required.
    • Origin allowlist: Enforces HTTPS and strictly restricts base URLs to official Google Photos media domains (*.googleusercontent.com, *.photos.google.com, photoslibrary.googleapis.com) to prevent SSRF and token exfiltration.
  5. Call delete_picker_session — cleans up the session after all desired media items and bytes have been retrieved.

🛡️ Security Notice: CORS Removed

CORS middleware has been removed for security (prevents drive-by attacks on localhost).

在 GitHub 查看完整 README

安装

npx -y @smithery/cli install google-photos-mcp --client claude
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "google-photos": { "command": "node", "args": ["/path/to/google-photos-mcp/dist/index.js", "--stdio"], "env": { "GOOGLE_CLIENT_ID": "your_client_id", "GOOGLE_CLIENT_SECRET": "your_client_secret", "GOOGLE_REDIRECT_URI": "http://localhost:3000/auth/callback" } } } }