Kokon

io.github.GabrieleLozupone由 GitHub 账号 GabrieleLozupone 发布v0.12.0更新于 Nov 7, 2026

Generate and edit images offline with Qwen-Image 2.1 on your GPU. Needs the Kokon desktop app.

已验证STDIO仅桌面媒体与设计AI 与机器学习

概览

AI 生成的概览

Kokon 让助手通过 Kokon 桌面应用,在本机 GPU 上离线使用 Qwen-Image 2.1 生成和编辑图片。

可以做什么
  • 根据文本提示生成图片,可选最多 10 张参考图
  • 按指令编辑单张图片,或以最多 9 张其他图片辅助编辑图 1
  • 对蒙版区域进行局部重绘,并向画面外扩展
  • 放大图片(默认 2 倍,最高 8192 像素)
  • 读取图片尺寸、类型和 Kokon 生成元数据,并查看引擎状态、GPU、显存与任务队列
适用场景
适合希望助手在本地生成或修图、不依赖云端 API 的场景,例如为 README 制作主图、清理背景杂物、合成产品或人物画面、放大已有图片。
运行要求
以 npx 启动的本地 stdio 进程,需要 Node.js 22 或更高版本(也可使用应用自带的独立可执行文件)。需要 Kokon 桌面应用,首次打开并完成设置以下载模型:Windows 需 12 GB 以上显存的 GPU,或 Apple Silicon Mac 需 16 GB 以上(测试版)。无需 API 密钥,引擎在 127.0.0.1 上按需启动。可选环境变量 QLS_MCP_ALLOWED_DIRS 用于列出额外可读写文件夹。
安装前请注意
文件读写仅限项目文件夹、Kokon 输出文件夹以及 QLS_MCP_ALLOWED_DIRS 中列出的文件夹,扩大该变量会让助手访问更多磁盘内容。工具会写入新的图片文件,但不会覆盖已有文件。首次调用需约一分钟加载模型;默认不会把图片回传给模型,除非设置 include_preview。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Kokon,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

kokon-mcp

MCP server for Kokon. It lets Claude Code, Cursor, Claude Desktop and other MCP clients generate and edit images with Qwen-Image 2.1, running offline on your own GPU. No API key, no cloud. Everything stays on 127.0.0.1.

Requires the Kokon desktop app (Windows with a 12 GB+ GPU: NVIDIA, or AMD/Intel in beta; or an Apple Silicon Mac, beta, 16 GB+). Download it from kokon.app, open it once and finish the setup so the model is downloaded. This package is only the bridge between your AI agent and the app. The app doesn't need to be open: the server starts the engine on demand.

Setup

Claude Code:

bash
claude mcp add --scope user kokon -- npx -y kokon-mcp

Any client that takes the standard JSON config (.mcp.json, Claude Desktop, Cursor...):

json
{  "mcpServers": {    "kokon": {      "type": "stdio",      "command": "npx",      "args": ["-y", "kokon-mcp"]    }  }}

Needs Node.js 22 or newer. The Kokon installer also ships the same server as a standalone executable (kokon-mcp.exe / kokon-mcp inside the app), if you prefer not to use Node. See the main README.

Then ask: "Generate a hero image for this README and save it in docs/" or "Remove the background clutter from screenshot.png". The first call takes about a minute while the model loads.

Tools

Prompts are used exactly as your assistant writes them: Kokon's own prompt writer (Prompt+) does not run for MCP, so the assistant writes the full description. The tool descriptions tell it how.

ToolWhat it does
generate_imageText to image, optionally with up to 10 reference images (a person, a product, a style) in a new scene. Size chosen automatically, or set width/height or aspect ratio.
edit_imageEdit an image with an instruction. Keeps its size; never overwrites the input.
edit_imagesEdit image 1 with the help of up to 9 more images ("image 1", "image 2"...).
inpaint_imageChange only a masked area: edit, remove, replace or add something.
outpaint_imageExtend an image beyond its borders.
upscale_imageEnlarge an image (default 2x, up to 8192 px).
get_image_infoSize, type and, for Kokon images, the prompt, seed and settings.
get_generator_statusEngine state, GPU, VRAM and job queue.

