MCP Photoshop Server
An MCP server that provides Photoshop-style layered image editing and AI-powered generation/editing via ComfyUI, including canvas management, filters, masks, and upscaling. Designed for use with Cline and other MCP clients.
README
MCP Photoshop Server
A local MCP (Model Context Protocol) server that combines Photoshop-style image editing with AI image generation powered by ComfyUI.
Designed for use with Cline — an AI-powered coding assistant. This server integrates as an MCP tool provider to enable image generation and editing directly from your Cline workflow.
Features
Canvas Management
new_canvas— Create a blank canvas with custom dimensions and background coloropen_image— Load an existing image fileexport— Save to PNG/JPG/WEBP or return base64 dataget_info— View canvas dimensions, layers, undo/redo state
AI Image Generation & Editing
generate_image— Text-to-image via Flux2 (photorealistic) or ANIMA (anime)img2img— AI instructed editing via Flux Kontextcharacter_transform— Pose/expression/action transforms with identity preservationinpaint— AI fill masked region (requires mask from select_rect/select_ellipse)outpaint— AI extend canvas in a direction (left, right, top, bottom)
AI-Guided Generation
controlnet_generate— Generate image guided by current canvas (depth/canny/pose)style_transfer— Generate image with style of a reference image (Redux StyleModel)
Deterministic Editing (Pillow — no GPU needed)
crop,resize,rotate,flip— Transform operationsadjust— Brightness, contrast, saturation, hue, sharpnesslevels— Black point, mid point (gamma), white point adjustmentcurves— Per-channel tone curves (R/G/B) with control pointsapply_filter— 17 filters: blur, gaussian_blur, sharpen, contour, detail, edge_enhance, edge_enhance_more, find_edges, smooth, smooth_more, emboss, pixelate, posterize, solarize, invert, grayscale, sepiaadd_text— Text overlay with font, color, stroke support
Upscaling
upscale— AI upscaling via ComfyUI (ESRGAN/SUPIR models)
Layer System
add_layer,select_layer,delete_layer,merge_down,reorder_layerset_blend_mode— 12 modes: normal, multiply, screen, overlay, darken, lighten, color_dodge, color_burn, hard_light, soft_light, difference, exclusionset_layer_opacity— Per-layer transparency
Selections & Masks
select_rect— Rectangular maskselect_ellipse— Elliptical maskselect_object— Heuristic color/region selection (red, blue, sky, dark, etc.)clear_mask— Remove layer mask
History
undo/redo— Full operation history (up to 20 steps)
System
get_comfyui_status— Check ComfyUI connectionclear_vram— Free GPU memory
Installation
Prerequisites
-
Python 3.10+
-
ComfyUI installed (auto-start supported — the server automatically launches ComfyUI when needed via
COMFYUI_PYTHON+COMFYUI_MAINenv vars. You can also start ComfyUI manually on port 8188 if preferred.) -
⚠️ VRAM Warning: Running ComfyUI without auto-kill causes major OOM on shared GPUs (e.g., 32GB GPU with vLLM). Set
COMFYUI_AUTO_KILL=1(recommended) withCOMFYUI_IDLE_TIMEOUT=5to kill ComfyUI 5 seconds after each task, preventing resource exhaustion and Cline freezes. -
Required models installed in ComfyUI:
Flux2 Klein (photorealistic generation):
flux-2-klein-9b.safetensors(diffusion_models) — IMPORTANT: use 4-6 steps max. Image quality actively diminishes after ~6 steps (artifacts, over-smoothing) and latency increases linearly with each additional step.qwen_3_8b_fp8mixed.safetensors(text_encoders) — Flux2 Klein text encoderflux2-vae.safetensors(vae) — Flux2 Klein VAE
ANIMA (anime generation):
anima-aesthetic-v1.1.safetensors(diffusion_models)qwen_3_06b_base.safetensors(text_encoders)qwen_image_vae.safetensors(vae)
Flux Kontext (img2img, inpaint, outpaint):
flux1-dev-kontext_fp8_scaled.safetensors(diffusion_models)
Upscaling:
RealESRGAN_x4plus_anime_6B.pth(upscale_models) — Anime upscaling4xFaceUpDAT.pth(upscale_models) — Face upscaling
ControlNet:
control_v11f1p_sd15_depth_fp16.safetensors(controlnet) — Depth guidancecontrol_v11p_sd15_canny_fp16.safetensors(controlnet) — Canny guidancecontrol_v11p_sd15_openpose_fp16.safetensors(controlnet) — Pose guidance
Style Transfer:
flux1-redux-dev.safetensors(style_models) — Redux style transfer
Install Dependencies
cd mcp-photoshop-server
pip install -r requirements.txt
Configure MCP Client
Add to your MCP client configuration (e.g., Claude Desktop claude_desktop_config.json):
{
"mcpServers": {
"photoshop": {
"command": "python",
"args": ["<path-to-server>/server.py"],
"env": {
"COMFYUI_URL": "http://127.0.0.1:8188",
"COMFYUI_PYTHON": "<path-to-comfyui>/python_embeded/python.exe",
"COMFYUI_MAIN": "<path-to-comfyui>/ComfyUI/main.py",
"COMFYUI_AUTO_KILL": "1",
"COMFYUI_IDLE_TIMEOUT": "5",
"VRAM_PRESSURE_THRESHOLD_MB": "8192"
}
}
}
}
Environment Variables
See .env_example for a complete reference. Key variables:
| Variable | Default | Description |
|---|---|---|
COMFYUI_URL |
http://127.0.0.1:8188 |
ComfyUI API endpoint |
COMFYUI_START_CMD |
(optional) | Path to ComfyUI start .bat (alternative to COMFYUI_PYTHON + COMFYUI_MAIN) |
COMFYUI_PYTHON |
(required for auto-start) | Path to ComfyUI's embedded python.exe |
COMFYUI_MAIN |
(required for auto-start) | Path to ComfyUI's main.py |
COMFYUI_ARGS |
--windows-standalone-build |
Extra startup arguments |
COMFYUI_AUTO_KILL |
1 (recommended) |
Kill after generation (0=VRAM pressure mode, 1=idle timeout mode) |
COMFYUI_IDLE_TIMEOUT |
5 |
Seconds of inactivity before auto-kill (when AUTO_KILL=1) |
COMFYUI_START_TIMEOUT |
180 |
Seconds to wait for ComfyUI to start |
VRAM_PRESSURE_THRESHOLD_MB |
8192 |
Kill ComfyUI if free VRAM drops below this (MB) |
WEBSOCKET_TIMEOUT |
600 |
Seconds to wait for workflow completion |
MAX_UNDO_STEPS |
20 |
Maximum undo history entries |
LOG_LEVEL |
WARNING |
Logging verbosity (DEBUG, INFO, WARNING, ERROR) |
Architecture
mcp-photoshop-server/
├── server.py # MCP server + 36 tool registrations
├── config.py # Configuration & model names
├── comfy_client.py # ComfyUI API client (REST + WebSocket)
├── canvas.py # Layered document with blend modes + undo/redo
├── session.py # Per-session document management
├── requirements.txt # Python dependencies
├── MEMORY.md # Project memory bank
├── .env_example # Environment variable template
├── .gitignore # Git ignore rules
└── README.md
Design Philosophy
- AI operations (generation, inpainting, transforms, ControlNet, style) → routed through ComfyUI
- Deterministic edits (crop, resize, adjustments, filters) → executed locally with Pillow (fast, no GPU)
- Layered document model → mirrors Photoshop's mental model with blend modes, masks, and undo history
Usage Examples
Generate and Edit
1. generate_image(prompt="a cat wearing sunglasses on a beach")
2. adjust(brightness=1.2, saturation=1.3)
3. apply_filter(name="sharpen")
4. export(path="output/cat.png")
Layer Compositing
1. open_image(path="background.jpg")
2. add_layer(name="overlay", source_path="overlay.png")
3. set_blend_mode(mode="multiply")
4. set_layer_opacity(opacity=0.7)
5. export(path="output/composite.png")
AI Edit Workflow
1. open_image(path="portrait.jpg")
2. img2img(prompt="change background to a forest at sunset")
3. undo # if not satisfied
4. img2img(prompt="make the lighting warmer and softer")
5. adjust(contrast=1.1)
6. export(path="output/edited.jpg", format="JPG")
Inpainting Workflow
1. open_image(path="photo.jpg")
2. select_rect(x=100, y=50, width=200, height=150)
3. inpaint(prompt="a red rose bouquet")
4. export(path="output/inpainted.png")
Upscaling
1. open_image(path="small_photo.jpg")
2. upscale(model="4x_NMKD-Siax_200k.pth")
3. export(path="output/upscaled.png")
ControlNet Guided Generation
1. open_image(path="sketch.png")
2. controlnet_generate(prompt="a detailed cityscape", controlnet="canny", strength=0.8)
3. export(path="output/cityscape.png")
Style Transfer
1. open_image(path="photo.jpg")
2. style_transfer(prompt="the same scene", style_path="painting.jpg", strength=0.8)
3. export(path="output/styled.png")
Future Work
- [ ] SAM-based semantic selection (replace heuristic with real segmentation model)
- [ ] Batch processing / multi-session support
- [ ] Additional ComfyUI custom nodes integration
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。