gimp-mcp
Provides tools for image editing via GIMP, enabling AI agents to perform adjustments, transforms, selections, layer operations, drawing, text, filters, and more, with live visual feedback for iterative workflows.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gimp-mcpRemove the background from this image and verify it's clean."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GIMP MCP
Fork of maorcc/gimp-mcp with fixes and improvements. All credit for the original project goes to @maorcc. This fork keeps the original GPLv3 license (see
LICENSE).
My changes / Mis cambios
Changes on top of the upstream project:
export_imagefix — use GIMP 3.2'sfile-*-exportprocedures. The oldfile-*-savenames don't exist in 3.2, so every export silently fell back to PNG regardless of the requestedformat/quality.MCP socket recovery fixes — the plugin's accept loop now clears its
runningflag when it exits, and Restart MCP Server actually spawns a fresh accept thread. A dropped socket now recovers from the GIMP menu instead of needing a full restart.LEARNINGS.md— a running log of gotchas learned working with this plugin (plugin reload, socket limits, drawing pitfalls, rembg background removal, etc.).
Staying in sync with upstream
This fork keeps the original repo as the upstream remote. To pull in later changes from maorcc/gimp-mcp:
git fetch upstream
git merge upstream/mainRelated MCP server: gimp-mcp
Demo

Full demo (with audio): https://github.com/maorcc/gimp-mcp/raw/main/docs/demo.mp4
AI agent using GIMP MCP to remove a background, edit a character's expression, and verify results — all through natural language via Claude
Overview
GIMP MCP bridges GIMP's professional image editing capabilities with AI assistants through the Model Context Protocol. It lets you edit images by describing what you want — and gives the AI a live visual feedback channel to verify each change before moving on.
What makes it different from other GIMP integrations:
The AI can see the image at any point in the workflow without saving to disk (
get_state_snapshot)Supports fully autonomous multi-step pipelines: open → edit → verify → refine → export
56 dedicated tool commands covering every major GIMP operation
Fully compatible with GIMP 3.2.x (all breaking API changes resolved)
Key Features
👁️ Live Visual Feedback |
|
🎨 56 GIMP Tools | Adjustments, transforms, selections, layers, drawing, text, filters — all via MCP |
🔧 GIMP 3.2 Compatible | All GIMP 3.2 API breaks fixed and tested (56/56 passing) |
🔁 Iterative Workflows | AI loops until a goal is met — e.g. keeps removing BG until no pixels remain |
🖼️ Region Snapshots | Zoom into any area for detail verification (face, mouth, corner, etc.) |
🔌 Universal MCP | Works with Claude Desktop, Claude Code, Gemini CLI, PydanticAI, and more |
What Can It Do?
Background Removal with Iterative Verification
The AI removes the background, takes a snapshot to inspect the result, detects remaining pixels, and loops until the image is clean:
"Remove the background from this image and keep looping until only the character remains"Expression Editing
"Make the character smile — paint a smile arc with teeth over her mouth"Complex Multi-Step Pipelines
"Open navi_portrait.png, remove the background, verify it's clean,
then make her smile and export the final result as a PNG"Color & Tone Work
"Boost the contrast, shift the hue 15 degrees warmer, then show me a before/after zoom of the face"Text & Compositing
"Add a bold title at the top in white with a subtle drop shadow, then export for web"Prerequisites
GIMP 3.2+ — tested on GIMP 3.2.2 (Windows, macOS, Linux)
Python 3.8+ — for the MCP server
uv — Python package manager (
pip install uv)MCP-compatible AI client — Claude Desktop, Claude Code, Gemini CLI, PydanticAI, etc.
Quick Start
1. Install Dependencies
git clone https://github.com/maorcc/gimp-mcp.git
cd gimp-mcp
uv sync2. Install the GIMP Plugin
Copy gimp-mcp-plugin.py to GIMP's plug-ins directory and restart GIMP.
Which directory? GIMP names its per-user folder after its major.minor version (
3.0,3.2,3.4, …) and creates a fresh one on each minor upgrade, so the folder moves when you upgrade GIMP (e.g.3.0→3.2). The snippet below auto-selects the newest one, so it keeps working across upgrades. To check the path manually, open GIMP and look at Edit → Preferences → Folders → Plug-ins.Launch GIMP at least once before running this, so its config folder exists.
macOS / Linux:
# Pick the base directory for your platform:
BASE="$HOME/Library/Application Support/GIMP" # macOS
# BASE="$HOME/.config/GIMP" # Linux (standard)
# BASE="$HOME/snap/gimp/current/.config/GIMP" # Linux (Snap)
# Auto-select the newest GIMP 3.x config directory (3.0, 3.2, 3.4, ...):
GIMP_DIR="$(ls -d "$BASE"/3.* 2>/dev/null | sort -V | tail -1)"
if [ -z "$GIMP_DIR" ]; then
echo "No GIMP 3.x config dir found under $BASE — launch GIMP once, then re-run." >&2
exit 1
fi
mkdir -p "$GIMP_DIR/plug-ins/gimp-mcp-plugin"
cp gimp-mcp-plugin.py "$GIMP_DIR/plug-ins/gimp-mcp-plugin/"
chmod +x "$GIMP_DIR/plug-ins/gimp-mcp-plugin/gimp-mcp-plugin.py"
echo "Installed into: $GIMP_DIR/plug-ins/gimp-mcp-plugin"Windows:
%APPDATA%\GIMP\<VERSION>\plug-ins\gimp-mcp-plugin\gimp-mcp-plugin.pyReplace <VERSION> with your GIMP major.minor (e.g. 3.2). No chmod needed on Windows. Just copy and restart GIMP.
For all platforms: GIMP Plugin Installation Guide
3. Start the MCP Server in GIMP
Open any image in GIMP
Go to Tools > MCP > Start MCP Server
Server starts on
localhost:9877
4. Configure Your MCP Client
Claude Desktop
~/.config/Claude/claude_desktop_config.json (Linux/macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"gimp": {
"command": "uv",
"args": ["run", "--directory", "/full/path/to/gimp-mcp", "gimp_mcp_server.py"]
}
}
}Claude Code
cd /path/to/gimp-mcp
claude # .mcp.json is auto-detectedOr manually:
claude mcp add gimp-mcp -- uv run --directory /full/path/to/gimp-mcp gimp_mcp_server.pyGemini CLI
~/.config/gemini/.gemini_config.json:
{
"mcpServers": {
"gimp": {
"command": "uv",
"args": ["run", "--directory", "/full/path/to/gimp-mcp", "gimp_mcp_server.py"]
}
}
}PydanticAI
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStdio
server = MCPServerStdio('uv', args=['run', '--directory', '/path/to/gimp-mcp', 'gimp_mcp_server.py'])
agent = Agent('openai:gpt-4o', mcp_servers=[server])Available MCP Tools
👁️ Visual Feedback
get_state_snapshot(image_index, max_size, region, label)
Returns a live PNG of the current image state — the AI's primary feedback mechanism. Call this between any edits to verify the result without saving to disk.
# Full image snapshot
snapshot = get_state_snapshot(max_size=512)
# Zoom into a face region for detail inspection
snapshot = get_state_snapshot(
region={"x": 140, "y": 80, "width": 240, "height": 300},
max_size=512,
label="face-check"
)This enables iterative agentic workflows: edit → snapshot → assess → refine → repeat.
get_image_bitmap(image_index, max_width, max_height, region)
Lower-level bitmap fetch with region extraction and scaling. Returns base64-encoded PNG.
🎨 Adjustments
Tool | Description |
| Brightness and contrast |
| Curves by channel (RGB/R/G/B/A) |
| Hue, saturation, lightness |
| Shadows/midtones/highlights color balance |
| Auto-stretch levels |
| Convert to grayscale (keep RGB mode) |
| Invert all channels |
| Unsharp mask sharpening |
| Gaussian blur |
| Noise reduction |
🔄 Transforms
Tool | Description |
| Scale to exact dimensions |
| Scale within bounding box (aspect-safe) |
| Crop to rectangle |
| Rotate 90/180/270 or arbitrary angle |
| Flip horizontal or vertical |
| Resize canvas without scaling content |
✂️ Selections
Tool | Description |
| Rectangular marquee |
| Elliptical marquee |
| Select by color (global) |
| Select all / deselect |
| Invert selection |
| Grow, shrink, feather, or border |
🗂️ Layers
Tool | Description |
| New empty layer |
| Duplicate active layer |
| Delete named layer |
| Rename layer |
| Opacity, blend mode, visibility |
| Move layer in stack |
| Flatten visible to one layer |
| Flatten all layers |
| List all layers with properties |
🖌️ Drawing & Fill
Tool | Description |
| Fill entire layer with color |
| Fill selection (foreground/background/transparent) |
| Fill a rectangle region |
| Fill an ellipse region |
| Draw a line (pencil or paintbrush) |
| Draw a rectangle outline |
| Draw an ellipse outline |
| Apply linear or radial gradient |
| Set foreground/background colors |
🔤 Text
Tool | Description |
| Add a text layer |
| Edit existing text layer |
| List available fonts |
✨ Filters & Effects
Tool | Description |
| Gaussian blur filter |
| Pixelate/mosaic effect |
| Emboss effect |
| Vignette darkening |
| Add noise/grain |
| Drop shadow effect |
📁 File Operations
Tool | Description |
| Open image file |
| Export to PNG, JPEG, BMP, TIFF |
| Create blank canvas |
| Close image |
| List open images |
🔍 Info & Context
Tool | Description |
| Image size, mode, layers, filename |
| GIMP version, platform, capabilities |
| Current colors, brush, opacity, mode |
| Color value at a specific pixel |
| Histogram data for a channel |
| Current selection bounds |
AI Agent Feedback Loop
The get_state_snapshot tool enables a pattern where the AI loops until a goal is visually confirmed:
┌─────────────┐
│ Apply edit │
└──────┬──────┘
│
▼
┌─────────────────┐
│ get_state_ │ ← AI sees live PNG, no disk save needed
│ snapshot() │
└──────┬──────────┘
│
▼
┌─────────────────┐ ┌──────────────────┐
│ Goal achieved? │─ No─▶ Adjust & retry │
└──────┬──────────┘ └──────────────────┘
│ Yes
▼
┌─────────────┐
│ Export │
└─────────────┘Example: Iterative Background Removal
See bg_remove_iterative.py for a complete example. The AI:
Removes the background using edge-seeded contiguous select
Takes a snapshot to check the result
Scans for remaining background-colored pixels
Runs targeted removal passes with progressively finer grids (25px → 1px)
Runs a final despeckle pass for isolated pixels
Loops until no background pixels remain
Example Scripts
Script | Description |
56-test suite — run against your GIMP to verify all tools work | |
Iterative BG removal with snapshot checkpoints | |
Simple single-pass background removal | |
Full pipeline: open → remove BG → edit expression → export |
Run the test suite to verify your setup:
python run_tests.py
# Expected: 56/56 PASSEDTechnical Architecture
Plugin ↔ Server Communication
AI Client (Claude, etc.)
│ MCP (stdio)
▼
gimp_mcp_server.py ← MCP tool definitions
│ TCP JSON :9877
▼
gimp-mcp-plugin.py ← Runs inside GIMP process
│ PyGObject
▼
GIMP 3.2 (gi.repository.Gimp)MCP server translates tool calls into JSON commands sent to the plugin over TCP
Plugin executes operations directly in the GIMP process via PyGObject
Two message formats:
{"type": "...", "params": {...}}for named tools,{"cmds": ["python..."]}for arbitrary exec
GIMP 3.2 Compatibility Notes
GIMP 3.x introduced breaking API changes from GIMP 2.x. Key fixes included in this release:
Issue | Fix |
|
|
| Use PDB |
| Use GEGL |
| Use |
| Convert via |
| Use PDB |
| Use |
Troubleshooting
"Could not connect to GIMP"
GIMP must be running with an image open
Start the MCP server: Tools > Start MCP Server
Check port 9877 is not blocked by firewall
Plugin Not Visible in GIMP
Look under Tools > MCP (the plugin adds an
MCPsubmenu, not a top-levelToolsentry)Confirm the plugin file is in the correct directory (see install steps above)
Upgraded GIMP recently? A minor upgrade (e.g. 3.0 → 3.2) moves the per-user config folder to a new version directory; reinstall the plugin into the new version's
plug-insfolder. Verify the active path via Edit > Preferences > Folders > Plug-ins.On Linux/macOS: ensure the file has execute permission (
chmod +x)Restart GIMP after installation
Check Filters > Script-Fu > Console for error messages
Tests Failing
Run the test suite and check the failure list:
python run_tests.pyEach failure includes the tool name and error — most issues on GIMP 3.2 are covered by the fixes above.
Debug Mode
GIMP_MCP_DEBUG=1 uv run --directory /path/to/gimp-mcp gimp_mcp_server.pyExample Output
"Draw me a face and a sheep" — generated entirely through natural language via GIMP MCP
Future Enhancements
📚 Recipe Collection: Reusable workflow templates (portrait cleanup, product photo, etc.)
↩️ Undo System: History management and rollback via MCP
🚀 Dynamic Discovery: Auto-generate MCP tools from GIMP's full PDB procedure database
🔒 Security: Sandboxed execution for untrusted command inputs
⚡ Performance: Optimized bitmap transfer for large images
🌐 Remote Access: Network-accessible GIMP instances
Contributing
Contributions are welcome — bug fixes, new tools, documentation, or example scripts. Open a PR or issue on GitHub.
Development Setup
Install dev dependencies and activate the pre-commit hook so ruff runs on every commit:
uv sync
uv run pre-commit installAfter this, ruff checks staged files on each git commit (with --fix applied automatically). The same check runs in CI, so the hook is just a fast local safety net.
To bump the pinned hook versions later:
uv run pre-commit autoupdateThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pflerman/gimp-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server