Krita Codex MCP

io.github.cyyprezz由 GitHub 帳號 cyyprezz 發布v0.2.0更新於 Oct 24, 2026

Control Krita through a secure local MCP server and authenticated Windows bridge.

概覽

AI 產生的概覽

讓助理透過經過驗證的本機回送橋接,在 Windows 上檢視並控制本機 Krita 繪畫工作階段。

可以做什麼
這是一個本機 STDIO MCP 伺服器,透過經過驗證的 127.0.0.1 HTTP 橋接與 Krita Python 外掛通訊。工具涵蓋文件狀態與生命週期、以 PNG 回傳的畫布預覽、選取範圍與剪貼簿編輯、依 UUID 編輯圖層樹、復原/重做、筆刷狀態與預設集、原生繪畫與形狀、調色盤與色彩校正,以及 KRA/PNG 和面向 Unity 的素材匯出。它提供少量內聚工具而非大量微型工具,並回報執行時相容性,讓不可用的功能回傳結構化錯誤,而不會默默切換算繪後端。
適用情境
當你希望助理在 Windows 上驅動 Krita 時使用:檢視文件與圖層、產生預覽、建立選取範圍與編輯、使用原生預設集繪畫,或匯出 KRA、PNG 與 Unity 素材包。它適合本機單機工作流程,前提是 Krita 已開啟且橋接外掛已安裝並啟用。
執行需求
需要 Windows 上能通過即時相容性檢查的 Krita 版本,以及 PATH 中的 uv/uvx。PyPI 套件透過 uvx 執行,Krita Python 外掛必須安裝、在 Python 外掛管理員中啟用,並重新啟動 Krita。回送橋接使用共享 bearer 權杖驗證;儲存與匯出需設定允許的根目錄。未宣告帳號或 API 金鑰。
安裝前請注意
此橋接可寫入、變換和刪除文件內容、圖層與檔案,並可在設定的根目錄下儲存或匯出,因此應盡量縮小 allowed_roots 並保留一般 KRA 備份。自由圖層縮放、旋轉、斜切和裁切不是原生復原步驟,需完成儲存並重新開啟的往返後才能繼續。逾時不等於取消:逾時的操作可能仍會完成,後續呼叫會回傳 BRIDGE_BUSY。橋接僅限本機 127.0.0.1,且沒有任意 Python 執行工具。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Krita Codex MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Krita Codex MCP Server

Control Krita from OpenAI Codex through a secure local Model Context Protocol (MCP) server for Windows and Linux.

PyPI package · GitHub releases · Windows installation guide · Linux installation guide · Codex and MCP compatibility

A local MCP server that lets Codex inspect and control Krita through a small, authenticated bridge. The MCP process uses STDIO. The Krita Python plugin listens only on 127.0.0.1, validates a shared bearer token, and dispatches every Krita API call to Qt's main thread.

Windows is the original supported platform; Linux support is experimental. Both platforms use a capability-based runtime compatibility check. Krita 5.3.2.1 on Windows is a tested build, not a hard version requirement. The server deliberately exposes a small set of cohesive tools instead of a large collection of micro-tools:

ToolPurpose
krita_stateActive document, canvas/color space, recursive layer tree with UUIDs, active layer and current painting state
krita_previewWhole-canvas or pixel-precise cropped PNG returned directly as MCP image content
krita_canvasSample colors; resize, scale, crop, rotate or flip; import editable raster layers
krita_editCreate/refine/move selections; native copy, cut, paste, selection-to-layer, fill and clear
krita_documentInspect runtime compatibility; list, create, open, activate, save and close documents
krita_layersRead/edit the layer tree, safely reparent, and transform layers by stable UUID
krita_historyRead undo/redo state and execute bounded undo or redo steps
krita_brushRead/set native brush state and search installed Krita presets
krita_paint_pathPressure-aware line segments through Krita's native Node.paintLine API and active brush preset
krita_drawNative preset-backed lines, open/closed paths, polygons, rectangles and ellipses
krita_colorKRA-backed project palettes, Krita palette swatches, color replacement and safe correction filters
krita_assetExport layer PNGs plus Unity-oriented animation, tileset and named-region packages with direct previews
krita_save_exportSave KRA and export PNG beneath configured roots only
text
Codex -> local STDIO MCP process -> authenticated 127.0.0.1 HTTP bridge      -> queued, timeout-aware Qt main-thread dispatch -> Krita Python API

