agnes-image-mcp
This server provides Agnes AI image generation and local/remote image utility tools via MCP.
generate_image: Create one image from a text prompt (or reference images) with configurable size, ratio, model, and output as URL or base64.
generate_images: Batch-generate 1–10 images sequentially, with optional per-item IDs and continue-on-error behavior.
download_image: Safely download an HTTPS image to a relative path under the current working directory, with size limits and protections against unsafe URLs, internal addresses, path traversal, and overwrites.
validate_image: Validate a local image file's size and format (PNG, JPEG, GIF, WebP) without network access or file modification.
Click on "Deploy 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-image-mcp Generate an image of a sunset over the ocean"
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-image-mcp
语言:English · 简体中文
agnes-image-mcp is a Model Context Protocol (MCP) stdio server that exposes Agnes image generation and local image utilities to MCP-compatible clients. It is distributed as an npm package and requires Node.js 20 or newer.
Install and run
The package is published on npm as agnes-image-mcp. Use @latest for the current stable release, or pin a published version for reproducible deployments.
Install the latest published version globally:
npm install --global agnes-image-mcp@latest
AGNES_API_KEY=your-key agnes-image-mcpRun without a global install:
AGNES_API_KEY=your-key npx --yes agnes-image-mcp@latestFor reproducible deployments, pin the version explicitly:
AGNES_API_KEY=your-key npx --yes agnes-image-mcp@0.1.10The package is an MCP stdio server. It does not open an HTTP listener and does not make an API request until an MCP tool is called.
Related MCP server: image2-mcp
Configuration
Required environment variable:
AGNES_API_KEY: Agnes API credential. Keep it in the environment or a secret manager; never put it in source code or an MCP JSON file committed to version control.
Optional environment variable:
AGNES_MODEL: default model name. If omitted, the server usesagnes-image-2.5-flash.
The repository includes .env.example as a reference. The server reads environment variables supplied by its parent process; it does not automatically load a .env file.
Generic MCP client configuration
Add a server entry to the MCP client configuration format supported by your client. The following JSON uses the common mcpServers shape:
{
"mcpServers": {
"agnes-image": {
"command": "npx",
"args": ["--yes", "agnes-image-mcp@latest"],
"env": {
"AGNES_API_KEY": "${AGNES_API_KEY}",
"AGNES_MODEL": "agnes-image-2.5-flash"
}
}
}
}If your client does not expand ${AGNES_API_KEY}, replace it at runtime through the client's secret/environment-variable mechanism. For a global install, use "command": "agnes-image-mcp" and omit the package argument.
Shell environment examples
Bash (Linux/macOS, current shell only):
export AGNES_API_KEY='your-key'
export AGNES_MODEL='agnes-image-2.5-flash' # optional
npx --yes agnes-image-mcp@0.1.10PowerShell (Windows, current session only):
$env:AGNES_API_KEY = 'your-key'
$env:AGNES_MODEL = 'agnes-image-2.5-flash' # optional
npx --yes agnes-image-mcp@0.1.10Available tools
Version 1 exposes one tool for Agnes free-tier (default) users. All calls return a structured envelope with code, message, and data fields.
generate_images
Pass an items array: one item generates one image, multiple items run as a batch, with up to 10 items. Only prompt is required per item. size defaults to 1K, ratio defaults to 1:1, and model defaults to AGNES_MODEL or agnes-image-2.5-flash. The default user-group label is accepted as a compatibility alias for the configured model; it is not an actual model name. Use images for image-to-image or multi-image composition.
The server runs the free-tier default actual RPM limits serially: 1K=20 RPM, 2K=10 RPM, 3K=1 RPM, and 4K=1 RPM. Each generated HTTPS result is downloaded into output/ under the current working directory, then checked for response MIME type, image magic bytes, and size before the final result is reported. continueOnError defaults to false.
Version 1 does not expose output, outputPath, concurrency, or tier, and does not implement an asynchronous jobId queue. A batch of 100 1K items needs at least about five minutes from RPM capacity alone; generation, download, and retry time are additional.
Validation confirms only that the downloaded file is a supported PNG, JPEG, GIF, or WebP within the size limit. It does not assess visual quality or semantic compliance with the prompt.
Security and operational boundaries
Treat
AGNES_API_KEYas a secret. Do not paste it into prompts, logs, issue reports, or checked-in configuration.The server only performs remote generation when requested by an MCP client; download and validation run as internal steps of
generate_images.Download destinations are constrained to the current working directory, and download URL checks reject insecure schemes and private network access.
Image data supplied to generation is sent to the configured Agnes endpoint. Do not send confidential images unless your usage and provider policy allow it.
This package provides image capabilities only; it does not create stories, TTS, subtitles, videos, project files, or persistent databases.
Development
npm install
npm run typecheck
npm test
npm run build
npm pack --dry-runnpm pack --dry-run runs the prepack hook, builds dist/, and previews the exact package contents without publishing. The package allowlist contains dist, README.md, LICENSE, and CHANGELOG.md; npm also always includes package.json. Source, tests, secrets, and node_modules are excluded.
License
MIT. See LICENSE.
Available Tools
4 toolsdownload_image下载图片A
从经过安全校验的 HTTPS 公网地址下载图片到当前工作目录下的相对路径;拒绝内网地址、路径越界、链接和覆盖已有文件。
Inputs: url (required), outputPath (required), maxBytes. Returns: code, data, message
generate_image生成图片A
使用 Agnes 模型生成一张图片。支持文生图或参考图输入,可返回图片 URL 或 base64;会调用远程 Agnes API。
Inputs: size (required), prompt (required), model, ratio, +2 more. Returns: code, data, message
generate_images批量生成图片A
按顺序批量调用 Agnes 生成图片,默认遇错停止;可选择继续处理并返回每项成功、失败和跳过统计。
Inputs: items (required), concurrency, continueOnError. Returns: code, data, message
validate_image校验本地图片ARead-onlyIdempotent
读取当前工作目录下的相对路径,校验本地文件大小及 PNG、JPEG、GIF、WebP 格式,不访问网络也不修改文件。
Inputs: path (required), maxBytes. Returns: code, data, message
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: single generation, batch generation, downloading, and validating images. The singular/plural naming clearly separates generate_image from generate_images, and download/validate do not overlap with generation.
All tool names follow the same verb_noun snake_case pattern: generate_image, generate_images, download_image, validate_image. The pluralization is intentional and consistent with the batch behavior.
Four tools are well-scoped for an image generation server covering creation, batch creation, download, and validation. The count is small enough to avoid overload while providing a complete practical workflow.
The server covers the core image generation workflow: single generation, batch generation, downloading results, and validating local files. Minor gaps exist, such as no explicit image editing or metadata retrieval, but these are not essential to its stated purpose.
Maintenance
Related MCP Connectors
Image processing over MCP: compress and split images, generate images and QR codes.
Generate AI images and videos from any compatible MCP client.
Generate and edit images and generate videos with Nanobananana's remote MCP server.
1MCP server exposing the YourImageShare upload API (upload/list/delete) as tools for AI agents.
Related MCP Servers
- AlicenseAqualityBmaintenanceImage tools for coding agents: generate from text, edit one reference image, remove backgrounds, upscale 2x, and create reference-based sprite animations. The MCP server, CLI and REST API share one key, credit balance and request history. Needs a DreamLayer API key and paid credits; sprite sheets are beta.751 npmMIT
- AlicenseAqualityBmaintenanceEnables MCP clients to generate and edit images through any OpenAI-compatible image API, saving results as local files and returning absolute paths for immediate use.3MIT
- AlicenseNot gradedqualityCmaintenanceEnables coding agents and other MCP clients to generate images from text prompts and edit, restyle, or extend existing images through an OpenAI-compatible /v1/images API. Results are returned both inline as image content blocks and as files saved to disk, so agents can view and reuse them within a normal task.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables submitting image generation jobs and polling their status to retrieve generated image URLs through Streamable HTTP MCP tools.MIT