Skip to main content

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

  1. Krita Plugin (krita-plugin/) — A Python plugin for Krita that exposes a thread-safe HTTP server on localhost:5678.
  2. MCP Server (src/krita_mcp/) — A FastMCP server exposing 40+ painting and manipulation tools.
  3. Krita CLI (src/krita_cli/) — A Typer-based command line interface for human operators.
  4. 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

🔧 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_status allows agents to check active limits.

📄 License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

krita_cli-1.0.0.tar.gz (234.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

krita_cli-1.0.0-py3-none-any.whl (44.8 kB view details)

Uploaded Python 3

File details

Details for the file krita_cli-1.0.0.tar.gz.

File metadata

  • Download URL: krita_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 234.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for krita_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0f29c39d112d47e0f4ae7a8f5c8d84f2cbabe2bc25adfa4aecf5b28da65121d7
MD5 55a8a8b458d92ebc3f2135c449cd0183
BLAKE2b-256 8ef7690bf4247f28994db86825db328f0929caca355c4af5ce386216d2415390

See more details on using hashes here.

Provenance

The following attestation bundles were made for krita_cli-1.0.0.tar.gz:

Publisher: ci.yml on edithatogo/krita-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file krita_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: krita_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 44.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for krita_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5380dcd9f0a77d71f339c879bdc80b0589b3ecc7442e7e19b8524c749a31fcb
MD5 3c8ef9cccd21840277f7d4fd619b24cf
BLAKE2b-256 c8c9a60c645c35388a0134eca28553aa76b5acc645606ff4c70fa874345e5bef

See more details on using hashes here.

Provenance

The following attestation bundles were made for krita_cli-1.0.0-py3-none-any.whl:

Publisher: ci.yml on edithatogo/krita-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page