The bridge has no arbitrary Python execution tool and no direct pixel painting fallback. Actual painting, shapes, replacement fills and correction filters go through native Krita actions or stroke APIs. If the running Krita build lacks a feature, krita_state and krita_document(action="compatibility") report the affected tools. Calling that feature returns a structured error; the bridge never silently switches to a different rendering backend.

Quick start

Choose the installation source for your platform:

PlatformInstallation sourceValidation
WindowsPyPI 0.2.2 or a checkoutWindows CI; original live testing with Krita 5.3.2.1
LinuxPyPI 0.2.2 or a checkoutLinux CI; contributor live test on Debian 13 / Krita 5.2.9 in limited mode

Version 0.2.2 includes the Linux/XDG path and private-configuration fixes. Keep the installer, Krita plugin and Codex server on that same exact version; the marketplace launcher also pins it. Other Linux distributions and Krita builds require their own live preflight.

A first-time setup has two separate parts: the local bridge must be installed and enabled in Krita, then Codex must be connected through either the marketplace plugin or a direct MCP configuration. The codex plugin commands do not install or enable anything in Krita.

Krita must include Python scripting, pass the live compatibility check, and have uv/uvx on PATH. Run the MCP process on the same computer as Krita. Local Codex CLI, IDE and supported desktop clients use local MCP configuration; a hosted ChatGPT web chat cannot connect through this computer's 127.0.0.1 bridge by adding this GitHub repository.

Windows: published package

  1. Close Krita, make sure the allowed directory already exists, and install the current release from PyPI:
powershell
uvx --from "krita-codex-mcp==0.2.2" `  krita-codex-install install `  --allowed-root "C:\Krita Work"
  1. In Krita, open Settings > Configure Krita > Python Plugin Manager and enable Krita Codex Bridge.
  2. Close and reopen Krita so the installed plugin and shared protocol package are loaded together.
  3. Run the same version's live check:
powershell
uvx --from "krita-codex-mcp==0.2.2" krita-codex-install check
  1. Require either Ready for productive use. or the explicit limited-mode success message.
  2. Choose exactly one Codex connection method below: the marketplace plugin or the direct MCP configuration.

Linux: PyPI package

Close Krita, create a narrow allowed directory and install from PyPI:

bash
mkdir -p "$HOME/krita-codex-work"uvx --from "krita-codex-mcp==0.2.2" krita-codex-install install --allowed-root "$HOME/krita-codex-work"

Enable Krita Codex Bridge in Krita's Python Plugin Manager, close and reopen Krita, then run:

bash
uvx --from "krita-codex-mcp==0.2.2" krita-codex-install check

Accept compatible or explicitly reported limited mode. Follow the Linux guide's Codex setup for either connection method. The installer uses XDG directories and keeps its token configuration private. No sudo is needed.

Install the Codex plugin from GitHub

The repository includes a public, local-first Codex plugin. It bundles the guided krita-control skill and starts the version-pinned PyPI MCP server through uvx; Krita and the authenticated bridge continue to run only on the user's machine. Run these commands only after the Krita bridge has been installed, enabled, restarted, and checked as described above. They register the GitHub marketplace and install the Codex bundle; they do not modify the Krita installation or enable its Python plugin.

powershell
codex plugin marketplace add cyyprezz/krita-codex-mcpcodex plugin add krita-codex-mcp@krita-codex

Start a new Codex task after installation, then verify krita_state and krita_preview. Plugin users should not also add a separate [mcp_servers.krita] block because the plugin already provides that server. For later repository releases, run codex plugin marketplace upgrade krita-codex, rerun codex plugin add krita-codex-mcp@krita-codex, and start another new Codex task.

Configure the MCP server directly

For either platform, use this alternative only after the Krita bridge has passed the live check. Preview the checkout-free, exactly version-pinned uvx Codex block with krita-codex-install codex-config. Apply it only after explicit confirmation, restart Codex, verify krita_state and krita_preview, and only then start normal work.

