mcpField
M
Mcp Recraft Server

Mcp Recraft Server

本地服务
github.com/recraft-ai媒体与设计6015 周前更新

关于 Mcp Recraft Server

Recraft MCP Server 是 Recraft API 的 MCP 服务实现,可在 MCP 客户端中完成栅格与矢量图像的生成、编辑和处理。该项目已弃用,官方建议改用 Recraft 远程 MCP 服务。

主要功能

  1. 01栅格与矢量图像生成及图像到图像编辑
  2. 02自定义风格创建与应用
  3. 03图像矢量化
  4. 04背景移除与背景替换
  5. 05栅格图像放大(Crisp 与 Creative)
  6. 06查询用户信息与剩余额度

适用场景

  1. 01在 Claude Desktop 中生成并编辑矢量图标或插画
  2. 02批量移除或替换产品图片背景
  3. 03放大低分辨率图像用于印刷或展示

MCP 相关

该服务以 MCP 服务的形式向 MCP 客户端提供 Recraft 图像相关工具,包括生成、编辑、矢量化、背景处理和放大。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"recraft-server": {
"command": "npx",
"args": [
"-y",
"@recraft-ai/mcp-recraft-server"
],
"env": {
"RECRAFT_API_KEY": "<RECRAFT_API_KEY>",
"IMAGE_STORAGE_DIRECTORY": "<IMAGE_STORAGE_DIRECTORY>",
"RECRAFT_REMOTE_RESULTS_STORAGE": "<RECRAFT_REMOTE_RESULTS_STORAGE>"
}
}
}
}
启动命令npx -y @recraft-ai/mcp-recraft-server
需要配置的环境变量
RECRAFT_API_KEY密钥
IMAGE_STORAGE_DIRECTORY
RECRAFT_REMOTE_RESULTS_STORAGE

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npm@recraft-ai/mcp-recraft-server

工具

9

收录的工具列表 · 更新于 3 周前

