Music Media MCP Server
Enables users to generate AI-powered music videos by analyzing visual content to compose matching soundtracks using Google's Lyria model. The server automatically merges audio and media into playable video artifacts that can be rendered inline within MCP-compatible chatbots.
README
🎵 Music Media MCP Server
An MCP (Model Context Protocol) server that generates AI-powered music videos. Give it an image or video and it will analyze the visual content, compose a matching soundtrack using Google's Lyria 3 model, merge everything with FFmpeg, and return a playable video artifact.
Pipeline
Source Media (image/video URL)
→ Gemini Vision analyzes the visual content (if no prompt given)
→ Lyria 3 generates a 30-second AI music track
→ FFmpeg merges audio + media into a single .mp4
→ Uploads to Google Cloud Storage
→ Returns an HTML artifact with an inline video player
Features
- Auto music prompting — If no music description is provided, Gemini Vision analyzes the image/video and generates a fitting music prompt automatically
- Multiple media types — Supports images (.jpg, .png, .webp) and videos (.mp4, .mov)
- Smart video handling — Images loop for 30s, short videos loop to fill, long videos trim to 30s
- HTML artifact output — Returns a styled video player that MCP-compatible chatbots render inline
- Cloud Run ready — Deploys to Google Cloud Run with a single command
Prerequisites
- Python 3.10+
- FFmpeg installed and on
PATH# macOS brew install ffmpeg # Ubuntu/Debian sudo apt install ffmpeg - Google Cloud project with:
- Vertex AI API enabled (Lyria
lyria-002+ Geminigemini-2.0-flash-001) - A GCS bucket for output storage (with public read access or signed URLs)
- Application Default Credentials:
gcloud auth application-default login
- Vertex AI API enabled (Lyria
Setup
-
Clone and install:
git clone https://github.com/joshndala/music-media-mcp.git cd music-media-mcp python -m venv .venv source .venv/bin/activate pip install -e . -
Configure environment:
cp .env.example .env # Edit .env with your GCP project ID and GCS bucket name -
Set up GCS CORS (required for video playback in chatbot artifacts):
# Create cors.json echo '[{"origin":["*"],"method":["GET"],"responseHeader":["Content-Type","Content-Length","Range"],"maxAgeSeconds":3600}]' > cors.json gsutil cors set cors.json gs://YOUR_BUCKET_NAME
Running Locally
# stdio transport (for Claude Desktop and other MCP desktop clients)
python server.py
# SSE transport (for web-based MCP clients)
python server.py --transport sse --port 8000
# Test with MCP Inspector
npx @modelcontextprotocol/inspector
# Then connect to http://localhost:8000/sse
Deploying to Cloud Run
# Build the container
gcloud builds submit \
--tag us-central1-docker.pkg.dev/YOUR_PROJECT/YOUR_REPO/music-media-server \
--project YOUR_PROJECT
# Deploy
gcloud run deploy music-media-server \
--image us-central1-docker.pkg.dev/YOUR_PROJECT/YOUR_REPO/music-media-server \
--region us-central1 \
--platform managed \
--allow-unauthenticated \
--set-env-vars "GCP_PROJECT_ID=YOUR_PROJECT,GCS_BUCKET_NAME=YOUR_BUCKET,GCP_LOCATION=us-central1" \
--memory 2Gi \
--timeout 300 \
--project YOUR_PROJECT
Your SSE endpoint will be at: https://YOUR_SERVICE_URL/sse
MCP Client Configuration
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"music-media": {
"command": "/path/to/.venv/bin/python",
"args": ["/path/to/server.py", "--transport", "stdio"],
"env": {
"GCP_PROJECT_ID": "your-project-id",
"GCS_BUCKET_NAME": "your-bucket-name",
"GCP_LOCATION": "us-central1"
}
}
}
}
Web/Chatbot (SSE)
Point your MCP client to your deployed Cloud Run URL:
https://your-service-url.run.app/sse
Tool Reference
generate_and_merge_media
| Parameter | Type | Required | Description |
|---|---|---|---|
source_media_url |
string |
✅ | Direct URL to a source image or video |
music_prompt |
string |
❌ | Music style description (auto-generated if omitted) |
Returns: A complete HTML document with an inline video player.
Example prompts:
"Upbeat electronic dance music with synth arpeggios""Calm ambient piano piece evoking a misty morning""Cinematic orchestral score with soaring strings"- (omit for automatic AI analysis)
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
GCP_PROJECT_ID |
✅ | — | Google Cloud project ID |
GCS_BUCKET_NAME |
✅ | — | GCS bucket for video uploads |
GCP_LOCATION |
❌ | us-central1 |
Vertex AI region |
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。