mediamcp
教任何 AI 代理生成图像和视频
mediamcp 是一个 MCP 服务器,它将您的 AI 助手——Claude Code、Claude Desktop、 Cursor、Windsurf、VS Code 或任何其他支持 MCP 的客户端——与云端媒体模型 (Gemini Flash Image、GPT-5 Image、Seedream、Veo、Sora,……)连接起来,通过 OpenRouter 或任何兼容 OpenAI 的 API。
English | 中文
⭐ 上面的横幅由 mediamcp 自己生成——一次 generate_image 调用。
生成的文件始终保存到磁盘(默认在 ~/Pictures/mediamcp),每个响应都包含文件的绝对路径和一个小型内嵌预览——代理能立即看到生成的结果。
给 AI 代理: 专门为您优化的安装说明位于 llms-install.md。
您需要一个 OpenRouter API 密钥——可以在 https://openrouter.ai/keys 获取。
快速安装
Claude Code
claude mcp add mediamcp -e OPENROUTER_API_KEY=sk-or-v1-YOUR_KEY -- npx -y mediamcpClaude Desktop
在 claude_desktop_config.json 中添加(macOS:~/Library/Application Support/Claude/claude_desktop_config.json,Windows:%APPDATA%\Claude\claude_desktop_config.json),然后重启 Claude Desktop:
{
"mcpServers": {
"mediamcp": {
"command": "npx",
"args": ["-y", "mediamcp"],
"env": { "OPENROUTER_API_KEY": "sk-or-v1-YOUR_KEY" }
}
}
}Cursor
或者添加到 ~/.cursor/mcp.json:
{
"mcpServers": {
"mediamcp": {
"command": "npx",
"args": ["-y", "mediamcp"],
"env": { "OPENROUTER_API_KEY": "sk-or-v1-YOUR_KEY" }
}
}
}Windsurf
添加到 ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"mediamcp": {
"command": "npx",
"args": ["-y", "mediamcp"],
"env": { "OPENROUTER_API_KEY": "sk-or-v1-YOUR_KEY" }
}
}
}VS Code (GitHub Copilot)
或者添加到 .vscode/mcp.json(密钥会单独提示输入,不会写入文件):
{
"servers": {
"mediamcp": {
"command": "npx",
"args": ["-y", "mediamcp"],
"env": { "OPENROUTER_API_KEY": "${input:openrouter-key}" }
}
},
"inputs": [
{
"id": "openrouter-key",
"type": "promptString",
"password": true,
"description": "OpenRouter API key (https://openrouter.ai/keys)"
}
]
}Related MCP server: mcp-media-engine
您的代理能做什么
安装后,只需对代理说类似 “为我的落地页生成一个 16:9 的 hero 图像”、“去掉 logo.png 的背景”、“制作一个 8 秒的日落海狼视频” 或 “将 logo.png 变成 4 秒视频”(图像转视频)。代理会自动选择合适的工具:
工具 | 功能 |
| 文本 → 图像(一张或多张)。保存到磁盘,返回路径和内嵌预览。支持 |
| 现有图像(一张或多张)+ 指令 → 编辑后的图像。接受文件路径、 |
| 文本 → 视频 或图像 → 视频(异步任务,通常 1–5 分钟)。传入 |
| 通过 |
| 输出支持图像/视频的模型的 slug 和价格——代理可以自行选择模型。 |
| 诊断:密钥是否存在且有效、端点、默认值、输出目录是否可写。如果出现问题——请先运行它。 |
配置
所有配置都通过 MCP 客户端配置中 env 块的环境变量完成:
变量 | 默认值 | 用途 |
| — | 必需。 您的 OpenRouter 密钥。 |
| — |
|
|
| 任何兼容 OpenAI 的 API 的根 URL。 |
|
| 默认图像模型的 slug。 |
|
| 默认视频模型的 slug。 |
|
| 生成文件的保存位置(如果 |
|
| 单个请求的 HTTP 超时时间。 |
|
| 是否随每个结果返回内嵌预览( |
|
| 内嵌预览的长边像素值。 |
|
| 发布工具模式所用的 JSON Schema 方言。值 |
使用其他提供商
在 MEDIAMCP_BASE_URL 中指定任何兼容 OpenAI 的端点,并设置相应的密钥:
"env": {
"MEDIAMCP_BASE_URL": "https://your-endpoint.example.com/v1",
"MEDIAMCP_API_KEY": "your-key",
"MEDIAMCP_MODEL": "your/image-model"
}mediamcp 会自动检测端点支持的 API 格式:专用 /images 端点(OpenRouter)、/images/generations(经典 OpenAI)或支持图像的 chat/completions——第一个成功的选项会被记住。
问题诊断
让代理运行
check_config工具——它会报告具体哪里配置错误以及如何修复。也可以从终端运行相同的诊断:
npx -y mediamcp --check(使用您 shell 的环境变量)。常见问题:
“No API key configured” — 将
OPENROUTER_API_KEY添加到 MCP 客户端配置中服务器条目的env块(而不仅仅是 shell 配置文件),然后重启客户端。“Out of credits (HTTP 402)” — 请到 https://openrouter.ai/credits 充值余额。
“Not found (HTTP 404) … for model” — 模型 slug 不正确;请运行
list_models。客户端没有任何反应 — 请确保已安装 Node.js ≥ 20(
node --version)。“Tool '…' has an invalid outputSchema … unsupported dialect” — 客户端仅按 JSON Schema 2020-12 验证模式。mediamcp 默认发布 2020-12,因此该错误意味着版本过旧:请更新并确保
check_config显示tool schema dialect: 2020-12。
开发
git clone https://github.com/legolev/mediamcp && cd mediamcp
npm install
npm run build # сборка в dist/index.js
npm test # юнит-тесты (vitest)
npm run inspect # открыть MCP Inspector с собранным сервером许可证
mcp-name: io.github.legolev/mediamcp
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityCmaintenanceAn MCP server that exposes Fal.ai generative media models as tools for image and video generation, and running any Fal.ai model, callable by Claude and other MCP-compatible clients.3
- AlicenseAqualityBmaintenanceMCP server for AI-powered image, audio, and video generation, enabling media creation directly from Claude, Cursor, and other MCP clients.1144MIT
- AlicenseBqualityAmaintenanceProduction-grade MCP server for image and video understanding and generation across Gemini, OpenAI, and Grok.54Apache 2.0
- AlicenseAqualityCmaintenanceOpen-source MCP server for AI image and video creation, enabling prompt library search, prompt enhancement, and media generation from Claude Code, Cursor, and other MCP hosts.8MIT
Related MCP Connectors
MCP server for Clipkit — gives AI agents a video toolbox via the Clipkit schema.
MCP server for Google Veo AI video generation
MCP server for Hailuo (MiniMax) AI video generation
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/legolev/mediamcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server