Windows-first local MCP bridge for reliable Krita control from Codex
Project description
Krita Codex MCP Server
Control Krita from OpenAI Codex through a secure local Model Context Protocol (MCP) server for Windows.
PyPI package · GitHub releases · Windows installation guide
A Windows-first 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.
This repository is a Windows-first integration validated against Krita 5.3.2.1. It deliberately exposes a small set of cohesive tools instead of a large collection of micro-tools:
| Tool | Purpose |
|---|---|
krita_state |
Active document, canvas/color space, recursive layer tree with UUIDs, active layer and current painting state |
krita_preview |
Whole-canvas or pixel-precise cropped PNG returned directly as MCP image content |
krita_canvas |
Sample colors; resize, scale, crop, rotate or flip; import editable raster layers |
krita_edit |
Create/refine/move selections; native copy, cut, paste, selection-to-layer, fill and clear |
krita_document |
List, create, open, activate, checkpoint-save and explicitly close documents |
krita_layers |
Read/edit the layer tree, safely reparent, and transform layers by stable UUID |
krita_history |
Read undo/redo state and execute bounded undo or redo steps |
krita_brush |
Read/set native brush state and search installed Krita presets |
krita_paint_path |
Pressure-aware line segments through Krita's native Node.paintLine API and active brush preset |
krita_draw |
Native preset-backed lines, open/closed paths, polygons, rectangles and ellipses |
krita_color |
KRA-backed project palettes, Krita palette swatches, color replacement and safe correction filters |
krita_asset |
Export layer PNGs plus Unity-oriented animation, tileset and named-region packages with direct previews |
krita_save_export |
Save KRA and export PNG beneath configured roots only |
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 installed Krita build lacks a required method, the operation fails closed.
Quick start
This requires Krita 5.3.2.1 and uv/uvx
on PATH. Close Krita, make sure the allowed directory already exists, and install the current
release from PyPI:
uvx --from "krita-codex-mcp==0.1.1" `
krita-codex-install install `
--allowed-root "C:\Krita Work"
Then use this order for a real Krita session:
- Enable Krita Codex Bridge in Krita's Python Plugin Manager.
- Restart Krita so the installed plugin and shared protocol package are loaded together.
- Run the same version's
krita-codex-install checkand requireReady for productive use. - Preview the checkout-free, exactly version-pinned
uvxCodex block withkrita-codex-install codex-config. - Apply it only after explicit confirmation, restart Codex, verify
krita_stateandkrita_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 C:\Users\<you>\.codex\config.toml. 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 preflight checks local configuration, the complete installed hash manifest, wheel/plugin/
protocol versions, loopback port, authentication and krita_state. The running plugin reports the
distribution and protocol version loaded by Krita without adding an MCP tool. The check creates a
disposable document, validates direct PNG preview bytes, exports a temporary PNG beneath an allowed
root, closes the document and removes the file. It restores the previously active document and does
not edit Codex configuration or contact an external service.
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.
Krita 5.3.2.1 imposes several safety limits:
- 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=truecan 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.paintLinerequires integerQPointvalues, 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 class | Dispatcher timeout |
|---|---|
| Reads and normal edits | 30 seconds |
| Document open and checkpoint save | 120 seconds |
| KRA/PNG, layer, animation, tileset and region exports | 180 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, tool behavior and limits, security, and the GitHub releases.
License
Released under the MIT License. Copyright (c) 2026 Nicklas Desens.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file krita_codex_mcp-0.1.1.tar.gz.
File metadata
- Download URL: krita_codex_mcp-0.1.1.tar.gz
- Upload date:
- Size: 197.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20c6179eba9069523099c43fd6b8cdf9e43d750c8bac2e6372edeb7e6fa7443d
|
|
| MD5 |
aad0d8c14b960d076aead629305e328a
|
|
| BLAKE2b-256 |
e52f88e7dbbff5754a924abdfd37e6e0dbb7796a7b3ae603bf0bdd5dcd145f39
|
Provenance
The following attestation bundles were made for krita_codex_mcp-0.1.1.tar.gz:
Publisher:
release.yml on cyyprezz/krita-codex-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krita_codex_mcp-0.1.1.tar.gz -
Subject digest:
20c6179eba9069523099c43fd6b8cdf9e43d750c8bac2e6372edeb7e6fa7443d - Sigstore transparency entry: 2188987904
- Sigstore integration time:
-
Permalink:
cyyprezz/krita-codex-mcp@815b8014d8ef92ba5e103ba5d2d1bf515ea6aefa -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/cyyprezz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@815b8014d8ef92ba5e103ba5d2d1bf515ea6aefa -
Trigger Event:
push
-
Statement type:
File details
Details for the file krita_codex_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: krita_codex_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 124.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39a0c7b6ddacb52dbe97b56d126ec3c3608013e14e67b84a7b02f959ff68904d
|
|
| MD5 |
c72d7e80ed0fbc5283898754e4e6792a
|
|
| BLAKE2b-256 |
959f339bf5681dd740f2f1514a16709c6fb13df5d51ef678996a58349ae10726
|
Provenance
The following attestation bundles were made for krita_codex_mcp-0.1.1-py3-none-any.whl:
Publisher:
release.yml on cyyprezz/krita-codex-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krita_codex_mcp-0.1.1-py3-none-any.whl -
Subject digest:
39a0c7b6ddacb52dbe97b56d126ec3c3608013e14e67b84a7b02f959ff68904d - Sigstore transparency entry: 2188988741
- Sigstore integration time:
-
Permalink:
cyyprezz/krita-codex-mcp@815b8014d8ef92ba5e103ba5d2d1bf515ea6aefa -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/cyyprezz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@815b8014d8ef92ba5e103ba5d2d1bf515ea6aefa -
Trigger Event:
push
-
Statement type: