Agnes Media MCP
{
"answer": "This server provides AI-powered image and video generation tools through the Agnes AI API, powered by the Image 2.1 Flash model.\n\nImage Generation:\n- agnes_image_generate: Text-to-image or image-to-image generation with exact pixel dimensions (e.g., 1024x1024, 1024x768). Supports passing image URLs for img2img.\n- agnes_image_generate_v2: High-resolution, high-information-density image generation using tiered sizes (1K–4K) combined with aspect ratios (1:1, 16:9, 9:16, 3:4, etc.). Also supports image-to-image.\n- agnes_image_edit: Edit or compose multiple images together via text prompts and reference images (local file paths or public URLs).\n\nVideo Generation:\n- agnes_video_submit: Submit a video generation task (text-to-video, image-to-video, or keyframe animation), returning a video_id for polling. Automatically aligns frames to the 8n+1 rule.\n- agnes_video_status: Query the current status of a video task by video_id.\n- agnes_video_wait: Poll a video task until completion, failure, or timeout, with configurable poll interval, optionally downloading the result.\n- agnes_video_generate: Combined submit + wait in a single call — returns the final video URL and optionally saves the MP4 locally.\n\nVideo tasks support configurable duration, resolution (e.g., 720p), aspect ratio, frame rate, and negative prompts. Generated images and videos are automatically saved to specified output directories."
}
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Agnes Media MCPGenerate a 2K image of a cyberpunk city at night, 16:9"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Agnes Media MCP
基于 FastMCP 的 Agnes 图像与视频生成 MCP 服务器(国内版)。
国内版 / 国际版说明: 本文档以国内版(
https://api.agnes-ai.cn/v1)为例。国际版请将AGNES_BASE_URL设置为https://apihub.agnes-ai.com/v1;请求参数和用法基本一致。⚠️ 注意:两个平台的账号不互通,API Key 不共用。 国内版 Key 无法在国际版端点使用,反之亦然。切换端点时必须在对应平台单独申请 Key。
本服务通过环境变量读取凭据,请勿将真实 API Key 放入版本控制文件。
这是什么?
本项目由两部分组成,配套使用:
组件 | 文件 | 作用 |
MCP Server |
| 执行层——接收工具调用,请求 Agnes API,保存生成结果 |
Skill |
| 决策层——告诉 AI Agent 何时激活、选哪个工具、如何构造 Prompt、如何展示结果 |
简单说:Skill 是大脑,MCP 是双手。只装 MCP 不装 Skill,Agent 不知道何时该调用这些工具;只装 Skill 不装 MCP,Agent 知道该做什么但没有工具可用。
Related MCP server: laozhang-image MCP
工作流程
流程概览:
用户请求 ─→ [② 包含 "agnes"?] ─否─→ 不激活,交给其他工具
│是
▼
③ 意图匹配 (Skill: When to Use)
│
▼
④ 决策规则 → 选择工具
├─ 标准图像 → agnes_image_generate
├─ 高分辨率 → agnes_image_generate_v2 (1K-4K + ratio)
├─ 图像编辑 → agnes_image_edit
└─ 视频 → agnes_video_generate / submit+wait
│
▼
⑤ 构造 Prompt + 语言策略 (auto / original / review)
│
▼
⑥ MCP Server 处理 (payload / Base64 / 8n+1)
│
▼
⑦ Agnes API (api.agnes-ai.cn/v1)
├─ 图像: 同步返回 b64_json / url
└─ 视频: video_id → 轮询 GET /agnesapi
│
▼
⑧ 保存文件 → outputs/images/ | outputs/videos/
│
▼
⑨ Agent 展示结果 (Markdown / 路径 / URL)
│
▼
⑩ 用户获得媒体文件Skill 层(②③④⑤⑨)负责触发判断、工具选择、Prompt 构造和结果展示;MCP 层(⑥⑧)负责协议适配;API 层(⑦)负责实际推理。
工具列表
工具名 | 说明 |
| 文生图 / 图生图( |
| 高信息密度图像生成( |
| 图像编辑 / 多图合成,通过 |
| 提交视频生成任务( |
| 查询视频任务状态( |
| 轮询任务直至完成、失败或超时 |
| 提交视频任务并等待完成(submit + wait 组合) |
完整安装配置指南
前提:已安装 uv(一行脚本即可安装,支持 Windows / macOS / Linux)。
第一步:安装 Skill
Skill 是一个 Markdown 文件,告诉 AI Agent 如何智能地使用本工具。将 SKILL.md 复制到你的 Agent 的 Skills 目录:
Hermes:
# 克隆仓库(或仅下载 SKILL.md)
git clone https://github.com/Ryderey/agnes-mcp-studio
# 复制 Skill 到 Hermes skills 目录
cp agnes-mcp-studio/SKILL.md ~/.hermes/skills/agnes-media-generation.md🇨🇳 国内用户: 若无法访问 GitHub,请改用 Gitee 镜像:
git clone https://gitee.com/zzol_wow/agnes-mcp-studio(内容完全一致,后文配置命令同理替换)。
Qoder / Cursor / 其他支持 Skill 的客户端:
将 SKILL.md 复制到对应的 Skills/Plugins 目录,或通过客户端的「安装 Skill」功能导入。
第二步:配置 MCP Server
在你的 Agent 配置文件中添加 MCP 服务器。
通用 JSON 格式(Claude Desktop / Cursor / Qoder):
{
"mcpServers": {
"agnes_media": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/Ryderey/agnes-mcp-studio",
"agnes-media-mcp"
],
"env": {
"AGNES_API_KEY": "your_agnes_api_key_here"
}
}
}
}🇨🇳 国内用户: 将
git+https://github.com/Ryderey/agnes-mcp-studio替换为git+https://gitee.com/zzol_wow/agnes-mcp-studio即可。
Hermes YAML 格式:
mcp_servers:
agnes_media:
command: "uvx"
args:
- "--from"
- "git+https://github.com/Ryderey/agnes-mcp-studio" # 国内用户替换为 git+https://gitee.com/zzol_wow/agnes-mcp-studio
- "agnes-media-mcp"
env:
AGNES_API_KEY: "your_agnes_api_key_here"
AGNES_OUTPUT_DIR: "/absolute/path/to/outputs"
timeout: 600
connect_timeout: 60第三步:获取 API Key
登录 Agnes AI 控制台
进入 API Key 管理页面,创建并复制 Key
将 Key 填入上一步配置中的
AGNES_API_KEY
环境变量
变量名 | 必填 | 默认值 | 说明 |
| 是 | — | Agnes AI 平台 API Key |
| 否 |
| API 基础地址(国际版为 |
| 否 |
|
|
| 否 |
|
|
| 否 |
| 视频生成默认模型 |
| 否 | 源码树: | 生成文件输出目录(建议配置绝对路径) |
本地开发模式也可将变量写入 .env 文件(参考 .env.example,启动时自动加载)。切换国内 / 国际端点时,必须同时更换为对应平台签发的 Key。
第四步:验证
重启 Agent 后,确认 MCP 服务已连接:
# Hermes
hermes mcp list
hermes mcp test agnes_media其他客户端通常在设置界面可查看 MCP 连接状态。
可选:本地开发模式
如果你想修改源码或调试:
git clone https://github.com/Ryderey/agnes-mcp-studio # 国内用户:git clone https://gitee.com/zzol_wow/agnes-mcp-studio
cd agnes-mcp-studio
uv sync
cp .env.example .env # 编辑 .env 填入 API Key
uv run agnes-media-mcp可选:预装到本地(快速启动)
uvx --from git+... 首次启动需克隆仓库并安装依赖,可能耗时数十秒;若你的客户端 MCP 连接超时较短(如 WorkBuddy),建议先预装到本地:
# 一次性安装(国内用 gitee 源,海外用 github 源)
uv tool install --from git+https://gitee.com/zzol_wow/agnes-mcp-studio agnes-media-mcp安装后可执行文件位于 ~/.local/bin/agnes-media-mcp(Windows:%USERPROFILE%\.local\bin\agnes-media-mcp.exe),MCP 配置直接指向它,启动仅需约 2 秒:
{
"mcpServers": {
"agnes_media": {
"command": "C:\\Users\\<用户名>\\.local\\bin\\agnes-media-mcp.exe",
"args": [],
"env": {
"AGNES_API_KEY": "your_agnes_api_key_here"
}
}
}
}macOS / Linux 将
command换为~/.local/bin/agnes-media-mcp的绝对路径即可。后续升级只需重新执行uv tool install命令。
使用示例
安装配置完成后,在对话中提及 agnes 关键词即可触发。以下是实际对话示例:
Prompt 语言策略
Skill 默认在调用 Agnes 前将非英文描述优化为自然英文;这通常能让图像和视频模型更稳定地理解风格、镜头与构图。用户可随时通过自然语言覆盖默认行为:
模式 | 如何选择 | 行为 |
| 无需说明 | 自动翻译并优化为英文,不额外询问 |
| “不要翻译”“保留中文提示词” | 优化提示词,但保持原语言 |
| “先给我中英文版本选择” | 展示原文和英文版,等待用户选择后再调用 |
同一对话中明确设置的偏好会继续沿用。翻译会保留专有名词、数值、镜头要求及必须出现在画面中的原文文字;Agent 与用户的交流语言不会因此改变。
生成图像
你: 用 agnes 生成一张赛博朋克城市夜景,16:9 壁纸,2K 分辨率
Agent: 调用
agnes_image_generate_v2(size=2K, ratio=16:9)→ 返回图片文件你获得: 一张 2624×1472 的图像,保存在
outputs/images/目录
编辑图像
你: 用 agnes 把这张照片的背景换成星空,保持人物不变 [附图]
Agent: 调用
agnes_image_edit(image_paths=[你的图片], prompt=...)→ 返回编辑后的图片
生成视频
你: 用 agnes 做一个 5 秒的视频:一只猫在窗台上打盹,阳光慢慢移动
Agent: 调用
agnes_video_generate(duration=5, resolution=720p)→ 等待 30s~3min → 返回视频文件你获得: 一个 MP4 文件,保存在
outputs/videos/目录
触发规则
你说的话 | 是否触发 |
“用 agnes 画一只猫” | ✅ 触发(包含 agnes + 图像生成意图) |
“帮我生成一张图片” | ❌ 不触发(未提及 agnes) |
“agnes 是什么?” | ❌ 不触发(无生成意图) |
“AGNES generate a wallpaper” | ✅ 触发(不区分大小写) |
开发者参考
本地验证
uv run python -c "from agnes_media_mcp.server import mcp; print('import ok')"
uv run python -m pytest tests/ -vPython API 直接调用
以下为无需通过 Agent 的编程调用示例:
import asyncio
from agnes_media_mcp.server import agnes_image_generate, agnes_image_generate_v2, agnes_video_generate
# 标准图像生成
result = agnes_image_generate(
prompt="一只陶瓷咖啡杯放在钢制桌面上,柔和光线",
size="1024x1024",
)
# 高分辨率图像生成
result = agnes_image_generate_v2(
prompt="赛博朋克城市夜景,霓虹灯反射,电影质感",
size="2K",
ratio="16:9",
)
# 视频生成
result = asyncio.run(
agnes_video_generate(
prompt="缓慢推进镜头,玻璃雕塑在画廊中旋转",
duration=5,
resolution="720p",
aspect_ratio="16:9",
)
)Prompt 语言策略由 Skill 层执行。直接调用 Python API 或 MCP 工具时,
prompt会按原样发送,不会自动翻译。
agnes_video_wait和agnes_video_generate可能运行数分钟,测试时建议使用较短超时。
文档
详细 API 文档请参阅 docs/ 目录:
注意事项
Base URL 使用国内端点:
https://api.agnes-ai.cn/v1response_format必须放在extra_body内,不可置于请求体顶层图生图不使用
tags: ["img2img"],参考图通过extra_body.image传入agnes_image_generate_v2使用agnes-image-2.1-flash,支持1K–4K分级尺寸 +ratio宽高比视频
num_frames自动对齐8n+1规则(上限 441)视频状态轮询使用
video_id,端点为GET /agnesapi?video_id=<VIDEO_ID>视频结果 URL 从响应的顶层
url字段提取(实测),同时兼容metadata.url(官方文档示例)成功响应仅返回归一化关键字段,不返回完整
raw;HTTP 错误仍保留服务端响应正文mask_path参数会返回结构化不支持错误(当前文档未描述 mask 功能)超时响应包含
video_id和last_response,可稍后继续轮询
许可证
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
AlicenseAqualityBmaintenanceEnables AI agents to generate, edit, and upscale videos and images using VicSee's API, with support for multiple models and asynchronous task polling.7231MIT- AlicenseNot gradedqualityCmaintenanceEnables image generation and editing using laozhang.ai's OpenAI-compatible API, with tools for text-to-image and image-to-image transformations.MIT
- AlicenseAqualityDmaintenanceEnables image generation and editing using Volcengine Ark Doubao-Seedream models, with tools for text-to-image, image-to-image, editing, and result polling.433MIT
- AlicenseAqualityCmaintenanceEnables video generation from text prompts or images using Agnes AI's video models, with async task submission and status polling.215MIT
Related MCP Connectors
Generate, edit and upscale AI video and images from any agent via VicSee.
Create and manage cinematic AI video renders through the Future Video Studio Agent API.
Generate images, video, and audio with Glif's media-generation agent
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/Ryderey/agnes-mcp-studio'
If you have feedback or need assistance with the MCP directory API, please join our Discord server