参数类型必填说明
promptstring是要生成的图像的文本提示词。 长度应为 1 到 1024 个字符。
sizeenum否图像尺寸。默认值为 1024x1024。1024x1024 | 1365x1024 | 1024x1365 | 1536x1024 | 1024x1536 | 1820x1024 | 1024x1820 | 1024x2048 | 2048x1024 | 1434x1024 | 1024x1434 | 1024x1280 | 1280x1024 | 1024x1707 | 1707x1024
styleenum否要应用的视觉风格。默认值为 realistic_image。 仅当需要优化图像生成时才使用此参数。 与 styleID 互斥,不能同时指定两者。 两个模型均支持 realistic_image、digital_illustration、vector_illustration;但 icon 仅适用于 recraftv2,logo_raster 仅适用于 recraftv3。 如果指定的风格不适用于所选模型,生成将失败。 风格用途: - realistic_image:用于写实图像、照片、人像、风景等。生成光栅图像。 - digital_illustration:用于数字插画、概念艺术、奇幻艺术等。生成光栅图像。 - vector_illustration:用于矢量插画、徽标、图标等。生成矢量图像。 - icon:用于图标、小型图形(仅限 recraftv2)。生成矢量图像 - logo_raster:用于平面设计、光栅徽标、海报、徽章和标牌(仅限 recraftv3)。生成光栅图像。digital_illustration | icon | realistic_image | vector_illustration | logo_raster
substyleenum否要应用的视觉子风格。仅当同时指定 style 时才能指定,可用于更精细地调整风格。 如果未指定此参数,模型将决定最终风格。仅当需要进一步优化图像生成时才使用此参数。如果没有特定要求,无需指定。 请注意,每种模型和风格组合都有各自可用的子风格列表: - recraftv3,style 为 realistic_image:b_and_w, enterprise, evening_light, faded_nostalgia, forest_life, hard_flash, hdr, motion_blur, mystic_naturalism, natural_light, natural_tones, organic_calm, real_life_glow, retro_realism, retro_snapshot, studio_portrait, urban_drama, village_realism, warm_folk - recraftv2,style 为 realistic_image:b_and_w, enterprise, hard_flash, hdr, motion_blur, natural_light, studio_portrait - recraftv3,style 为 digital_illustration:2d_art_poster, 2d_art_poster_2, antiquarian, bold_fantasy, child_book, cover, crosshatch, digital_engraving, engraving_color, expressionism, freehand_details, grain, grain_20, graphic_intensity, hand_drawn, hand_drawn_outline, handmade_3d, hard_comics, infantile_sketch, long_shadow, modern_folk, multicolor, neon_calm, noir, nostalgic_pastel, outline_details, pastel_gradient, pastel_sketch, pixel_art, plastic, pop_art, pop_renaissance, seamless, street_art, tablet_sketch, urban_glow, urban_sketching, young_adult_book, young_adult_book_2 - recraftv2,style 为 digital_illustration:2d_art_poster, 2d_art_poster_2, 3d, 80s, engraving_color, glow, grain, hand_drawn, hand_drawn_outline, handmade_3d, infantile_sketch, kawaii, pixel_art, plastic, psychedelic, seamless, voxel, watercolor - recraftv3,style 为 vector_illustration:bold_stroke, chemistry, colored_stencil, cosmics, cutout, depressive, editorial, emotional_flat, engraving, line_art, line_circuit, linocut, marker_outline, mosaic, naivector, roundish_flat, seamless, segmented_colors, sharp_contrast, thin, vector_photo, vivid_shapes - recraftv2,style 为 vector_illustration:cartoon, doodle_line_art, engraving, flat_2, kawaii, line_art, line_circuit, linocut, seamless - recraftv2,style 为 icon:broken_line, colored_outline, colored_shapes, colored_shapes_gradient, doodle_fill, doodle_offset_fill, offset_fill, outline, outline_gradient, pictogram - recraftv3,style 为 logo_raster:emblem_graffiti, emblem_pop_art, emblem_punk, emblem_stamp, emblem_vintage 如果指定的子风格不适用于指定的模型和风格,生成将失败。2d_art_poster | 3d | 80s | glow | grain | hand_drawn | infantile_sketch | kawaii | pixel_art | psychedelic | seamless | voxel | watercolor | broken_line | colored_outline | colored_shapes | colored_shapes_gradient | doodle_fill | doodle_offset_fill | offset_fill | outline | outline_gradient | cartoon | doodle_line_art | engraving | flat_2 | line_art | linocut | b_and_w | enterprise | hard_flash | hdr | motion_blur | natural_light | studio_portrait | line_circuit | 2d_art_poster_2 | engraving_color | hand_drawn_outline | handmade_3d | plastic | pictogram | antiquarian | bold_fantasy | child_book | cover | crosshatch | digital_engraving | expressionism | freehand_details | grain_20 | graphic_intensity | hard_comics | long_shadow | modern_folk | multicolor | neon_calm | noir | nostalgic_pastel | outline_details | pastel_gradient | pastel_sketch | pop_art | pop_renaissance | street_art | tablet_sketch | urban_glow | urban_sketching | young_adult_book | young_adult_book_2 | evening_light | faded_nostalgia | forest_life | mystic_naturalism | natural_tones | organic_calm | real_life_glow | retro_realism | retro_snapshot | urban_drama | village_realism | warm_folk | bold_stroke | chemistry | colored_stencil | cosmics | cutout | depressive | editorial | emotional_flat | marker_outline | mosaic | naivector | roundish_flat | segmented_colors | sharp_contrast | thin | vector_photo | vivid_shapes | emblem_graffiti | emblem_pop_art | emblem_punk | emblem_stamp | emblem_vintage
styleIDstring否要应用的风格 ID。与 style 互斥,不能同时指定两者。 此 ID 可以是 recraft.ai 上的风格 ID,也可以是之前创建的自定义风格。
modelenum否要使用的模型版本。默认值为 recraftv3。 - recraftv3 是最新模型,大多数情况下应使用此模型。 - recraftv2 是上一代模型,生成成本略低。 如果指定了风格,请确保模型与风格兼容,否则生成将失败。recraftv3 | recraftv2
numberOfImagesinteger否要生成的图像数量。应为 1 到 6。默认值为 1。

详细介绍

README 配图
Recraft MCP 服务

MCP Server npm version npm downloads smithery badge

注意

已弃用

此项目已弃用。 后续将不再发布更新、错误修复或安全补丁。

请改用 Recraft 远程 MCP 服务:https://mcp.recraft.ai/mcp,并参阅远程服务文档。它无需本地安装或 API 密钥——身份验证通过浏览器中的 OAuth 完成。请注意,远程 MCP 服务使用不同的额度模式。

在 Claude Code 中迁移:

claude mcp add --transport http recraft https://mcp.recraft.ai/mcp

在 Claude Desktop 中迁移:将此服务在 claude_desktop_config.json 中的配置替换为:

{
  "mcpServers": {
    "recraft": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.recraft.ai/mcp"]
    }
  }
}

对于 Cursor、VS Code 和其他 MCP 客户端,请参阅远程服务文档。

