pedit
pedit is an MCP server for non-destructive, layered image editing that an AI agent can drive directly, combining document/layer management, effects, masks, and local-or-cloud AI image tools.
Projects: create (presets, custom size, or from an image), open, save, inspect, configure (name, background, dpi), undo/redo.
Layers: add images, text, vector shapes, solid/gradient fills, and adjustment layers; rename, reorder, group/ungroup, duplicate, rasterize, merge down, flatten, delete.
Layer properties: visibility, lock, opacity, clipping masks, 27 blend modes, transforms (move/scale/rotate/flip/crop), alignment, and per-type text/shape/fill editing.
Masks: rect/ellipse/image/paint masks with feather, invert, density; paint-stroke refinement (hide/reveal); update or remove masks.
Effects & looks: catalogue and apply filters/layer styles, add/update/remove/reorder effects, apply ready-made looks as adjustment layers or per-layer effects.
Canvas: crop, resize (canvas or whole document), generative or classic expand, subject bounding box.
AI tools: background removal, inpaint/object removal/spot healing, text-to-image, image-to-image, generative fill/expand, upscaling, image description, auto-enhance, color matching — locally (ComfyUI/ONNX/OpenCV) or via user API keys (OpenAI, Gemini, Stability, OpenRouter, Replicate, Ollama).
AI configuration: check availability/status and set service models, URLs, and defaults.
Inspect & verify: render previews (zoom, grid, single layer), measure brightness/contrast/clipping/color cast/sharpness, and review for warnings like off-canvas text or blown highlights.
Efficiency: batch many edits in one atomic, single-undo call (optionally returning a preview).
UI & output: open/close the live web editor, export images (png/jpg/webp/avif/tif, quality, scale, transparency, region), and report issues.
Integrates with Google Gemini to provide online AI image generation/editing (e.g. Nano Banana), image-to-text/description, and assistant/image model capabilities for pedit's AI tools.
Integrates with a local Ollama instance as an OpenAI-compatible model backend and local vision model for image-to-text/description tasks.
Integrates with OpenAI's API to provide online AI image generation/editing (e.g. GPT Image), image-to-text/description, and OpenAI-compatible assistant and image model backends for pedit's AI tools.
Integrates with Replicate to run online AI models such as FLUX for text-to-image, image-to-image, generative fill/expand, and upscaling within pedit.
Click on "Deploy 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., "@pedit remove the background and put this photo on a soft blue gradient"
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.
You say what you want in plain words — "remove the background, extend the sky, make it warmer" — and it works on real layers while you watch. Grab the mouse and fix anything at any point. Works with Claude Code, Cursor, Codex, VS Code and any Model Context Protocol client.
🇮🇹 Italiano: README.it.md · Sister project for video: editorvideo-ai (vedit)
Install — 3 steps
1. Install uv (it installs Python apps for you), then close and reopen the terminal.
Windows (PowerShell) | macOS | Linux |
|
|
|
2. Install pedit
uv tool install "pedit-mcp[ai]"[ai] adds local background removal and object removal.
3. Open the editor
pedit uiThe editor opens at http://127.0.0.1:8770. Optional — let Claude Code edit for you:
claude mcp add pedit -- pedit-mcp. Something wrong? pedit doctor says what is missing.
Related MCP server: NeuroPaint-X
What it is
pedit is an image editor of the ordinary kind: a canvas, a stack of layers, masks, blend modes, adjustment layers, filters, layer styles, a brush, text and shapes.
The difference is that everything you can do with the mouse, an AI can also do on command — the buttons, the built-in assistant and any MCP agent call the exact same operations. Nothing is AI-only, nothing is mouse-only. So instead of twenty minutes with the pen tool you type:
"Remove the background, put her on a soft blue gradient, warm it up a little, and add the title at the bottom with a subtle shadow."
and the layers appear in the panel, one by one. Wrong shadow? Click the layer and drag the slider.
Nothing is destructive. A filter is an entry in the layer's effects, a look is an adjustment layer, the AI cut-out is a mask, an object removal is a patch on a new layer. Your photo is never rewritten, and every step undoes with Ctrl+Z.
What makes it work
An agent can actually edit | 62 MCP tools that are the same operations as the buttons: layers and groups, clipping masks, painted masks, transforms, 33 filters and styles, 27 blend modes, looks, clone stamp, crop, resize, AI tools, export. |
The agent sees what it did |
|
It checks its own work |
|
AI locally, or online with your key | Background removal (rembg/ONNX), object removal and spot healing (OpenCV, or a numpy fallback), and — with ComfyUI or an online service — text-to-image, image-to-image, generative fill, generative expand and model upscaling. Online services with your own API key: OpenAI (GPT Image), Google Gemini (Nano Banana), Stability AI, OpenRouter, Replicate (FLUX…), any OpenAI-compatible endpoint; image-to-text with Gemini, OpenAI, Claude or a local Ollama vision model. |
Same document, same pixels | The document is a JSON file and the render is a pure function of it: the preview, what the agent sees and the exported file come out of the same code. |
Driving it from an agent (MCP)
The running editor is an MCP server at http://127.0.0.1:8770/mcp/. An agent connected
there works on the document open in your browser, live:
claude mcp add --transport http pedit-live http://127.0.0.1:8770/mcp/Or the classic stdio server, for agents that start without a UI (open_ui opens the editor on
the agent's document later):
claude mcp add pedit -- uvx pedit-mcpSame JSON for Cursor, Codex, VS Code: { "mcpServers": { "pedit": { "command": "pedit-mcp" } } }.
Typical flow:
project_create / project_open(photo) → add_image / add_text / add_shape / add_fill
→ analyze_image → auto_enhance or add_adjustment → apply_look
→ remove_background / set_mask / mask_stroke / inpaint / edit_image / expand_canvas
→ preview (look!) → review_image → export_imagebatch applies a list of edits in one atomic call with one undo step, and batch(look=true)
returns the preview in the same round trip. The editing rules (look before claiming done,
measure before correcting, base before style, stay non-destructive, never export unasked) ship
inside the server instructions, so every client gets them.
The web interface
┌──────────────────────────────────────────────────────────────────────┐
│ New · Open · Save · ↶↷ · Import · Generate · Auto enhance · AI models│
│ tool options (brush size, text, selection actions…) │
├────┬──────────────────────────────────────────┬──────────────────────┤
│ ✥ │ │ Layers | Looks | AI │
│ ⬚ │ canvas │ layer stack │
│ ◯ │ (server-rendered, exact) │ properties, mask, │
│ ✂ │ │ effects, AI buttons │
│ ✎ │ │ │
└────┴──────────────────────────────────────────┴──────────────────────┘Tools: move/resize (V), rectangle (M) and ellipse (L) selection, crop (C), brush (B), eraser (E), clone stamp (S, Alt+click the source, Heal for the healing brush), spot healing brush (J), text (T), shapes (U), pan (H). Brush and eraser can paint on a layer's mask (hide / reveal), also to refine an AI cut-out. With a selection: mask layer, remove object, generative fill, edit area with AI, describe, crop to selection.
Layers: groups (pass-through or isolated, with their own opacity, blend, mask and effects), clipping masks, visibility, lock, rename (double click), drag to reorder or into a group, duplicate, merge down, opacity and all 27 Photoshop blend modes. Image, text, shape, fill/gradient, paint, adjustment and group layers.
AI: generate, generative fill, edit with AI (image-to-image, with strength), expand canvas, describe (image-to-text), upscale, remove background — each lets you pick local or an online model. AI models holds the API keys (on this computer only,
~/.pedit/ai_api.json) and which model does what; Auto uses an online service only if you made it the default.Looks: cinematic, black & white, warm, cool, faded film, vivid, matte, vintage, dramatic, clean portrait — each one an editable chain of filters.
Assistant: Claude Code (your subscription, no key), Anthropic with a key, or any OpenAI-compatible service (OpenAI, Gemini, OpenRouter, Ollama, LM Studio…). Point at an area (
+ area) or a layer (+ layer) and refer to it in words. Exports always ask you first.Drop images on the window to import them. Ctrl+Z/Y, Ctrl+S, Ctrl+J duplicate, Del delete, 0 fit, 1 = 100%, Ctrl+wheel zoom.
Command line
pedit new poster.json --preset instagram_post
pedit add poster.json photo.jpg --fit cover
pedit text poster.json "SUMMER SALE" --size 140 --bold --align center-bottom
pedit enhance poster.json
pedit look poster.json warm
pedit cutout poster.json <layer-id> # needs the ai extra
pedit export poster.json poster.jpg --quality 90
pedit review poster.json
pedit effects -v | pedit looks | pedit doctor | pedit uiOptional extras
Extra | What it adds |
|
|
|
|
ComfyUI | not a pip package: run it locally (default |
Online models | no package either: paste an API key in AI models (or set |
FAQ
Is pedit a free alternative to Photoshop or GIMP? It is a free, MIT-licensed layered raster editor with the core of both: layers and layer groups, masks, clipping masks, adjustment layers, 27 blend modes, filters, layer styles, brush, clone stamp, healing brush, text and shapes. It does not try to replace every feature (no CMYK, no 16-bit, no PSD yet); its focus is non-destructive editing that both you and an AI agent can drive.
Can I use generative fill and AI image generation without a GPU? Yes. Paste an API key for OpenAI (GPT Image), Google Gemini (Nano Banana), Stability AI, Replicate (FLUX) or OpenRouter in AI models. With a GPU you can run everything locally through ComfyUI. Object removal, spot healing and background removal also work offline on the CPU.
Does it describe images (image-to-text)?
Yes: describe_image / Describe uses a vision model — Gemini, OpenAI, Claude, OpenRouter or a local
Ollama model — to caption a picture, a layer or an area, or to answer a question about it.
Which AI agents can edit images with pedit?
Any MCP client: Claude Code, Claude Desktop, Cursor, OpenAI Codex, VS Code, and the built-in assistant
(Claude, OpenAI, Gemini, OpenRouter, Ollama, LM Studio). The agent gets 62 tools and sees the real
rendered result with preview.
Is my API key safe?
Keys stay on your computer in ~/.pedit/ai_api.json (or environment variables). They are never written
into documents and never passed through the MCP tools.
How it works
backend/pedit/
model.py document (dataclass ↔ JSON): layers, masks, effects, assets
effects.py filter and layer-style registry: params, validation, numpy kernels
render.py document → pixels (W3C blend modes, masks, styles), export
store.py every edit + undo/redo + atomic save — the only way to change a document
ai.py background removal, fill, generation, image-to-image, upscale (with fallbacks)
cloud.py online image models with the user's API key (OpenAI, Gemini, Stability, …)
comfy.py minimal ComfyUI client (txt2img, inpaint, upscale workflows)
analyze.py measurements and document review
mcp_server.py MCP tools api.py REST/WebSocket for the UI
chat.py/llm.py the in-app assistant (its tools are the MCP tools)
frontend/ React + Vite UI
tests/ pixel-level tests of every effect, blend mode, mask and operationOne source of truth: the UI, the assistant and the MCP agent all call methods of Store.
Add an operation there first, then expose it.
Tests
pytest # ~180 tests, ~25 s, no network, no models
cd frontend && npm run build && npm testDevelopment
git clone https://github.com/metiutek/editorimage-ai && cd editorimage-ai
python scripts/setup.py --venv # deps, UI build, MCP registration, doctor, testsCode and comments are in Italian (project convention); everything a user reads is in English. See AGENTS.md and CONTRIBUTING.md.
License
MIT — see LICENSE.
Made by metiu.xyz
Available Tools
62 toolsadd_adjustmentB
Adjustment layer on top: its filters change everything below it, non-destructively. One filter (type + params) or a chain effects=[{type, params}, ...]. See list_effects.
Inputs: name, type, params, effects, +1 more.
add_effectC
Filter or layer style on one layer (filters before the mask, styles after: shadow, stroke, glow).
Inputs: type (required), layer (required), index, params, +1 more.
add_fillB
Full-canvas fill: solid, linear gradient (angle 90 = left->right, 180 = top->bottom) or radial (center cx, cy as fractions). index=0 puts it at the bottom (a background).
Inputs: cx, cy, kind, name, +5 more.
add_imageB
Image layer from a file (path) or an imported asset. fit: contain, cover, width, height, none (ignored if scale given). Without x/y it is centered. above= to insert right above it.
Inputs: x, y, fit, name, +5 more.
add_shapeC
Vector shape: rect (radius = rounded corners), ellipse, line, polygon (points relative to x,y). Colors accept #rrggbbaa for transparency.
Inputs: h, w, x, y, +8 more.
add_textB
Text layer. font: sans, serif, mono, display, handwriting, or a system font name/file. max_width>0 wraps lines. Without x/y it is centered; then align_layer to place it.
Inputs: text (required), x, y, bold, +11 more.
ai_servicesB
Online AI services (OpenAI, Gemini, Stability, OpenRouter, Replicate, Anthropic, Ollama, custom): which are ready, for which tasks (generate, edit, inpaint, describe, upscale, cutout), with which models. With service: set its models {task: model}, url, or default=true (used by backend="auto"). API keys are pasted by the user in the editor (AI models) or set as env vars, never here.
Inputs: url, models, default, service.
ai_statusB
What AI is available here: background removal, inpaint backend, ComfyUI (generation, upscale), online services with a key (online.ready: service -> tasks) and the default one.
Inputs: no named parameters.
align_layerC
Align to the canvas: h left/center/right, v top/middle/bottom (null = leave), margin in px.
Inputs: layer (required), h, v, margin, +1 more.
analyze_imageB
Numbers about the image (or one layer, or a box): brightness, contrast, clipped shadows/ highlights, saturation, color cast, sharpness, dominant colors. Measure before correcting.
Inputs: box, layer, project.
apply_lookB
Apply a look: as an adjustment layer on top (default) or as effects on one layer.
Inputs: name (required), layer, project.
auto_enhanceC
Measure and correct levels, white balance, vibrance, contrast. Adds normal, editable filters (an adjustment layer on top, or effects on layer=).
Inputs: layer, project, strength.
batchA
Many edits in ONE call and ONE undo step, all or nothing: [{"tool": "set_transform", "args": {...}}, ...]. look=true returns the preview too.
Inputs: ops (required), look, project.
close_uiA
Stop the web editor started with open_ui.
Inputs: no named parameters.
comfy_settingsC
Point pedit at a ComfyUI and choose its checkpoint/upscaler. Without args: current settings.
Inputs: cfg, url, steps, upscaler, +1 more.
crop_canvasB
Crop the canvas to a box (document px). Layers are kept whole: undoable without loss.
Inputs: x (required), y (required), width (required), height (required), +1 more.
describe_imageB
Image-to-text with a vision model (online with a key, or Ollama): describes the picture, a layer or a box, or answers question about it. Does not change the document.
Inputs: box, layer, backend, project, +1 more.
duplicate_layerC
Copy a layer (placed right above it).
Inputs: layer (required), name, project.
edit_imageB
Image-to-image: redo an image layer (or a box of the picture, or all of it) following the prompt ("make it winter", "watercolor style"). strength 0..1: low keeps it, high reinvents it. The result is a NEW layer above, same place and mask; the original stays below.
Inputs: prompt (required), box, seed, layer, +3 more.
expand_canvasB
Generative expand: add px on each side and fill the new borders (a new top layer masked to them). No prompt = classic fill (fine for sky, walls, plain backgrounds); with prompt or an AI service = generative.
Inputs: top, left, seed, right, +4 more.
export_imageB
Write the image file (.png .jpg .webp .avif .tif). ONLY when the user asks for it. transparent=true keeps alpha (png/webp). box exports a region.
Inputs: path (required), box, scale, project, +2 more.
flattenC
All visible layers into one image layer.
Inputs: project.
generate_imageA
Text-to-image with the local ComfyUI or an online service (backend=openai, gemini, stability, openrouter, replicate), placed on a new layer (fit cover/contain).
Inputs: prompt (required), fit, seed, width, +4 more.
group_layersC
Put layers (same level) into a new group. Groups have their own opacity, blend (default pass_through), mask and effects; an adjustment inside a non pass-through group affects only the group.
Inputs: layers (required), name, project.
inpaintA
Remove an object / fill an area: box=[x,y,w,h] document px, mask_path, or points=[[x,y],...] + size (a brush stroke: spot healing). No prompt = remove (classic fill). With prompt = generative fill (ComfyUI or an online service: backend=openai, gemini, stability, ...). The result is a patch on a NEW layer with a soft mask: move, fade or delete it like any layer.
Inputs: box, seed, size, points, +6 more.
list_effectsA
Effect catalogue. Without name: names and one line each. With name: its parameters.
Inputs: name.
list_looksC
Ready-made looks for apply_look.
Inputs: no named parameters.
mask_strokeA
Paint on a layer's mask: mode hide or reveal, polyline [[x,y],...] in document px. Works on any mask (refine an AI cut-out); a layer without a mask gets a paint mask.
Inputs: layer (required), points (required), mode, size, +3 more.
match_colorC
Make a layer's colors and tones match another layer (e.g. a pasted subject vs the background).
Inputs: layer (required), reference (required), amount, project.
merge_downC
Merge a layer into the one below.
Inputs: layer (required), project.
move_effectC
Reorder effects (order matters: denoise before sharpen).
Inputs: to (required), index (required), layer (required), project.
move_layerA
Reorder within its list: to=up/down/top/bottom, or index (0 = bottom). into= moves it inside a group; into="root" takes it out of its group.
Inputs: layer (required), to, into, index, +1 more.
open_uiB
Open the web editor on THIS document (same in-memory document, live updates).
Inputs: port, project.
paint_strokeA
Brush stroke: polyline [[x,y],...] in document px on a paint layer (created if missing). erase=true erases previous strokes of that layer. Clone stamp: source=[x,y] is where to copy from for the first point (copies everything below the layer); heal=true = healing brush (matches the light and color of the destination).
Inputs: points (required), heal, size, color, +6 more.
previewC
LOOK at the result: the real rendered image. box=[x,y,w,h] zooms on a detail (document px). layer= shows that layer alone. grid=true overlays a 10% grid labelled in document px.
Inputs: box, grid, layer, width, +1 more.
project_createA
Create a document. preset: 1080p, 4k, square, instagram_post, story, youtube_thumbnail, a4_300dpi, a4_150dpi, web_banner, og_image; or width/height; or from_image= to start from a photo (canvas = photo size). path=<file.json> saves it (autosave after every edit). background can be 'transparent'.
Inputs: name, path, width, height, +3 more.
project_infoB
Document state: size, layers (top first) with ids, boxes, effects, masks. detail='full' adds all params.
Inputs: detail, project.
project_openB
Open a pedit .json document, or a photo (becomes a new unsaved document of its size).
Inputs: path (required).
project_saveC
Save the document (.json). With path: save as.
Inputs: path, project.
project_settingsD
Document name, background color ('transparent' allowed), dpi.
Inputs: dpi, name, project, background.
rasterize_layerB
Turn a text/shape/paint layer (with its effects and mask) into pixels.
Inputs: layer (required), project.
redoC
Redo the last undone edit.
Inputs: project.
remove_backgroundB
AI cut-out as a layer MASK (the photo stays intact). keep=background inverts it. Models: isnet-general-use, u2net, u2net_human_seg (people), birefnet-general (best, slow). backend=stability uses the online service instead of the local model.
Inputs: layer (required), keep, model, backend, +1 more.
remove_effectC
Remove an effect from a layer.
Inputs: index (required), layer (required), project.
remove_layerB
Delete a layer (undoable).
Inputs: layer (required), project.
remove_maskC
Remove a layer's mask.
Inputs: layer (required), project.
report_issueC
Log what is broken/clumsy/missing (kind: bug, scomodo, sbagliato, manca, lento), then go on.
Inputs: kind (required), tool, details.
resize_canvasC
Change canvas size without scaling content. anchor: center, top, bottom_left, ...
Inputs: width (required), height (required), anchor, project.
resize_imageB
Scale the whole document (canvas and content), proportions kept: pass one side.
Inputs: width, height, project.
review_imageC
Check the document: text off-canvas or with low contrast, layers outside, blown highlights, upscaled images... each warning names the tool that fixes it. Not done while it warns.
Inputs: project.
set_fillC
Change a fill/gradient layer.
Inputs: layer (required), cx, cy, kind, +4 more.
set_layerC
Layer name, visibility, lock, opacity 0..1, clip (clipping mask onto the layer below), blend mode: normal, dissolve, darken, multiply, color_burn, linear_burn, darker_color, lighten, screen, color_dodge, add (linear dodge), lighter_color, overlay, soft_light, hard_light, vivid_light, linear_light, pin_light, hard_mix, difference, exclusion, subtract, divide, hue, saturation, color, luminosity; groups also pass_through.
Inputs: layer (required), clip, name, blend, +4 more.
set_maskB
Layer mask (white = visible). kind rect/ellipse with box=[x,y,w,h] in document px, image with path (grayscale or alpha file, aligned to the layer content), or paint (to paint with mask_stroke; hide_all=true starts fully hidden). feather = soft edge px.
Inputs: layer (required), box, kind, path, +5 more.
set_shapeC
Change a shape layer (fill/stroke 'none' removes them).
Inputs: layer (required), h, w, fill, +6 more.
set_textC
Change a text layer's text or style.
Inputs: layer (required), bold, font, size, +9 more.
set_transformB
Move/scale/rotate (degrees, clockwise)/flip a layer. width or height = target size on the canvas (keeps proportions). crop=[x,y,w,h] in SOURCE pixels of an image layer ([] removes it).
Inputs: layer (required), x, y, crop, +7 more.
subject_boxC
Bounding box [x,y,w,h] of the main subject of an image layer, in document px.
Inputs: layer (required), project.
undoC
Undo the last edit.
Inputs: project.
ungroupC
Dissolve a group: its layers go back in its place.
Inputs: layer (required), project.
update_effectC
Change an effect's params or switch it off/on. index = position in the layer's effects.
Inputs: index (required), layer (required), params, enabled, +1 more.
update_maskC
Invert, soften, weaken or move an existing mask.
Inputs: layer (required), box, invert, density, +2 more.
upscaleB
More real pixels for an image layer (ComfyUI model, or backend=stability online, else Lanczos+sharpen). Its size on the canvas does not change.
Inputs: layer (required), factor, backend, project.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 62 tools
Each tool targets a distinct resource or action, with clear separation between layer operations, effects, masks, canvas, AI, and project management. Overlaps are minimal and descriptions clarify usage (e.g., add_adjustment vs add_effect vs apply_look). Agents can reliably select the right tool.
Mostly consistent snake_case with verb_noun or verb patterns (add_image, set_layer, list_effects). A few noun phrases (project_info, ai_status) and single verbs (undo, flatten) deviate slightly but remain readable and predictable.
62 tools far exceed the typical 3-15 range and the 25+ threshold for 'too many', representing an extreme mismatch for a single MCP server despite the complex domain. The surface is overly broad and likely to overwhelm agents.
The tool set covers the full image editing lifecycle: project management, layers, effects, masks, canvas, AI features, export, and batch operations. Minor gaps like listing fonts or blend modes are negligible; core CRUD and advanced workflows are complete.
Maintenance
Related MCP Connectors
Agent-Native design tool - create and edit visual designs with agent assistance
Generate and edit images, video, voice, lip-sync and 3D models from your AI agent.
Make and edit images in Claude, ChatGPT, Cursor and more. Paint to edit, erase. Free to start.
LLM chat, text tools, image generation, editing, batch image jobs, and asynchronous video generation
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI agents to perform advanced image editing and graphic design through Photopea, a browser-based Photoshop alternative. Provides 34 tools for document management, layer operations, filters, adjustments, and exports via a WebSocket bridge to the browser.346328 npm56MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to drive a layered raster image editor with painting, shapes, text, filters, and internet-sourced images and fonts via MCP tool calls, with token-efficient rendering and export.MIT
- AlicenseNot gradedqualityCmaintenanceEnables external AI agents to programmatically inspect, edit, and export image documents through tools for layers, selections, painting, adjustments, masks, history, and compositing.MIT
- AlicenseCqualityNot gradedmaintenanceEnables AI agents to autonomously create and edit graphic designs, multi-page PDF catalogs, brochures, social media assets, and slide decks on a local browser canvas. It provides vision-in-the-loop feedback, layout audits, and export capabilities for print-ready or web-ready outputs.53152 npmMIT