Google AI Edge Gallery Video MCP Server
# Google AI Edge Gallery Video MCP Server ๐ฌ๐ฑ
[](https://github.com/hayhihey/google-ai-edge-gallery-video-mcp/actions/workflows/ci.yml)
[](LICENSE)
[](#supported-platforms)
[](https://modelcontextprotocol.io)
A high-performance **Model Context Protocol (MCP)** server enabling AI agents (Claude Desktop, Cursor, Antigravity, LLM frontends) to direct, generate, and compile on-device videos using the **Google AI Edge Gallery** ecosystem (`google-ai-edge/gallery`).
Built from the ground up to **run natively on Android devices (via Termux)**, through an **ADB Bridge (USB or Wi-Fi)**, or as a **Standalone Desktop Engine**, with automatic synchronization to Android's **DCIM / Google Photos Gallery** and hardware-aware battery & thermal throttling protection.
---
## ๐ Key Highlights
- **On-Device Edge Video Generation**: Turn raw prompts and narrative ideas into complete, multi-scene video stories with cinematic keyframes, camera motions, color grades, and audio score.
- **Native Android & Termux Support**: Zero native C++ compilation hassles. One-line installer on Termux with automatic storage permissions and Android MediaStore scanning.
- **ADB Host-to-Device Bridge**: Run the MCP server on your PC/Mac while seamlessly streaming and indexing generated videos directly onto a connected Android smartphone.
- **Hardware-Aware Telemetry**: Monitors Android battery charge, device temperature, and thermal throttling states to automatically adapt video resolution (720p vs 1080p) and frame rates.
- **Google AI Edge Gallery Integration**: Built to interface with models supported by Google AI Edge Gallery (Gemma 2, Gemma 3n, MobileDiffusion, MediaPipe tasks).
- **Instant MediaStore Registration**: Broadcasts `ACTION_MEDIA_SCANNER_SCAN_FILE` intents so exported videos immediately appear in the phone's native Gallery and Google Photos.
---
## ๐๏ธ Architecture Overview
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MCP Client โ
โ (Claude Desktop / Cursor / Antigravity) โ
โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโ
โ JSON-RPC (stdio / SSE)
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Google AI Edge Gallery Video MCP Server โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Core Engine โ Android Subsystem โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Storyboard Director โ โ โ Native Termux โ โ ADB Bridge โ โ
โ โ (Gemma Scene Planning & Timing) โ โ โ (On-Device Host) โ โ (Remote Device Push) โ โ
โ โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโฌโโโโโโโโโโ โโโโโโโโโโโโโฌโโโโโโโโโโโโ โ
โ โผ โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โผ โผ โ
โ โ Keyframe Generator & Styler โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ (Diffusion / Edge SVG Engine) โ โ โ Unified Device Manager โ โ
โ โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ โ โ - Battery Level & Temp Monitoring โ โ
โ โผ โ โ - Thermal Throttling Mitigation โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ MediaPipe FX & Filter Pipeline โ โ โ โ
โ โ (Ken Burns Pan/Zoom, Grade LUTs) โ โ โผ โ
โ โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โผ โ โ Gallery Sync Manager โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ - Destination: /sdcard/DCIM/GoogleEdgeAI โ โ
โ โ Hardware-Aware Video Compiler โโโผโโบ โ - MediaStore Intent Broadcast โ โ
โ โ (FFmpeg H.264 + Ambient Audio) โ โ โ - Google Photos / Gallery Auto-Indexing โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
---
## ๐ Quick Start Guide
### Option 1: Native on Android (Termux)
Run this one-line command inside [Termux](https://f-droid.org/en/packages/com.termux/):
```bash
pkg install -y curl && curl -sSL https://raw.githubusercontent.com/hayhihey/google-ai-edge-gallery-video-mcp/main/scripts/termux-install.sh | bash
```
Once installed, simply start the server:
```bash
edge-video-mcp
```
All created videos will automatically appear in your phone's Gallery under **GoogleEdgeAI** (`/sdcard/DCIM/GoogleEdgeAI`)!
---
### Option 2: Host PC with Android Phone Connected (ADB Bridge)
1. Enable **Developer Options** and **USB Debugging** (or Wireless Debugging) on your Android phone.
2. Connect your phone to your computer via USB or Wi-Fi (`adb connect <phone_ip>:5555`).
3. Clone and build the project:
```bash
git clone https://github.com/google-ai-edge/google-ai-edge-gallery-video-mcp.git
cd google-ai-edge-gallery-video-mcp
npm install
npm run build
```
4. Verify Android device connectivity:
```bash
bash scripts/adb-setup.sh
```
---
### Option 3: Desktop Standalone (No phone required)
The server automatically detects when no Android device is attached and runs the edge simulation pipeline locally on Windows, macOS, or Linux.
Prerequisite: Ensure `ffmpeg` is installed:
- **macOS**: `brew install ffmpeg`
- **Ubuntu/Debian**: `sudo apt install -y ffmpeg`
- **Windows**: `winget install Gyan.FFmpeg` or `choco install ffmpeg`
```bash
git clone https://github.com/google-ai-edge/google-ai-edge-gallery-video-mcp.git
cd google-ai-edge-gallery-video-mcp
npm install
npm run build
npm start
```
---
## ๐ Connecting to MCP Clients
### Claude Desktop Configuration
Add the following to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"google-ai-edge-video": {
"command": "node",
"args": [
"/path/to/google-ai-edge-gallery-video-mcp/dist/index.js"
],
"env": {
"EDGE_MCP_OUTPUT_DIR": "/path/to/custom/output"
}
}
}
}
```
*On Windows, use escaped backslashes: `C:\\Users\\<Username>\\...\\dist\\index.js`*
---
## ๐ ๏ธ MCP Tools Reference
| Tool Name | Parameters | Description |
| :--- | :--- | :--- |
| `edge_video_create` | `prompt`, `title?`, `aspectRatio` (9:16, 16:9, 1:1), `targetDurationSeconds`, `style`, `addBackgroundScore`, `applyMotionFx`, `exportToAndroidGallery` | **Full end-to-end video synthesis pipeline**. Directs scenes, synthesizes keyframes, applies camera motions & color grading, encodes MP4, and indexes in Android Gallery. |
| `edge_storyboard_plan` | `prompt`, `title?`, `aspectRatio`, `targetDurationSeconds`, `shotsCount?` | Directs multi-shot scene breakdowns, camera motions (`zoom_in`, `pan_right`, `tilt_up`), transitions, and captions. |
| `edge_generate_keyframes` | `storyboard` | Generates high-fidelity keyframe image assets for each scene. |
| `edge_apply_video_fx` | `motion`, `colorGrade`, `aspectRatio`, `durationSeconds`, `fps` | Generates hardware-optimized filtergraphs for Ken Burns motions, vignette, and cinematic color palettes. |
| `edge_compile_video` | `storyboard`, `outputFileName?`, `addBackgroundScore`, `applyMotionFx`, `exportToAndroidGallery` | Low-level assembler for stitching shot clips, transitions, and audio beds into an H.264 MP4. |
| `android_device_status` | *(None)* | Inspects real-time battery charge, temperature, thermal throttling state, and acceleration delegates. |
| `android_gallery_export` | `videoFilePath`, `customTitle?` | Moves any video into `/sdcard/DCIM/GoogleEdgeAI` and broadcasts Android's `MEDIA_SCANNER_SCAN_FILE` intent. |
| `edge_models_manager` | `action` (`list`, `get_recommended`), `task?` | Catalogs models compatible with Google AI Edge Gallery (Gemma 2, Gemma 3n, MobileDiffusion, MediaPipe). |
---
## ๐ฆ MCP Resources & Prompts
### Resources
- `edge://device/telemetry`: Real-time hardware telemetry (battery, temperature, storage, encoder support).
- `edge://gallery/videos`: Catalog of generated video files with sizes and timestamps.
- `edge://models/inventory`: List of edge models available on device.
### Prompts
- `ai_video_director`: Creative director persona to brainstorm screenplays tailored to edge constraints.
- `social_shorts_creator`: High-engagement 9:16 vertical short template designed for TikTok, Reels, and Shorts.
---
## ๐งช Testing & Verification
Run the comprehensive unit test suite:
```bash
npm test
```
Test coverage includes:
- Storyboard director planning across aspect ratios (9:16, 16:9, 1:1).
- Mobile-constrained thermal throttling logic.
- Procedural SVG keyframe rendering and XML escaping.
- Ken Burns motion expressions and color grading filtergraphs.
- Unified device detection (Termux / ADB / Local).
---
## ๐ณ Docker Deployment
A lightweight multi-stage Docker image with built-in FFmpeg and Android tools:
```bash
# Build and run with docker compose
docker compose up -d
# Or run directly with docker
docker build -t edge-video-mcp .
docker run --rm -v $(pwd)/output:/app/output edge-video-mcp
```
---
## ๐ข Deploying to GitHub
To publish this repository to your GitHub account:
```bash
# 1. Initialize git repository
git init -b main
# 2. Add files and make initial commit
git add .
git commit -m "feat: initial release of Google AI Edge Gallery Video MCP Server"
# 3. Create a new repository on GitHub (e.g. google-ai-edge-gallery-video-mcp)
# 4. Link remote and push:
git remote add origin https://github.com/<your-username>/google-ai-edge-gallery-video-mcp.git
git push -u origin main
```
The pre-configured **GitHub Actions CI/CD workflows** (`.github/workflows/ci.yml` and `release.yml`) will automatically:
- Run automated tests across Ubuntu and Windows on Node.js 18, 20, and 22.
- Package releases upon pushing tags (e.g. `git tag v1.0.0 && git push origin v1.0.0`).
---
## ๐ License
Licensed under the [Apache License, Version 2.0](LICENSE).
TDQS
Scored across 8 tools
edge_video_create is an end-to-end pipeline that subsumes the individual step tools (edge_storyboard_plan, edge_generate_keyframes, edge_apply_video_fx, edge_compile_video), and its gallery-sync step overlaps with android_gallery_export. The modular vs. monolithic paths are explicitly described, so an agent can reason about it, but boundaries remain blurry.
Names are readable snake_case with thematic prefixes (edge_/android_), but the verb/noun ordering is mixed: edge_video_create and edge_storyboard_plan are noun_verb while edge_generate_keyframes, edge_apply_video_fx, and edge_compile_video are verb_noun. The two-domain prefix scheme is a reasonable choice but not fully predictable.
Eight tools is a well-scoped set for a video-generation pipeline, covering planning, keyframes, FX, compile, orchestration, export, device status, and model management without obvious padding.
The surface covers the full prompt-to-MP4 lifecycle plus device/export/model management. Minor gaps exist: edge_compile_video references audio but there is no audio-generation tool, and there is no cleanup/delete for produced assets.