β οΈ Work in Progress: This project is functional but still under active development. While the core features are working, thorough testing and additional functionality are being added. Expect changes and improvements in upcoming releases.
A Model Context Protocol (MCP) server that enables live control of GIMP through natural language instructions. This allows AI assistants like Claude to directly manipulate images in real-time.
- π― Live Instance Control - Direct manipulation of running GIMP documents
- β‘ D-Bus Integration - Real-time communication with GIMP 3
- π Python Code Execution - Run arbitrary GIMP API code in live context
- π Document Info - Get image dimensions, layers, and properties
- πΈ Screenshot Support - Visual feedback with viewport capture
- π Automatic Setup - Virtual environment created on first run
β οΈ Currently Linux Only - Uses D-Bus which is Linux-specific- Requires GIMP 3 - Uses new Python 3 plugin architecture with GObject Introspection
- Go to the Releases page
- Download
gimpmcp-plugin.zipfrom the latest release - Extract to your GIMP plugins directory:
cd ~/.config/GIMP/3.0/plug-ins/ unzip ~/Downloads/gimpmcp-plugin.zip chmod +x gimpmcp/gimpmcp.py chmod +x gimpmcp/gimpmcp/run_gimp_mcp.sh
-
Launch GIMP:
gimp
-
Enable MCP D-Bus service in GIMP:
- Go to: Filters > Development > MCP D-Bus - Start
- β The service will remain active until you close GIMP
- You only need to do this once per GIMP session
Auto-Setup: The first time an AI client connects, it will automatically:
- Create Python virtual environment in
gimpmcp/venv/ - Install all required dependencies from
requirements.txt - Start the MCP server
No manual setup required!
Edit your Claude configuration file (~/.claude.json):
{
"mcpServers": {
"gimp-mcp": {
"type": "stdio",
"command": "/path/to/gimpmcp/gimpmcp/run_gimp_mcp.sh",
"args": [],
"env": {}
}
}
}Update Claude desktop app settings:
{
"mcpServers": {
"gimp-mcp": {
"command": "/path/to/gimpmcp/gimpmcp/run_gimp_mcp.sh"
}
}
}For Gemini, edit settings file (~/.gemini/settings.json):
{
"mcpServers": {
"gimp-mcp": {
"command": "/path/to/gimpmcp/gimpmcp/run_gimp_mcp.sh"
}
}
}For Codex, edit configuration (~/.codex/config.toml):
[mcp_servers.gimp-mcp]
command = "/path/to/gimpmcp/gimpmcp/run_gimp_mcp.sh"Once configured, you can use natural language to control GIMP:
Create a new 800x600 image with a red circle in the center
Get information about the current document
Take a screenshot of the current viewport
The client can also be used directly for manual testing:
# Get document info
python gimpmcp_client.py get-info ""
# Get viewport screenshot
python gimpmcp_client.py get-viewport-screenshot "format=png max_size=400"
# Execute Python code
python gimpmcp_client.py execute-code "code='print(\"Hello GIMP\")'"
# Execute code from file
python gimpmcp_client.py execute-code -f my_script.py
# Get structured JSON output
python gimpmcp_client.py get-info "" --parse-out --prettyThe GIMP MCP follows a clean architecture pattern:
AI Client β MCP Server β CLI Client β D-Bus β GIMP Plugin β Live Document
gimpmcp.py: GIMP 3 plugin that exposes D-Bus interfacegimpmcp/gimp_mcp_server.py: MCP server with tool definitions and docstrings for AIgimpmcp/gimpmcp_client.py: Client that handles all command logic (used by both server and manual testing)gimpmcp/run_gimp_mcp.sh: Wrapper script for automatic venv setup
Key Design: No code duplication! The server simply wraps client functions with MCP tool decorators. The same code runs for both AI assistant usage and manual CLI testing.
When your code executes in GIMP, you have access to:
Gimp- Main GIMP module (gi.repository.Gimp)GimpUi- GIMP UI moduleGegl- GEGL image processing libraryGObject,Gio,GLib- GTK/GNOME librariesimage- The active GIMP image objectdrawables- List of selected drawablespdb- GIMP Procedural Database (Gimp.get_pdb())
# Get active layer
layer = image.get_active_layer()
print(f"Active layer: {layer.get_name() if layer else 'None'}")
# Create new layer
new_layer = Gimp.Layer.new(
image,
"AI Generated Layer",
image.get_width(),
image.get_height(),
Gimp.ImageType.RGBA_IMAGE,
100.0,
Gimp.LayerMode.NORMAL
)
image.insert_layer(new_layer, None, 0)
# Set layer opacity
layer.set_opacity(50.0)# Invert colors
procedure = pdb.lookup_procedure("gimp-drawable-invert")
config = procedure.create_config()
config.set_property("drawable", image.get_active_layer())
procedure.run(config)
# Apply Gaussian blur
procedure = pdb.lookup_procedure("plug-in-gauss")
config = procedure.create_config()
config.set_property("run-mode", Gimp.RunMode.NONINTERACTIVE)
config.set_property("image", image)
config.set_property("drawable", image.get_active_layer())
config.set_property("horizontal", 5.0)
config.set_property("vertical", 5.0)
procedure.run(config)# Create rectangular selection
image.select_rectangle(Gimp.ChannelOps.REPLACE, 100, 100, 300, 200)
# Set foreground color
Gimp.context_set_foreground(Gegl.Color.new("red"))
# Fill selection
layer = image.get_active_layer()
procedure = pdb.lookup_procedure("gimp-drawable-edit-fill")
config = procedure.create_config()
config.set_property("drawable", layer)
config.set_property("fill-type", Gimp.FillType.FOREGROUND)
procedure.run(config)
# Remove selection using PDB
procedure = pdb.lookup_procedure("gimp-selection-none")
config = procedure.create_config()
config.set_property("image", image)
procedure.run(config)
# Update display
Gimp.displays_flush()# Get image dimensions
width = image.get_width()
height = image.get_height()
print(f"Image size: {width}x{height}")
# List all layers
layers = image.get_layers()
for layer in layers:
print(f"Layer: {layer.get_name()}")- MCP Server receives request - AI client sends command
- Server calls client function - Uses shared
execute_gimp_command()from client - Client builds code - Generates Python code for the command
- D-Bus call - Client calls D-Bus method
ExecuteCodeonorg.gimp.mcp.Bridge - Plugin receives request - GIMP plugin handles D-Bus method call
- Execute in GIMP - Code executes with full GIMP API access
- Return response - Plugin returns result via D-Bus
- Format and return - Server formats response for AI client
- Service Name:
org.gimp.mcp.Bridge - Object Path:
/org/gimp/mcp/Bridge - Interface:
org.gimp.mcp.Bridge - Method:
ExecuteCode(code: str) -> str(returns JSON)
# Check if service is running
gdbus introspect --session --dest org.gimp.mcp.Bridge --object-path /org/gimp/mcp/Bridge
# List registered services
gdbus list | grep org.gimp.mcp.Bridge
# Execute code
gdbus call --session --dest org.gimp.mcp.Bridge --object-path /org/gimp/mcp/Bridge --method org.gimp.mcp.Bridge.ExecuteCode 'print("Hello GIMP")'- β Make sure GIMP is running
- β Enable MCP D-Bus service: Filters > Development > MCP D-Bus - Start
- β
Check service is registered:
gdbus list | grep org.gimp.mcp.Bridge
The run_gimp_mcp.sh script automatically sets required environment variables:
XDG_RUNTIME_DIRDBUS_SESSION_BUS_ADDRESS
- Check that folder name and file name match:
gimpmcp/gimpmcp.py - Make sure the file is executable:
chmod +x gimpmcp/gimpmcp.py - Restart GIMP