这是一个 MCP(Model Context Protocol)服务,可将 MCP 客户端与 Recraft 的栅格图像和矢量图像操作相集成:

  • 生成栅格图像和矢量图像
  • 编辑栅格图像和矢量图像
  • 创建自定义风格并按这些风格生成图像
  • 将栅格图像矢量化
  • 移除和替换背景
  • 放大栅格图像

将此 MCP 服务连接到 MCP 客户端后,你就可以使用 Recraft 生成高质量的栅格图像和矢量图像,并组合使用不同的工具。

目录

设置

前置要求

Claude Desktop 扩展

如果你使用 Claude Desktop,可以通过 Claude Desktop 扩展设置此服务。

  • 从最新版本下载 mcp-recraft-server.dxt
  • 双击该文件,使用 Claude Desktop 打开
  • 点击“安装”
  • 填写表单
  • 启用服务

在表单中粘贴你从个人资料 API 页面获取的 Recraft API 密钥。你也可以指定生成图像的本地存储路径,或选择将所有结果存储在远程位置。

如果安装遇到问题,请确认你使用的是最新版本的 Claude Desktop。

Smithery

你可以在 Smithery 上找到此 MCP 服务。如果从 Smithery 安装此 MCP,所有生成结果都会存储在远程。使用 Desktop Extensions 或 Manual Setup,可将生成结果存储在本地设备上。

手动设置

你需要在机器上运行 Node,以便在终端中运行 npx 或 node 命令。如果尚未安装 Node,可以从 nodejs.org 安装。

从 NPM 安装

修改 claude_desktop_config.json 文件,添加以下内容:

{
  "mcpServers": {
    "recraft": {
      "command": "npx",
      "args": [
        "-y",
        "@recraft-ai/mcp-recraft-server@latest"
      ],
      "env": {
        "RECRAFT_API_KEY": "<YOUR_RECRAFT_API_KEY>",
        "IMAGE_STORAGE_DIRECTORY": "<YOUR_IMAGE_STORAGE_DIRECTORY>",
        "RECRAFT_REMOTE_RESULTS_STORAGE": "<YOUR_REMOTE_RESULTS_STORAGE_INDICATOR>"
      }
    }
  }
}
从源代码安装

克隆此仓库:

git clone https://github.com/recraft-ai/mcp-recraft-server.git

在克隆的仓库目录中运行:

npm install
npm run build

修改 claude_desktop_config.json 文件,添加以下内容:

{
  "mcpServers": {
    "recraft": {
      "command": "node",
      "args": ["<ABSOLUTE_PATH_TO_CLONED_DIRECTORY>/dist/index.js"],
      "env": {
        "RECRAFT_API_KEY": "<YOUR_RECRAFT_API_KEY>",
        "IMAGE_STORAGE_DIRECTORY": "<YOUR_IMAGE_STORAGE_DIRECTORY>",
        "RECRAFT_REMOTE_RESULTS_STORAGE": "<YOUR_REMOTE_RESULTS_STORAGE_INDICATOR>"
      }
    }
  }
}

你可以指定以下参数:

  • RECRAFT_API_KEY:必填参数,你的 Recraft API 密钥。
  • IMAGE_STORAGE_DIRECTORY:可选参数,你可以指定存储所有生成图像的目录。默认目录为 $HOME_DIR/.mcp-recraft-server。如果 RECRAFT_REMOTE_RESULTS_STORAGE="1",则会忽略此参数的值。
  • RECRAFT_REMOTE_RESULTS_STORAGE:可选参数,你可以将其设为 "1",这样所有生成的图像都会存储在远程,并返回其 URL。此时也会忽略 IMAGE_STORAGE_DIRECTORY。

工具

在此 MCP 中,你可以使用以下工具:

工具名称描述参数价格
generate_image根据提示词生成栅格/矢量图像- 提示词
- 风格
- 尺寸
- 模型
- 图像数量
每张栅格/矢量图像 $0.04/$0.08
create_style根据图像列表创建一种风格- 图像列表
- 基础风格
$0.04
vectorize_image将栅格图像矢量化- 图像$0.01
image_to_image根据图像和提示词生成栅格/矢量图像- 图像
- 提示词
- 相似度强度
- 风格
- 尺寸
- 模型
- 图像数量
每张栅格/矢量图像 $0.04/$0.08
remove_background移除图像背景- 图像$0.01
replace_background根据提示词为图像生成新背景- 图像
- 背景提示词
- 风格
- 尺寸
- 模型
- 图像数量
每张栅格/矢量图像 $0.04/$0.08
crisp_upscale对图像进行清晰放大- 图像$0.004
creative_upscale对图像进行创意放大- 图像$0.25
get_user获取用户信息和剩余余额

你可以在 Recraft API 文档中查看工具、参数和价格的详细说明。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。