NK

nanayax3/krita-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

56 stars 24 forks 质量 68 趋势 1MIT

nanayax3/krita-mcp 是从 https://github.com/nanayax3/krita-mcp. 导入的 MCP 服务器候选

概览

nanayax3/krita-mcp 是从 https://github.com/nanayax3/krita-mcp. 导入的 MCP 服务器候选

概述(AI 翻译)

让AI通过模型上下文协议绘制Krita。

该桥接使 Claude(或任何 MCP 客户端)能够创建画布、绘制笔触、绘制形状、导出图像等——所有这些都在运行中的 Krita 实例中完成。

工作原理

两个组成部分:

  1. Krita 插件(krita-plugin/)——一个运行于 Krita 内部的 Python 插件,在 localhost:5678 上暴露一个 HTTP 服务器。它通过命令队列在 Krita 主线程上接收绘画命令并执行。

  2. MCP Server(server.py)—— 一台 FastMCP 服务器,向任何 MCP 客户端开放绘画工具。它将 MCP 工具调用转换为 Krita 插件的 HTTP 请求。

布置

1.安装 Krita 插件

把插件文件复制到你的 Krita 插件目录:

OS 路径
Windows %APPDATA%\krita\pykrita\
Linux ~/.local/share/krita/pykrita/
macOS ~/Library/Application Support/krita/pykrita/

两者都复制:

  • krita-plugin/kritamcp/(带有__init__.py的文件夹)
  • krita-plugin/kritamcp.desktop

然后在 Krita 里:设置→配置 Krita→ Python 插件管理器→启用“Krita MCP Bridge” 并重启 Krita。

2.安装MCP服务器

或者用虚拟环境:

3.

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Krita MCP Server

Let AI paint in Krita via the Model Context Protocol.

This bridge allows Claude (or any MCP client) to create canvases, paint strokes, draw shapes, export images, and more — all inside a running Krita instance.

How It Works

Two components:

  1. Krita Plugin (krita-plugin/) — A Python plugin that runs inside Krita, exposing an HTTP server on localhost:5678. It receives paint commands and executes them on Krita’s main thread via a command queue.

  2. MCP Server (server.py) — A FastMCP server that exposes painting tools to any MCP client. It translates MCP tool calls into HTTP requests to the Krita plugin.

MCP Client (Claude, etc.)  ←→  MCP Server (server.py)  ←→  Krita Plugin (HTTP on :5678)  ←→  Krita

Setup

1. Install the Krita Plugin

Copy the plugin files to your Krita plugins directory:

OS Path
Windows %APPDATA%\krita\pykrita\
Linux ~/.local/share/krita/pykrita/
macOS ~/Library/Application Support/krita/pykrita/

Copy both:

  • krita-plugin/kritamcp/ (the folder with __init__.py)
  • krita-plugin/kritamcp.desktop

Then in Krita: Settings → Configure Krita → Python Plugin Manager → Enable “Krita MCP Bridge” and restart Krita.

2. Install the MCP Server

pip install fastmcp httpx

Or with a virtual environment:

python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
pip install -r requirements.txt

3. Configure Your MCP Client

Add to your MCP client config (e.g., Claude Desktop’s claude_desktop_config.json):

{
  "mcpServers": {
    "krita": {
      "command": "python",
      "args": ["/path/to/server.py"]
    }
  }
}

If using a virtual environment:

{
  "mcpServers": {
    "krita": {
      "command": "/path/to/.venv/Scripts/python",
      "args": ["/path/to/server.py"]
    }
  }
}

Available Tools

Tool Description
krita_health Check if Krita is running with the plugin active
krita_new_canvas Create a new canvas (width, height, background color)
krita_set_color Set foreground paint color (hex)
krita_set_brush Set brush preset, size, and opacity
krita_stroke Paint a stroke through a list of [x, y] points
krita_fill Fill a circular area at a point
krita_draw_shape Draw rectangle, ellipse, or line
krita_get_canvas Export canvas to PNG (for AI to see progress)
krita_save Save canvas to a specific file path
krita_undo / krita_redo Undo/redo actions
krita_clear Clear canvas to a solid color
krita_get_color_at Eyedropper — sample color at a pixel
krita_list_brushes List available brush presets
krita_open_file Open an existing .kra, .png, .jpg, etc.

The Export Timeout Fix

This is the main reason this repo exists.

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "krita": { "command": "python", "args": ["/path/to/server.py"] } } }