Flow2API MCP Server
Provides tools for generating images using OpenAI-compatible APIs, including model selection, image-to-image transformations, and local caching of results.
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., "@Flow2API MCP ServerGenerate a fantasy landscape with mountains and a river."
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.
Flow2API MCP Server
把 Flow2API / OpenAI-compatible 图片上游封装成 MCP 服务。
当前只支持生图相关能力,不支持视频生成功能。
推荐部署方式只有两种:
本机常驻 HTTP:适合 Cherry Studio 和本机客户端,入口通常是
http://127.0.0.1:8866/mcpDocker / 远程部署:适合长期挂着,或从别的设备访问
先记 3 个地址
用途 | 默认示例 | 说明 |
上游 API |
|
|
MCP HTTP |
| 客户端真正要连接的 MCP 地址 |
缓存图片 |
| 返回给客户端的稳定图片地址 |
Related MCP server: gpt-image-2-mcp
核心能力
模型列表、默认模型、模型选型提示全部由
mcp_server/models.json控制提供
generate、history、cache三个工具可把上游临时图片链接缓存到本地,再通过 HTTP 稳定访问
支持
history_id、use_latest_user_image、image_url三种图生图参考图来源,依次是历史结果、用户上传图、外部 URL。
部署差异
最重要的其实只有这 3 条:
文生图最简单,所有部署方式都能用
基于历史结果继续改图,也就是
history_id,所有部署方式都能用基于用户上传图改图,也就是
use_latest_user_image=true,只有 MCP 进程能直接读到附件目录时才可用;远程没挂载共享目录时,要先把图片传到图床或其他可访问 URL,再改用image_url
快速开始
1. 安装依赖
git clone https://github.com/Barometer-2002/flow2api-mcp.git
cd flow2api-mcp
python -m pip install -r requirements.txt2. 推荐直接写 .env
本机启动最省事的方式,是直接从示例复制一份 .env:
cp .env.example .envPowerShell:
Copy-Item .env.example .env然后按你的实际参数修改 .env:
FLOW2API_BASE_URL=http://127.0.0.1:8000
FLOW2API_API_KEY=your-api-key
FLOW2API_MCP_URL_CACHE=1
# FLOW2API_MCP_IMAGE_DIR=%APPDATA%\CherryStudio\Data\Files已存在的系统环境变量优先级更高,不会被 .env 覆盖。
如果你只是临时测试,也可以直接设系统环境变量。PowerShell 不要用 export,而要写成:
$env:FLOW2API_BASE_URL="http://127.0.0.1:8000"
$env:FLOW2API_API_KEY="your-api-key"常用补充:
变量 | 什么时候用 | 说明 |
| 推荐开启 | 让返回结果先落到本地缓存,避免直接依赖上游临时 URL |
| 要读本地附件时 | 比如 Cherry Studio 附件目录 |
| Docker / 远程部署时 | 把缓存地址改成客户端可访问的外部地址,通常和 MCP HTTP 同主机同端口 |
3. 选择一种启动方式
方式 A:本机常驻 HTTP
这是推荐的本机部署方式。先准备好 .env,然后启动。上游 API 继续用 8000,MCP 与缓存图都走 8866:
python -m mcp_server --host 127.0.0.1 --port 8866MCP 地址:
http://127.0.0.1:8866/mcp缓存图地址:
http://127.0.0.1:8866/mcp-cache/<hash>.jpg方式 B:Docker / 远程部署
docker compose 默认会读取项目根目录的 .env。如果你本机已经在用这一份 .env,Docker 通常不需要再配第二套:
FLOW2API_BASE_URLFLOW2API_API_KEYFLOW2API_MCP_URL_CACHEFLOW2API_MCP_IMAGE_DIR
同机测试时,通常只需要保持或补上:
FLOW2API_MCP_EXTERNAL_URL_PREFIX=http://127.0.0.1:8866从 docker-compose.example.yml 复制出来的本机 docker-compose.yml 会直接复用本机版本正在使用的运行时文件:
data/url_cache/data/history.jsondata/history_archive.json
也就是说,本机模式下已经生成过的缓存图,切到 Docker 后默认还能继续访问同一个 mcp-cache 链接。
如果你之前的旧版本把运行时数据放在 mcp_server/ 下,升级后请手动复制到 data/:
mcp_server/history.json->data/history.jsonmcp_server/history_archive.json->data/history_archive.jsonmcp_server/url_cache/->data/url_cache/mcp_server/url_cache.json->data/url_cache.json
先复制一份 Docker 示例文件:
cp docker-compose.example.yml docker-compose.ymlPowerShell:
Copy-Item docker-compose.example.yml docker-compose.yml然后启动:
docker compose up -d --buildMCP 地址:
http://<server>:8866/mcp如果客户端和容器不在同一台机器,通常还要加:
FLOW2API_MCP_EXTERNAL_URL_PREFIX=http://<server>:8866客户端配置
Cherry Studio
推荐直接连本地 HTTP MCP:
配置项 | 建议值 |
类型 |
|
URL |
|
超时 | 建议 |
其他 HTTP MCP 客户端
直接填 MCP URL:
本机常驻 HTTP:
http://127.0.0.1:8866/mcpDocker / 远程部署:
http://<server>:8866/mcp
如果图片能生成,但客户端里打不开,优先检查:
是否开启了
FLOW2API_MCP_URL_CACHE=1当前是否确实在跑
python -m mcp_server --host ... --port ...Docker / 跨机器访问时是否设置了
FLOW2API_MCP_EXTERNAL_URL_PREFIX
下一步
This server cannot be deployed
Maintenance
Related MCP Connectors
Focused MCP server for OpenAI image/audio generation (v2.0.0). Wraps endpoints via HAPI CLI.
Multi-model AI image and video generator. 14 models behind one OAuth-secured MCP endpoint.
Generate AI images and videos from any compatible MCP client.
Generate images with any major model — one API key, one prepaid balance, one MCP.
Related MCP Servers
- FlicenseAqualityAmaintenanceWraps the Micu image API as an MCP server for generating, editing, batch processing, and multi-reference image fusion, supporting GPT-image-2 and Grok models.592-
- AlicenseAqualityBmaintenanceExposes OpenAI's gpt-image-2 (image generation and editing) as an MCP server for tools like generate_image, edit_image, and iterative edit sessions.621 npm11MIT
- FlicenseAqualityCmaintenanceWraps Google Gemini's image generation API as an MCP server, enabling text-to-image, image editing, and grounded search workflows from any MCP client.2-
- AlicenseNot gradedqualityBmaintenanceEnables AI image generation from text prompts by wrapping local ComfyUI as a Streamable HTTP MCP server, supporting synchronous generation, queue management, and history tracking.1MIT