Install and update never close Krita. If the authenticated bridge is running, replacement is rejected before any installed files are changed and Krita must be closed manually. A busy local bridge port also stops the installer before replacement begins.

For a personal installation, use the user-level ~/.codex/config.toml on Linux or C:\Users\<you>\.codex\config.toml on Windows. This is the recommended option because the server is then available to all local Codex tasks and Git worktrees. The generated block uses uvx, has no checkout cwd, and pins the same exact distribution version as the installed plugin. The installer only changes that file after showing the full preview and receiving explicit confirmation. Unmarked or conflicting Krita entries are never overwritten. Never commit personal configuration. See the Windows installation guide for details.

The generated launcher and marketplace configuration explicitly forward custom XDG directories. Codex and Krita must inherit the same values. For unreleased source changes, use the checkout-specific alternative in the Linux guide.

Current Codex and MCP compatibility

The compatibility check uses Codex CLI 0.163.0 (released 2026-10-15) against the built wheel and checks discovery of all 13 tools without an API key, model request or running Krita. See the compatibility notes for its exact scope.

This server intentionally stays on the MCP Python SDK 1.x maintenance line (mcp<2). Current Codex retains the legacy STDIO handshake used by this SDK. The newer MCP 2026-07-28 protocol and portable plugin format do not by themselves require replacing this working local integration. The existing Codex plugin manifest remains a supported compatibility format; full support for newer MCP protocol features would be a separate, tested SDK migration.

The preflight checks local configuration, the complete installed hash manifest, wheel/plugin/ protocol versions, loopback port, authentication and the running Krita capability profile. The running plugin reports the distribution, protocol and Krita versions without adding an MCP tool. The check creates a disposable document, verifies a new paint layer, native drawing, Undo/Redo, transactional reparenting, direct PNG preview bytes and temporary KRA/PNG output beneath an allowed root. It restores the previously active document and removes every temporary file.

An unknown Krita version is accepted when all critical capabilities pass. Missing optional features produce limited warnings naming the affected MCP tools; missing projection, persistence, stable layer-tree or document-lifecycle APIs remain critical. The same structured report is available to Codex through krita_state, so it can avoid unavailable operations.

Capabilities and Krita limits

The current release supports native preset-backed painting and shapes, persistent document and layer editing, selections, color operations, KRA/PNG output, and Unity-oriented animation, tileset and named-region packages. Preview and asset operations return PNG images directly to the MCP caller. Re-export preserves Unity .meta sidecars for stable generated filenames.

The tested Krita 5.3.2.1 build imposes several safety limits. Other builds are evaluated at runtime and may report different available features:

  • Free layer scale, rotate, shear and crop operations are not native Undo commands. The bridge creates a hidden backup layer and blocks a second direct transform until the KRA is saved, closed and reopened. checkpoint_reopen=true can perform that round trip automatically.
  • Transform masks are limited to three per open document. Same-session mask mutation/removal and mixing mask and direct transform backends are blocked until Krita restarts.
  • Node.paintLine requires integer QPoint values, so incoming canvas coordinates are rounded at the native API boundary.
  • PNG export temporarily enables Krita batch mode so no format dialog can block the local bridge.

Timeouts and production guardrails

Timeouts are operation-specific across Codex, the MCP BridgeClient, the local HTTP bridge and Qt's main-thread dispatcher:

Operation classDispatcher timeout
Reads and normal edits30 seconds
Document open and checkpoint save120 seconds
KRA/PNG, layer, animation, tileset and region exports180 seconds

The recommended Codex tool_timeout_sec is 210 seconds so the MCP client can receive the bridge's structured result. If a timed-out Qt operation is already running, operation_may_complete=true is preserved and later calls receive BRIDGE_BUSY until Krita actually finishes.

Keep allowed_roots as narrow as practical, keep ordinary versioned or manual KRA backups, and do not treat the bridge timeout as cancellation. The bridge is local-only and binds exactly to 127.0.0.1.

See Windows installation, Linux installation, Codex/MCP compatibility, tool behavior and limits, security, and the GitHub releases.

License

Released under the MIT License. Copyright (c) 2026 Nicklas Desens.

來源:README.md,提交 f2ca27a

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分