Cloudflare AI Image MCP
Enables AI assistants to generate images using Cloudflare Workers AI models directly through the Model Context Protocol. It supports various models like Flux and Stable Diffusion, providing seamless image generation and storage via Cloudflare R2.
README
Cloudflare AI Image MCP
这是一个基于 Model Context Protocol (MCP) 的 Cloudflare Workers 服务,允许你通过 AI 助手(如 Claude Desktop)直接调用 Cloudflare Workers AI 的图像生成模型。
🚀 快速开始(控制台部署教程)
如果你不想使用终端命令,可以完全在 Cloudflare 浏览器控制台中完成部署:
1. 准备 Cloudflare 资源
- 登录 Cloudflare 控制台。
- 创建 R2 存储桶:
- 点击左侧菜单 "R2" -> "Create bucket"。
- 命名为
mcp-images(或者你喜欢的名字,记下它)。
- 启用 AI:
- 确保你的账户已启用 Workers AI(通常默认开启)。
2. 创建并部署 Worker
- 进入 "Workers & Pages" -> "Create application" -> "Create Worker"。
- 给你的 Worker 起个名字(例如
cloudflare-ai-image-mcp)。 - 点击 "Deploy"。
- 部署完成后,点击页面右上角的 "Edit Code" 按钮。
- 在左侧文件列表中,找到并打开
worker.js(或者index.ts)。 - 删除原有内容,将本项目 src/index.ts 中的全部代码粘贴进去。
- 点击右上角的 "Deploy" 按钮。
3. 配置绑定与变量(关键步骤)
回到该 Worker 的主页面,点击 "Settings" 选项卡:
A. 变量 (Variables)
- 找到 "Environment Variables" -> "Add variable"。
- 添加变量:
- Variable name:
PASSWORD - Value: 设置你的访问密码(用于 MCP 连接鉴权)。
- Variable name:
CUSTOM_DOMAIN(可选) - Value: 如果你绑定了自定义域名(如
mcp.example.com),请填入,否则返回的链接将使用默认的.workers.dev域名。 - 点击 "Save and deploy"。
- Variable name:
B. 绑定 (Bindings)
- 找到 "Bindings" -> "Add binding"。
- 添加 R2 Bucket 绑定:
- Service role: 选择
R2 Bucket。 - Variable name: 必须填写
IMAGES。 - R2 bucket: 选择你第一步创建的存储桶。
- Service role: 选择
- 添加 AI 绑定:
- 点击 "Add binding" -> 选择
AI。 - Variable name: 必须填写
AI。
- 点击 "Add binding" -> 选择
- 点击 "Save and deploy"。
4. 获取你的端点
你的端点 URL 格式通常为:
https://项目名.用户名.workers.dev/sse
🎨 可用模型
| 模型 ID | 描述 |
|---|---|
flux-1-schnell |
极速生成,质量上乘 |
lucid-origin |
Leonardo 出品,照片级真实感 |
phoenix-1.0 |
擅长渲染图像中的文字 |
stable-diffusion-xl-base-1.0 |
经典的 SDXL 高清生成 |
stable-diffusion-xl-lightning |
1-4 步极速出图 |
🛠️ 在 Claude Desktop 中配置
打开你的 Claude Desktop 配置文件,添加以下内容:
{
"mcpServers": {
"cloudflare-ai-image": {
"command": "curl",
"args": [
"-N",
"-H", "Authorization: Bearer 你的密码",
"https://你的项目名.你的用户名.workers.dev/sse"
]
}
}
}
📄 开源协议
Apache-2.0
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.