SOTA CLI + MCP server for programmatic painting in Krita
Project description
Krita MCP Server & CLI
Let AI agents paint in Krita via the Model Context Protocol.
This subproject provides the core implementation of the Krita-MCP ecosystem, including the FastMCP server, the krita CLI, and the high-performance Python plugin.
🛠️ Components
- Krita Plugin (
krita-plugin/) — A Python plugin for Krita that exposes a thread-safe HTTP server onlocalhostusing the configured port (default5678). - MCP Server (
src/krita_mcp/) — A FastMCP server exposing 40+ painting and manipulation tools. - Krita CLI (
src/krita_cli/) — A Typer-based command line interface for human operators. - Krita Client (
src/krita_client/) — A reusable, fully-typed Python library for Krita automation.
🚀 Setup
1. Krita Plugin Installation
Copy the contents of krita-plugin/ to your Krita resources:
- Windows:
%APPDATA%\krita\pykrita\ - Linux:
~/.local/share/krita/pykrita/ - macOS:
~/Library/Application Support/krita/pykrita/
Enable "Krita MCP Bridge" in Krita (Configure Krita → Python Plugin Manager) and restart.
2. Environment Setup
# Install dependencies with uv
uv sync
3. Windows Validation Checklist
Before debugging the plugin, make sure the local Python runtime is healthy:
python -c "import ssl, ctypes"must succeed.python scripts/windows_preflight.pyshould report a clean Windows setup.uv run pytest tests/e2e/test_e2e_mock.pyshould pass without Krita.- The plugin files must exist under
%APPDATA%\krita\pykrita\kritamcp\. - Krita must be restarted after enabling Krita MCP Bridge in the Plugin Manager.
- The plugin should expose
http://127.0.0.1:<configured-port>/healthonce Krita finishes loading.
If Krita starts but /health never appears, check the diagnostic artifacts in your home directory:
~/kritamcp_startup.log~/kritamcp_diag.log
If those logs are missing entirely, the plugin likely was not enabled or did not load during startup.
🔧 CLI Commands
The krita CLI is grouped into logical subcommands:
- Painting:
stroke,fill,clear,draw-shape - Layers:
layers list,layers create,layers select,layers delete - Selection:
selection select-rect,selection transform,selection save-channel - Canvas:
canvas-info,current-color,current-brush - Session:
history,replay,rollback,batch - System:
health,config,capabilities,security-status
Run uv run krita --help for full details.
🤖 MCP Server Tools (40 Total)
The MCP server exposes a vast range of capabilities to AI agents:
| Category | Key Tools |
|---|---|
| Core | krita_health, krita_new_canvas, krita_save, krita_open_file |
| Painting | krita_stroke, krita_fill, krita_draw_shape, krita_set_color, krita_set_brush |
| Selection | krita_select_rect, krita_select_ellipse, krita_select_polygon, krita_select_by_color, krita_select_by_alpha |
| Selection Ops | krita_transform_selection, krita_grow_selection, krita_combine_selections, krita_invert_selection |
| Persistence | krita_save_selection, krita_load_selection, krita_save_selection_channel, krita_list_selection_channels |
| Automation | krita_batch, krita_rollback, krita_get_command_history |
| Inspection | krita_get_canvas_info, krita_get_color_at, krita_selection_stats, krita_security_status |
⚡ Performance
The plugin uses numpy-accelerated direct pixel manipulation for rendering. This ensures that strokes and shapes are rendered significantly faster than standard Python loops, especially on high-resolution canvases.
🔒 Security
Krita MCP includes a built-in security layer to protect your system:
- Path Sanitization: Restricts file operations to allowed directories.
- Resource Limits: Prevents OOM by limiting max canvas dimensions and layer counts.
- Rate Limiting: Throttles rapid command execution.
- Security Tool:
krita_security_statusallows agents to check active limits.
📄 License
MIT
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_cli-1.0.1.tar.gz.
File metadata
- Download URL: krita_cli-1.0.1.tar.gz
- Upload date:
- Size: 251.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d818d86921e36cb856dcbed40fa405b443d397a08622d02e92a166154970c8ee
|
|
| MD5 |
01d383cf16990308c74575db7166a121
|
|
| BLAKE2b-256 |
d2a0f683b184f3430eb6a00d372385b11f2b3eb53ec719e08a95396665355a11
|
Provenance
The following attestation bundles were made for krita_cli-1.0.1.tar.gz:
Publisher:
ci.yml on edithatogo/krita-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krita_cli-1.0.1.tar.gz -
Subject digest:
d818d86921e36cb856dcbed40fa405b443d397a08622d02e92a166154970c8ee - Sigstore transparency entry: 1340085048
- Sigstore integration time:
-
Permalink:
edithatogo/krita-cli@45cdebc758341dce5f4c8bc4515dc2a2c08d0566 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/edithatogo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@45cdebc758341dce5f4c8bc4515dc2a2c08d0566 -
Trigger Event:
push
-
Statement type:
File details
Details for the file krita_cli-1.0.1-py3-none-any.whl.
File metadata
- Download URL: krita_cli-1.0.1-py3-none-any.whl
- Upload date:
- Size: 45.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94536efff294444f0360af4c9192819640a527999dcf586baa93b0222e649f88
|
|
| MD5 |
1ace688c639d5423a88ea86c8c3630e0
|
|
| BLAKE2b-256 |
cff96353395f4c4b26ba1b595bb6366922896bd4dcb0cf183fea6b2c297cc2ba
|
Provenance
The following attestation bundles were made for krita_cli-1.0.1-py3-none-any.whl:
Publisher:
ci.yml on edithatogo/krita-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
krita_cli-1.0.1-py3-none-any.whl -
Subject digest:
94536efff294444f0360af4c9192819640a527999dcf586baa93b0222e649f88 - Sigstore transparency entry: 1340085050
- Sigstore integration time:
-
Permalink:
edithatogo/krita-cli@45cdebc758341dce5f4c8bc4515dc2a2c08d0566 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/edithatogo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@45cdebc758341dce5f4c8bc4515dc2a2c08d0566 -
Trigger Event:
push
-
Statement type: