
Recraft MCP Server

2025.03.19
2
TypeScript图像生成AI 服务内容生成
Recraft MCP Server 是一个基于 Model Context Protocol (MCP) 的服务实现,用于与 Recraft.ai 服务集成。该服务器使 AI 助手能够通过 MCP 框架使用 Recraft 的 API 生成图像。
View on GitHub
Overview
基本能力
产品定位
Recraft MCP Server 是一个基于 Model Context Protocol (MCP) 的服务实现,用于与 Recraft.ai 服务集成。该服务器使 AI 助手能够通过 MCP 框架使用 Recraft 的 API 生成图像。
核心功能
- 实现 Recraft 图像生成服务的 MCP 工具
- 使用 Zod 进行类型安全的模式验证
- 支持多种图像生成选项(样式、大小等)
- 轻松集成支持 MCP 的 LLM 助手
适用场景
- AI 助手需要生成图像的场景
- 需要将图像生成功能集成到现有 MCP 框架中的场景
- 需要类型安全验证的图像生成服务
工具列表
generate_image
: 从文本提示生成图像image_to_image
: 基于文本提示转换现有图像inpaint_image
: 使用掩码编辑图像的部分replace_background
: 替换图像的背景vectorize_image
: 将光栅图像转换为矢量格式remove_background
: 从图像中移除背景crisp_upscale
: 以增强的细节和清晰度放大图像creative_upscale
: 以创意增强放大图像create_style
: 基于参考图像创建新样式get_user_info
: 检索当前用户的信息save_image_to_disk
: 将生成的图像保存到本地文件系统
常见问题解答
- 如何获取 Recraft API 密钥? 从 recraft.ai 获取 API 密钥。
- 如何验证服务器是否正常运行?
使用
npm run inspect
命令检查服务器状态。
使用教程
使用依赖
- Node.js (v18 或更高版本推荐)
- 从 recraft.ai 获取 Recraft API 密钥
安装教程
- 克隆仓库:
bash git clone https://github.com/yourusername/recraft-mcp-server.git cd recraft-mcp-server
- 安装依赖:
bash npm install
- 复制环境文件并配置 API 密钥:
bash cp .env.example .env
然后编辑.env
文件并添加您的 Recraft API 密钥。
调试方式
- 启动服务器:
bash npm start
或使用提供的 shell 脚本:bash ./start-mcp.sh
- 开发模式:
bash npm run dev
- 检查服务器状态:
bash npm run inspect
- 运行测试:
bash npm test
- 运行带覆盖率的测试:
bash npm run test:coverage
- 测试观察模式:
bash npm run test:watch