Content
# KritaMCP
MCP (Model Context Protocol) server for Krita. This is a plugin that allows you to control Krita from an AI assistant.
## Architecture
```
AI Client (Claude etc.)
│
│ MCP (SSE transport, port 8001)
▼
MCP Server (kritamcp-server)
│
│ HTTP/SSE Bridge (port 8000)
▼
Krita Plugin (krita-plugin/)
│
│ Krita Python API
▼
Krita
```
- **MCP Server**: FastMCP-based MCP server. Receives requests from the AI client and sends commands to the Krita plugin via HTTP/SSE.
- **Krita Plugin**: Krita's Python plugin. Receives commands from the MCP server via SSE and executes them using the Krita API.
## Available MCP Tools
| Tool | Description |
| :------------------- | :---------------------------------------- |
| `ping` | Check connection with Krita |
| `get_document_info` | Get information about the active document |
| `create_document` | Create a new document |
| `save_document` | Save the document |
| `get_layers` | Get layer hierarchy |
| `execute_python` | Execute code in Krita's built-in Python environment |
## Requirements
- Python 3.12+
- Krita (Python plugin support)
- [uv](https://docs.astral.sh/uv/) or [pipx](https://pipx.pypa.io/)
## Installation
### 1. Install MCP Server
**Method A: Run directly with uvx (no installation required)**
```bash
uvx kritamcp-server
```
Dependencies are automatically installed in a temporary environment and cleaned up after execution.
**Method B: Install as a tool**
```bash
# If using uv
uv tool install kritamcp
# If using pipx
pipx install kritamcp
```
After installation, the `kritamcp-server` command will be available.
### 2. Install Krita Plugin
Copy or symlink the `krita-plugin/kritamcp/` directory and `krita-plugin/kritamcp.desktop` to Krita's pykrita directory:
```bash
# Linux
ln -s /path/to/krita-plugin/kritamcp ~/.local/share/krita/pykrita/kritamcp
ln -s /path/to/krita-plugin/kritamcp.desktop ~/.local/share/krita/pykrita/kritamcp.desktop
# macOS
ln -s /path/to/krita-plugin/kritamcp ~/Library/Application\ Support/krita/pykrita/kritamcp
ln -s /path/to/krita-plugin/kritamcp.desktop ~/Library/Application\ Support/krita/pykrita/kritamcp.desktop
# Windows (PowerShell with administrator privileges)
New-Item -ItemType SymbolicLink -Path "$env:APPDATA\krita\pykrita\kritamcp" -Target "C:\path\to\krita-plugin\kritamcp"
New-Item -ItemType SymbolicLink -Path "$env:APPDATA\krita\pykrita\kritamcp.desktop" -Target "C:\path\to\krita-plugin\kritamcp.desktop"
```
### 3. Enable the plugin in Krita
1. Start Krita
2. Open **Settings > Configure Krita > Python Plugin Manager**
3. Check **KritaMCP** to enable it
4. Restart Krita
## Usage
### Start MCP Server
**Method A: Start from within Krita (recommended)**
1. In Krita, enable **Settings > Dockers > KritaMCP**
2. Click the **Start** button in the KritaMCP panel
The plugin will automatically start `kritamcp-server`.
**Method B: Start from the command line**
```bash
kritamcp-server
```
You can change the ports with environment variables:
```bash
MCP_SERVER_PORT=8001 MCP_BRIDGE_PORT=8000 kritamcp-server
```
### AI Client Configuration
Configure the following in your MCP client such as Claude Desktop:
```json
{
"mcpServers": {
"krita": {
"type": "sse",
"url": "http://localhost:8001/sse"
}
}
}
```
## Development
### Dev Container (Docker Environment)
This project includes a Dev Container configuration. The development environment is automatically built in VS Code or Claude Code.
```bash
# After starting the Dev Container
uv sync
```
The following services are started in the Dev Container:
- **dev**: Development container (Python 3.12, uv, Claude Code CLI)
- **krita**: Krita GUI container (accessible from the browser at `localhost:3001`)
### Local Development
```bash
# Editable install
uv tool install -e .
# Reinstall after changes
uv tool install --force -e .
```
### Directory Structure
```
krita-plugin/ # Krita Plugin
├── __init__.py # Entry point
├── kritamcp.desktop # Plugin metadata
└── kritamcp/
├── __init__.py # Extension/Docker widget registration
├── krita_actions.py # Implementation of Krita API operations
├── mcp_client.py # SSE communication client with MCP server
├── server_manager.py # MCP server process management
└── docker_widget.py # Krita UI widget
mcp_server/ # MCP Server
├── __init__.py
├── server.py # Server entry point
├── tools.py # MCP tool definitions
└── krita_bridge.py # Communication bridge with Krita plugin
.devcontainer/ # Dev Container configuration
```
## License
MIT
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
OpenAI Whisper
OpenAI Whisper MCP Server - 基于本地 Whisper CLI 的离线语音识别与翻译,无需 API Key,支持...
markitdown
Python tool for converting files and office documents to Markdown.
oh-my-opencode
Background agents · Curated agents like oracle, librarians, frontend...
chatbox
User-friendly Desktop Client App for AI Models/LLMs (GPT, Claude, Gemini, Ollama...)
continue
Continue is an open-source project for seamless server management.
claude-flow
Claude-Flow v2.7.0 is an enterprise AI orchestration platform.