内容
# Google AI MCP
<p align="center">
<a href="https://github.com/sandraschi/google-ai-mcp/actions/workflows/ci.yml"><img src="https://github.com/sandraschi/google-ai-mcp/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
<a href="https://github.com/PrefectHQ/fastmcp"><img src="https://img.shields.io/badge/FastMCP-3.2-7c5cfc?style=flat-square" alt="FastMCP"></a>
<a href="https://python.org"><img src="https://img.shields.io/badge/Python-3.12+-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python"></a>
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"></a>
<a href="https://vitejs.dev"><img src="https://img.shields.io/badge/Vite-11015-646CFF?style=flat-square&logo=vite&logoColor=white" alt="Vite"></a>
<a href="https://ai.google.dev"><img src="https://img.shields.io/badge/Google_AI-Gemini-4285F4?style=flat-square&logo=google&logoColor=white" alt="谷歌 AI"></a>
<a href="https://www.docker.com"><img src="https://img.shields.io/badge/Docker-ready-2496ED?style=flat-square&logo=docker&logoColor=white" alt="Docker"></a>
<a href="https://github.com/casey/just"><img src="https://img.shields.io/badge/just-ready_to_go-7c5cfc?style=flat-square&logo=just&logoColor=white" alt="Just"></a>
<a href="https://playwright.dev"><img src="https://img.shields.io/badge/E2E-Playwright-45ba4b?style=flat-square&logo=playwright&logoColor=white" alt="Playwright"></a>
</p>
FastMCP 3.2 统一网关,用于 **谷歌 AI 云服务** 和 **本地 LeWorldModel(LeWM)** 桥接。聊天、图像、视频、音乐、语音、嵌入 — 以及通过本地 lewm-mcp 代理的世界模型规划。
## 快速开始
```powershell
# 安装依赖
uv sync --extra test --extra dev
npm --prefix webapp ci
# 启动后端 + 前端
.\start.ps1
# E2E 审计(无头,零点击)
just e2e
```
- 前端:http://127.0.0.1:11015
- 后端 API:http://127.0.0.1:11014
- API 文档:http://127.0.0.1:11014/api/docs
- MCP HTTP:http://127.0.0.1:11014/mcp
## 服务
| 服务 | 模型 | 要求 |
|---|---|---|
| 聊天 | Gemini 3.1 Pro, Gemma 4 | GOOGLE_API_KEY |
| 图像 | Nano Banana 2 / Pro | GOOGLE_API_KEY |
| 视频 | Veo 3.1 预览版 | GOOGLE_CLOUD_PROJECT |
| 音乐 | Lyria 3 Pro / Clip | GOOGLE_CLOUD_PROJECT |
| 语音 | Gemini TTS(一次性) | GOOGLE_API_KEY |
| 嵌入 | gemini-embedding-001 | GOOGLE_API_KEY |
| **世界模型** (LeWM 桥接) | LeWorldModel JEPA | lewm-mcp on port 10927 |
所有谷歌服务在缺少凭证时均回退到模拟模式。LeWM 通过 httpx 代理到 lewm-mcp。
## 语音 vs speech-mcp
| 功能 | google-ai-mcp | [speech-mcp](https://github.com/sandraschi/speech-mcp) |
|---|---|---|
| 一次性 Gemini TTS | 是(`google_ai_speech`, `/speech` UI) | 是 |
| Gemini Live(WebSocket) | **否** — 仅限链接 | 是 |
| 流式 STT / Chirp / FunASR | **否** | 是 |
| ElevenLabs / 车队语音工具 | **否** | 是 |
使用 **google-ai-mcp** 进行多模态谷歌 AI(聊天、图像、视频、音乐、Omni、嵌入)。在需要实时语音代理时运行 **speech-mcp** — 不要在此处重复该堆栈。
## MCP 工具(11)
| 工具 | 操作 |
|---|---|
| `google_ai_chat` | 聊天,列出模型 |
| `google_ai_image` | 生成,列出模型 |
| `google_ai_video` | 生成,列出模型 |
| `google_ai_omni` | 生成,列出模型 |
| `google_ai_music` | 生成,列出模型 |
| `google_ai_speech` | tts,列出语音,列出模型 |
| `google_ai_embeddings` | 嵌入,列出模型 |
| `google_ai_world` | 健康,训练准备,推理准备,惊喜存根 |
| `google_ai_status` | 检查所有服务健康 |
| `show_google_ai_status_card` | 预制 UI 卡片 |
## 配置
```powershell
$env:GOOGLE_API_KEY = "your-api-key"
$env:GOOGLE_CLOUD_PROJECT = "your-project-id"
$env:LEWM_API_URL = "http://127.0.0.1:10927" # 默认此值
```
## E2E 审计
```powershell
just e2e
# 运行:清除僵尸进程 → 启动服务器 → 9 个 E2E 测试 → 控制台探测 → API 健康
# 集群审计器位于 mcp-central-docs/scripts/playwright-audit.ps1
```
## Docker
```powershell
docker compose up -d
```
## 测试
```powershell
uv run pytest tests/ -q # 17 个后端测试
npx playwright test # 9 个 E2E 测试(通过 just e2e)
```
## Claude 桌面版(MCPB)
```powershell
just mcpb-pack
# 输出:dist/google-ai-mcp.mcpb
```
将 `dist/google-ai-mcp.mcpb` 拖放到 Claude 桌面版,或:
```powershell
npx @anthropic-ai/mcpb install https://github.com/sandraschi/google-ai-mcp
```
需要 Python 3.12+ 及其依赖项(或存储库中的 `uv sync`)。设置 `GOOGLE_API_KEY` 时出现提示。
## 原生桌面版(Tauri)
```powershell
just build-native
# 安装程序:native/target/release/bundle/nsis/Google AI MCP_0.1.0_x64-setup.exe
```
将 React `dist/` + PyInstaller 后端边车捆绑。首次运行时,如果需要,从 `assets/icon.png` 生成 Tauri 图标。
## 仓库
https://github.com/sandraschi/google-ai-mcp