Krita MCP Serverのロゴ

Krita MCP Server

コミュニティ
nanayax3

Let AI paint in Krita via the Model Context Protocol. Includes fix for the common export timeout issue.

公開者nanayax3
リポジトリkrita-mcp
言語Python
フォーク
20
スター
49
利用可能なツール
0
通信方式stdio
カテゴリ
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    Krita MCP Serverは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには49件のスターと20件のフォークがあります。

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:

OSPath
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

bash
pip install fastmcp httpx

Or with a virtual environment:

bash
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):

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

If using a virtual environment:

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

Available Tools

ToolDescription
krita_healthCheck if Krita is running with the plugin active
krita_new_canvasCreate a new canvas (width, height, background color)
krita_set_colorSet foreground paint color (hex)
krita_set_brushSet brush preset, size, and opacity
krita_strokePaint a stroke through a list of [x, y] points
krita_fillFill a circular area at a point
krita_draw_shapeDraw rectangle, ellipse, or line
krita_get_canvasExport canvas to PNG (for AI to see progress)
krita_saveSave canvas to a specific file path
krita_undo / krita_redoUndo/redo actions
krita_clearClear canvas to a solid color
krita_get_color_atEyedropper — sample color at a pixel
krita_list_brushesList available brush presets
krita_open_fileOpen an existing .kra, .png, .jpg, etc.

The Export Timeout Fix

This is the main reason this repo exists.

By default, HTTP requests and command queue operations time out after ~30 seconds. Canvas export (get_canvas) and file save (save) operations can easily exceed this on larger canvases, causing silent failures or timeout errors.

The fix is applied in two places:

MCP Server (server.py) — Extended timeout for export/save commands:

python
# In krita_get_canvas and krita_save:
result = send_command("get_canvas", {"filename": filename}, timeout=120.0)
result = send_command("save", {"path": path}, timeout=120.0)

Krita Plugin (__init__.py) — Matching timeout in the command queue:

python
def get_result(self, command_id, timeout=120):
    """Wait for result with timeout."""
    for _ in range(int(timeout * 10)):  # Check every 100ms
        ...

Both sides must match. If only the MCP server timeout is increased, the plugin's command queue will still time out at 30s. If only the plugin timeout is increased, the HTTP request from the MCP server will time out first.

Configuration

SettingDefaultHow to Change
Plugin HTTP port5678Edit SERVER_PORT in plugin __init__.py
MCP server URLhttp://localhost:5678Set KRITA_URL env var
Canvas output dir~/krita-mcp-outputEdit CANVAS_OUTPUT_DIR in plugin __init__.py

Painting Approach

The plugin paints using direct pixel manipulation (not Krita's native brush engine for strokes). This means:

  • Strokes use a custom soft-circle renderer with configurable hardness
  • Alpha blending is done manually in BGRA pixel format
  • Shapes (rectangle, ellipse, line) are rasterized directly
  • This approach is reliable and doesn't depend on Krita's internal brush state

The set_brush tool does set Krita's brush preset (for potential future use), but stroke currently uses its own pixel-level rendering.

License

MIT

インストール

TypingMind
{
  "mcpServers": {
    "krita-mcp": {
      "command": "python",
      "args": [
        "server.py"
      ]
    }
  }
}

Krita MCP ServerのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度Krita MCP Serverに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

Krita MCP Serverをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. Krita MCP ServerのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "krita-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてKrita MCP ServerのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. Krita MCP ServerのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
Krita MCP Serverを使ってこのタスクを手伝ってもらえますか?
Krita MCP Server
はい、読みました。
Krita MCP Serverで調べた結果をお伝えします。

よくある質問

Krita MCP Server MCPサーバーは何に使いますか?

Krita MCP Serverは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでKrita MCP Server MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでKrita MCP Serverを利用できます。

TypingMindでKrita MCP Server MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。Krita MCP Serverを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

Krita MCP Server MCPをTypingMindに接続するにはどうすればよいですか?

Krita MCP ServerはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでKrita MCP Server MCPのどのようなツールを利用できますか?

Krita MCP ServerはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

Krita MCP Server MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。Krita MCP Serverで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