Behavior and safety

  • Every result returns the absolute path of the saved file, its size, seed and metadata.
  • Reads and writes are limited to the project folder (CLAUDE_PROJECT_DIR or the working directory), Kokon's output folder and folders listed in QLS_MCP_ALLOWED_DIRS (separated by semicolons). Existing files are never overwritten.
  • Images are not sent back to the model by default. Pass include_preview: true for a small JPEG.
  • Progress is reported through MCP progress notifications.

License

AGPL-3.0-only. The Qwen-Image 2.1 model weights the app downloads are under the Qwen Research License (non-commercial). Source: github.com/GabrieleLozupone/kokon.

来源:mcp/README.md,提交 e411d96

工具

8

generate_image

Generate image

Generate an image from a text prompt with the local Qwen-Image 2.1 model, optionally using reference images (a person, a product, a style) in a new scene. Write the full, detailed prompt yourself (see the prompt field): it is used as is. Dimensions are chosen automatically (aspect ratio can be inferred from the prompt, e.g. '16:9 hero image') unless width/height or aspect_ratio are given. Returns the absolute path of the saved PNG. Runs fully offline; typically 45 s–4 min.

输入参数seedwidthheightprompt必填qualityoutput_pathaspect_ratioinclude_previewreference_images

edit_image

Edit image

Edit an existing image with a natural-language instruction (e.g. 'make the background nighttime, keep the foreground unchanged'). Preserves the input's width, height and aspect ratio by default. The input file is never overwritten.

输入参数seedprompt必填qualityimage_path必填output_pathinclude_previewpreserve_dimensions

edit_images

Edit with multiple references

Edit image 1 with the help of other images (up to 10 in all) and an instruction, e.g. put the product from image 2 in the hand of the person in image 1. Order matters: refer to them as image 1, image 2, ... in the prompt. The output follows image 1's aspect ratio unless width/height or aspect_ratio are given. For a new scene that only uses the images as references, use generate_image with reference_images.

输入参数seedwidthheightprompt必填qualityimage_paths必填output_pathaspect_ratioinclude_preview

outpaint_image

Expand image (outpaint)

Extend an image beyond its borders. Give the expansion per side in pixels or percent; the canvas, mask and model-aligned sizes are built automatically and the original pixels are preserved exactly.

输入参数topleftseedrightunitsbottomprompt必填qualityimage_path必填output_pathinclude_preview

inpaint_image

Inpaint image

Change only the masked area of an image (mask: white = change, black = keep): edit it, remove what is there, replace it, or add something inside it. The model is shown the area marked on a copy of the image; pixels outside the mask are preserved exactly.

输入参数seedactionpromptqualitymask_path必填image_path必填output_pathinclude_preview

upscale_image

Upscale image

Enlarge an image (default 2x, or to a width/height up to 8192 px). Runs the upscaler model chosen in Kokon (Superscale-SP by default; seconds on a PC GPU, longer on a Mac; adds no new content). Saves a new file; the input is never overwritten.

输入参数scalewidthheightimage_path必填output_pathinclude_preview

get_image_info

Image info

Width, height, aspect ratio, file type and, for images made by Kokon, the generation metadata (prompt, seed, model, steps...).

输入参数image_path必填

get_generator_status

Generator status

Whether the local inference server is running and the model loaded, GPU and VRAM, the active job and the queue.

无需输入参数。

版本历史

8
  1. v0.12.0最新Nov 5, 2026
  2. v0.11.1Oct 29, 2026
  3. v0.11.0Oct 25, 2026
  4. v0.10.2Oct 23, 2026
  5. v0.10.1Oct 22, 2026
  6. v0.10.0Oct 20, 2026
  7. v0.9.4Oct 16, 2026
  8. v0.9.1Oct 12, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分