by maorcc
Edit images in GIMP via natural‑language commands, enabling AI agents to drive GIMP operations through the MCP interface.
Gimp Mcp provides a bridge between conversational AI clients (Claude Desktop, Gemini CLI, PydanticAI, etc.) and GIMP. By exposing the full GIMP API as MCP tools, users can describe desired image edits in plain language and have the system translate those requests into precise GIMP actions.
gimp-mcp-plugin.py into GIMP’s plug-ins folder and ensure it is executable.uv run --directory <path>/gimp-mcp-server server.py (examples provided for Claude Desktop, Gemini CLI, and PydanticAI).uv run --directory <path> server.py and point the client to it.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
# 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):
# 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
Quick Install (macOS):
mkdir -p ~/Library/Application\ Support/GIMP/3.0/plug-ins/gimp-mcp-plugin
cp gimp-mcp-plugin.py ~/Library/Application\ Support/GIMP/3.0/plug-ins/gimp-mcp-plugin/
chmod +x ~/Library/Application\ Support/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.
localhost:9877Add 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
"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 Tools
- **`get_gimp_info()`**: Get comprehensive GIMP installation and environment information
- **`get_context_state()`**: Get current GIMP context state (colors, brush, feathering, opacity)
Returns current GIMP context state including foreground/background colors, brush, opacity, paint mode, feather settings, and antialiasing state.
### 🔧 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:
Contributions are welcome! Whether it's bug fixes, new features, or documentation improvements, feel free to submit a Pull Request or open an issue.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by activepieces
A self‑hosted, open‑source platform that provides a no‑code builder for creating, versioning, and running AI‑driven automation workflows. Pieces are TypeScript‑based plugins that become MCP servers, allowing direct consumption by large language models.
by Skyvern-AI
Automates browser‑based workflows by leveraging large language models and computer‑vision techniques, turning natural‑language prompts into fully functional web interactions without writing custom scripts.
by ahujasid
Enables Claude AI to control Blender for prompt‑assisted 3D modeling, scene creation, and manipulation via a socket‑based Model Context Protocol server.
by PipedreamHQ
Connect APIs quickly with a free, hosted integration platform that enables event‑driven automations across 1,000+ services and supports custom code in Node.js, Python, Go, or Bash.
by elie222
Organizes email inbox, drafts replies in the user's tone, tracks follow‑ups, and provides analytics to achieve inbox zero quickly.
by grab
Enables Cursor AI to read and programmatically modify Figma designs through a Model Context Protocol integration.
by CursorTouch
Enables AI agents to control the Windows operating system, performing file navigation, application launching, UI interaction, QA testing, and other automation tasks through a lightweight server.
by ahujasid
Enables Claude AI to control Ableton Live in real time, allowing AI‑driven creation, editing, and playback of tracks, clips, instruments, and effects through a socket‑based server.
by leonardsellem
Provides tools and resources to enable AI assistants to manage and execute n8n workflows via natural language commands.