This project enables non-technical users to edit images with GIMP through simple conversational commands, bridging the gap between GIMP's powerful capabilities and natural language interaction. It also allows professionals to execute complex multi-step workflows faster than traditional point-and-click methods.
Users can describe what they want to achieve - from basic photo adjustments to sophisticated artistic modifications. For example, "brighten the background and add a vintage filter" or "remove the red-eye and sharpen the subject" - and the system translates these requests into precise GIMP operations.
The project is fully functional and exposes all GIMP features via MCP (Model Context Protocol). New in this version: MCP-compliant image export that allows AI assistants like Claude to directly view and analyze your GIMP images!
β¨ MCP-Compliant Image Export: Direct image viewing for AI assistants
π¨ Full GIMP 3.0 API Access: Execute any GIMP operation via PyGObject
π§ Multi-Format Export: PNG, JPEG, BMP, TIFF with quality control
π Image Metadata: Get image info without transferring data
π‘οΈ Robust Error Handling: Multiple fallback methods for reliability
π Universal MCP Support: Works with Claude Desktop, Gemini CLI, PydanticAI, and more
- GIMP 3.0 and above: This project is developed and tested with GIMP 3.0. Earlier versions are not supported.
- MCP-compatible AI client: Claude Desktop, Gemini CLI, PydanticAI, or other MCP clients.
- Python 3.8+: Required for the MCP server.
- uv: A modern Python package installer and resolver.
# Clone the repository
git clone https://github.com/maorcc/gimp-mcp.git
cd gimp-mcp
# Install Python dependencies
uv sync
Copy the gimp-mcp-plugin.py
to your GIMP plug-ins
directory and make it executable.
Quick Install (Linux/macOS):
# For standard GIMP installation
mkdir -p ~/.config/GIMP/3.0/plug-ins/gimp-mcp-plugin
cp gimp-mcp-plugin.py ~/.config/GIMP/3.0/plug-ins/gimp-mcp-plugin/
chmod +x ~/.config/GIMP/3.0/plug-ins/gimp-mcp-plugin/gimp-mcp-plugin.py
# For Snap-installed GIMP
mkdir -p ~/snap/gimp/current/.config/GIMP/3.0/plug-ins/gimp-mcp-plugin
cp gimp-mcp-plugin.py ~/snap/gimp/current/.config/GIMP/3.0/plug-ins/gimp-mcp-plugin/
chmod +x ~/snap/gimp/current/.config/GIMP/3.0/plug-ins/gimp-mcp-plugin/gimp-mcp-plugin.py
Manual Installation:
For detailed instructions on locating your GIMP plugins folder across different operating systems, please refer to this guide:
GIMP Plugin Installation Guide (Wikibooks)
Make sure the plugin file has "execute" permission.
Restart GIMP after installation.
- Open any image in GIMP
- Navigate to Tools > Start MCP Server
- The server will start on
localhost:9877
Add these lines to your Claude Desktop configuration file:
Location: ~/.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"
]
}
}
}
Configure your Gemini CLI MCP server in ~/.config/gemini/.gemini_config.json
:
{
"mcpServers": {
"gimp": {
"command": "uv",
"args": [
"run",
"--directory",
"/full/path/to/gimp-mcp",
"gimp_mcp_server.py"
]
}
}
}
For PydanticAI agents, use the MCPServerStdio class:
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStdio
server = MCPServerStdio(
'uv',
args=[
'run',
'--directory',
'/full/path/to/gimp-mcp',
'gimp_mcp_server.py'
]
)
agent = Agent('openai:gpt-4o', mcp_servers=[server])
For other MCP clients that support stdio transport, use the command:
uv run --directory /full/path/to/gimp-mcp gimp_mcp_server.py
- Start GIMP and open any image
- Start MCP Server: Tools > Start MCP Server
- Launch your MCP client (Claude Desktop, etc.)
- Start creating: "Draw a face and a sheep with GIMP"
"Can you show me the current image in GIMP and tell me what you see?"
Uses get_image_bitmap()
to retrieve and analyze the current canvas
"What are the dimensions and properties of the current image?"
Uses get_image_metadata()
to quickly get image info without transferring bitmap data
"Check if the current image has transparency and multiple layers before applying the effect"
Uses get_image_metadata()
to analyze image structure for intelligent decision making
"What version of GIMP am I working with and what features are available?"
Uses get_gimp_info()
to provide comprehensive environment information for optimal support
"I'm having issues with plugin exports - check my GIMP setup and suggest solutions"
Uses get_gimp_info()
to diagnose installation and configuration problems
"Create a new 800x600 image, draw a blue circle in the center, add a red border, then show me the result"
Combines multiple GIMP operations with image export for verification
The GIMP MCP server provides several tools that AI assistants can use:
get_image_bitmap()
Returns the current image as a base64-encoded PNG bitmap with support for region extraction and scaling.
Parameters:
max_width
(optional): Maximum width for full image scalingmax_height
(optional): Maximum height for full image scalingregion
(optional): Dictionary for region extraction with keys:origin_x
: X coordinate of region top-left cornerorigin_y
: Y coordinate of region top-left cornerwidth
: Width of region to extractheight
: Height of region to extractmax_width
: Maximum width for region scaling (optional)max_height
: Maximum height for region scaling (optional)
Usage Examples:
# Get full image bitmap
result = await client.get_image_bitmap()
# Get full image scaled to max 800x600 (preserves aspect ratio)
result = await client.get_image_bitmap(max_width=800, max_height=600)
# Extract a region (100,100) with size 400x300
result = await client.get_image_bitmap(
region={"origin_x": 100, "origin_y": 100, "width": 400, "height": 300}
)
# Extract region and scale it to 200x150 (preserves aspect ratio)
result = await client.get_image_bitmap(
region={
"origin_x": 100, "origin_y": 100, "width": 400, "height": 300,
"max_width": 200, "max_height": 150
}
)
if result['status'] == 'success':
image_data = result['results']['image_data'] # base64-encoded PNG
width = result['results']['width']
height = result['results']['height']
original_width = result['results']['original_width']
original_height = result['results']['original_height']
processing = result['results']['processing_applied']
- **`get_image_metadata()`**: Get comprehensive image metadata without bitmap data (fast)
### π System Information Tool
- **`get_gimp_info()`**: Get comprehensive GIMP installation and environment information
### π§ API Access Tool
- **`call_api(api_path, args, kwargs)`**: Execute any GIMP 3.0 PyGObject command
### π¨ Common Operations Available
- Create new images and layers
- Draw shapes, lines, and curves
- Apply filters and effects
- Adjust colors and brightness
- Add text and selections
- Copy/paste between images
- Export in various formats
For detailed API documentation, see [GIMP_MCP_PROTOCOL.md](GIMP_MCP_PROTOCOL.md).
## Technical Architecture
### MCP Compliance
- **Image Content**: Returns proper `ImageContent` objects with base64 data and MIME types
- **Error Handling**: Uses MCP-standard exception propagation
- **Tool Metadata**: Comprehensive tool descriptions and parameter schemas
- **Protocol Version**: Compatible with MCP specification 2025-06-18
### GIMP 3.0 Integration
- **PyGObject API**: Direct access to GIMP's Python bindings
- **Persistent Context**: Command execution maintains state between calls
- **Robust Export**: Multiple fallback methods for reliable image export
- **Real-time Updates**: Immediate display refresh with `Gimp.displays_flush()`
## Troubleshooting
### Common Issues
#### "Could not connect to GIMP"
- Ensure GIMP is running with an open image
- Verify the MCP Server is started (Tools > Start MCP Server)
- Check that port 9877 is not blocked by firewall
#### Export Errors
- The plugin includes multiple fallback export methods
- Supports various GIMP 3.0 API versions
- Automatically handles missing export procedures
#### Plugin Not Visible
- Verify plugin is in correct directory with execute permissions
- Restart GIMP after installation
- Check GIMP's error console for plugin loading issues
### Debug Mode
Add debug logging to see detailed MCP communication:
```bash
GIMP_MCP_DEBUG=1 uv run --directory /path/to/gimp-mcp gimp_mcp_server.py
Example output from the prompt "draw me a face and a sheep" using GIMP MCP
We welcome contributions! Here are some areas for improvement:
- π Recipe Collection: Common GIMP workflows as reusable MCP tools
- β©οΈ Undo System: History management and rollback capabilities
- π Visual Feedback: Enhanced progress indicators and operation previews
- π Dynamic Discovery: Auto-generate MCP tools from GIMP's procedure database
- π Enhanced Errors: Context-aware error messages with suggested fixes
- π‘οΈ Resource Management: Better cleanup and error recovery in the plugin
- π Security: Sandboxed execution environment for user commands
- β‘ Performance: Optimized image transfer for large files
- π Remote Access: Support for network-accessible GIMP instances
- π Analytics: Usage metrics and performance monitoring
Contributions are welcome! Whether it's bug fixes, new features, or documentation improvements, feel free to submit a Pull Request or open an issue.