Kokon — Claude Code MCP server: what it does, how to install
Generates and edits images offline via Qwen-Image 2.1 right from your coding assistant. Keeps all graphics rendering on your local GPU without cloud subscriptions.
claude mcp add --env QLS_MCP_ALLOWED_DIRS=<QLS_MCP_ALLOWED_DIRS> --transport stdio mcp -- npx -y kokon-mcpWhat Kokon does
This package serves as a bridge between MCP clients and the Kokon desktop application to process graphics locally via Qwen-Image 2.1. Available tools cover text-to-image synthesis, masked inpainting, canvas expansion, and upscaling up to 8192 px. Every request stays on 127.0.0.1. No data leaves your machine.
Execution requires Node.js 22 or higher. Without the desktop Kokon software installed and configured, this server cannot operate. You must complete the initial desktop setup to fetch the neural network weights. Hardware demands at least 12 GB VRAM on Windows or 16 GB on Apple Silicon. Initial model initialization takes around one minute.
File operations never overwrite existing files. Read and write permissions remain confined to the active project folder or paths defined in QLS_MCP_ALLOWED_DIRS.
What it helps with
- render graphics from prompts and references directly into the repository
- modify masked regions or extend borders on local image assets
- upscale illustrations up to 8192 px without sending data to external APIs
- inspect current GPU memory allocation and active task queues
Example prompts for the agent
- Generate a hero banner for this
README.mdand save the result intodocs/ - Clean up the background details in
screenshot.pngusinginpaint_image - Double the resolution of
logo.pngwithupscale_image
How to install Kokon
Platform CLI
claude mcp add --env QLS_MCP_ALLOWED_DIRS=<QLS_MCP_ALLOWED_DIRS> --transport stdio mcp -- npx -y kokon-mcpReplace <…> with your own values
Platform CLI
codex mcp add mcp --env QLS_MCP_ALLOWED_DIRS=<QLS_MCP_ALLOWED_DIRS> -- npx -y kokon-mcpReplace <…> with your own values
Config file
{
"mcpServers": {
"mcp": {
"command": "npx",
"args": [
"-y",
"kokon-mcp"
],
"env": {
"QLS_MCP_ALLOWED_DIRS": "<QLS_MCP_ALLOWED_DIRS>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"kokon-mcp"
],
"env": {
"QLS_MCP_ALLOWED_DIRS": "<QLS_MCP_ALLOWED_DIRS>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e QLS_MCP_ALLOWED_DIRS=<QLS_MCP_ALLOWED_DIRS> mcp npx -y kokon-mcpReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Kokon
How to install Kokon in Claude Code?
Run claude mcp add kokon -- npx -y kokon-mcp. If you need to authorize extra project paths, execute claude mcp add --env QLS_MCP_ALLOWED_DIRS=<QLS_MCP_ALLOWED_DIRS> --transport stdio mcp -- npx -y kokon-mcp.
What does Kokon do?
It acts as a local bridge connecting coding assistants to an offline Qwen-Image 2.1 model for creating, inpainting, and enlarging images without internet access.
What are the prerequisites for running Kokon?
You need the Kokon desktop application installed to fetch the model weights, alongside Node.js 22 or newer. The host machine requires at least 12 GB VRAM on Windows or 16 GB unified memory on Apple Silicon.