photopea-mcp-server
v0.2.1MCP server for AI-driven image editing with Photopea
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
photopea_create_document Create Document
Create a new blank document and make it the active document. This is typically the first step in a workflow. The document opens with a Background layer. Use open_file instead to edit an existing image.
| Parameter | Type | Description |
|---|---|---|
height * | number | Document height in pixels (e.g. 1080 for full HD) |
width * | number | Document width in pixels (e.g. 1920 for full HD) |
fillColor | string | Background fill color as hex (e.g. #ffffff for white, #000000 for black). Defaults to white if omitted. |
mode | string | Color mode (use RGB for most workflows) |
name | string | Document name shown in the title bar |
resolution | number | Resolution in DPI (72 for screen, 300 for print) |
photopea_open_file Open File
Open an existing image file in Photopea as a new document. Supports PSD, PNG, JPG, WebP, SVG, and other common formats. The opened file becomes the active document. Use create_document instead to start with a blank canvas.
| Parameter | Type | Description |
|---|---|---|
source * | string | URL or absolute local file path of the image to open (e.g. /Users/me/photo.psd or https://example.com/image.png) |
photopea_get_document_info Get Document Info
Get metadata about the active document including name, width, height, resolution (DPI), layer count, and color mode. Returns JSON. Use this to check document dimensions before positioning layers or making selections.
photopea_resize_document Resize Document
Resize the active document canvas to new pixel dimensions, resampling all layer content to fit. This is a destructive operation — all layers are scaled proportionally. Use undo to revert if needed.
| Parameter | Type | Description |
|---|---|---|
height * | number | New document height in pixels |
width * | number | New document width in pixels |
photopea_close_document Close Document
Close the active document. Set save to true to save changes before closing. Unsaved changes are discarded if save is false. The next open document becomes active, if any.
| Parameter | Type | Description |
|---|---|---|
save | boolean | Whether to save changes before closing (true = save first, false = discard unsaved changes) |
photopea_crop Crop
Crop the active document to a rectangle in pixels. Content outside the rectangle is discarded. Use get_document_info for the current size; use resize_canvas to add space instead.
| Parameter | Type | Description |
|---|---|---|
height * | number | Height of the crop rectangle in pixels |
width * | number | Width of the crop rectangle in pixels |
x * | number | Left edge of the crop rectangle in pixels |
y * | number | Top edge of the crop rectangle in pixels |
photopea_resize_canvas Resize Canvas
Change the canvas size without scaling the content: larger adds empty space, smaller cuts off edges. The anchor decides which side stays fixed. Use resize_document to scale the content instead.
| Parameter | Type | Description |
|---|---|---|
height * | number | New canvas height in pixels |
width * | number | New canvas width in pixels |
anchor | string | Where the existing content stays, e.g. 'center' adds space equally on all sides, 'top-left' adds it to the right and bottom |
fillColor | string | Color for the added area, e.g. #ffffff for a white border. Adds a solid 'Canvas Fill' layer at the bottom. Omit for transparent. |
photopea_trim Trim
Trim empty borders from the active document: transparent pixels, or pixels matching the top-left or bottom-right corner color. Useful after removing a background or before exporting an icon.
| Parameter | Type | Description |
|---|---|---|
basis | string | What counts as empty border |
photopea_rotate_canvas Rotate Canvas
Rotate and/or flip the whole document, all layers together. Use transform_layer to rotate a single layer instead.
| Parameter | Type | Description |
|---|---|---|
angle | number | Clockwise rotation in degrees, e.g. 90, 180, -90 |
flip | string | Mirror the document horizontally or vertically |
photopea_add_layer Add Layer
Add a new empty layer to the active document. The new layer becomes the active layer. Use this before operations that draw onto a layer, such as fill_selection or add_gradient.
| Parameter | Type | Description |
|---|---|---|
blendMode | string | Blend mode (e.g. normal, multiply, screen, overlay, darken, lighten). Defaults to normal. |
name | string | Display name for the new layer in the layers panel |
opacity | number | Layer opacity percentage (0 = fully transparent, 100 = fully opaque, default 100) |
photopea_add_fill_layer Add Fill Layer
Add a non-destructive solid color fill layer that covers the entire canvas. Unlike fill_selection, this creates a separate adjustment-style layer that can be toggled, recolored, or deleted without affecting other layers. Use set_layer_properties to change its opacity or blend mode.
| Parameter | Type | Description |
|---|---|---|
color * | string | Fill color as hex string (e.g. #ff0000) |
type * | string | Fill layer type (currently only 'solid' is supported) |
name | string | Display name for the fill layer in the layers panel |
photopea_delete_layer Delete Layer
Permanently remove a layer from the active document by name or index. The next layer in the stack becomes active after deletion. Use get_layers to see available layers before deleting.
| Parameter | Type | Description |
|---|---|---|
target * | string | number | Layer name (string) or index (number) |
photopea_select_layer Select Layer
Set a layer as the active layer by name or index. Many tools (apply_filter, apply_adjustment, fill_selection) operate on the active layer — use this to target a specific layer first. Use get_layers to find layer names and indices.
| Parameter | Type | Description |
|---|---|---|
target * | string | number | Layer name (string) or index (number) |
photopea_set_layer_properties Set Layer Properties
Update one or more properties on a layer. Only specified properties are changed; others remain at their current values. Use get_layers to inspect current property values before modifying.
| Parameter | Type | Description |
|---|---|---|
target * | string | number | Layer name (string) or index (number) |
blendMode | string | Blend mode (e.g. normal, multiply, screen, overlay, darken, lighten, color-dodge, color-burn) |
locked | boolean | Whether the layer is locked (true = prevent edits, false = allow edits) |
name | string | New display name for the layer |
opacity | number | Layer opacity percentage (0 = fully transparent, 100 = fully opaque) |
visible | boolean | Layer visibility (true = visible, false = hidden) |
photopea_move_layer Move Layer
Translate a layer by a relative x/y offset in pixels from its current position. Positive x moves right, positive y moves down. Use get_layers to check current layer bounds, or transform_layer for scaling and rotation.
| Parameter | Type | Description |
|---|---|---|
target * | string | number | Layer name (string) or index (number) |
x * | number | Horizontal offset in pixels (positive = right, negative = left) |
y * | number | Vertical offset in pixels (positive = down, negative = up) |
photopea_duplicate_layer Duplicate Layer
Create a copy of a layer in the active document. The duplicate becomes the active layer and is placed above the original. Use newName to distinguish the copy from the original.
| Parameter | Type | Description |
|---|---|---|
target * | string | number | Layer name (string) or index (number) |
newName | string | Display name for the duplicated layer (defaults to 'original name copy') |
photopea_reorder_layer Reorder Layer
Move a layer to a new position in the layer stack. Use 'top' or 'bottom' to move to the ends of the stack, or 'above'/'below' to shift one position relative to the current index. Use get_layers to see the current layer order.
| Parameter | Type | Description |
|---|---|---|
position * | string | Target position: 'top' = front of stack, 'bottom' = back of stack, 'above' = one position up, 'below' = one position down |
target * | string | number | Layer name (string) or index (number) |
photopea_group_layers Group Layers
Group multiple layers into a layer group (folder). Layers are specified by name — use get_layers to find layer names. Grouped layers can be ungrouped later with ungroup_layers.
| Parameter | Type | Description |
|---|---|---|
layers * | array | Array of layer names to include in the group (use get_layers to find names) |
groupName | string | Display name for the group folder in the layers panel |
photopea_ungroup_layers Ungroup Layers
Dissolve a layer group, moving all child layers to the document root. The group folder is removed but its contents are preserved. Use get_layers to find group names.
| Parameter | Type | Description |
|---|---|---|
target * | string | Name of the layer group to ungroup (use get_layers to find group names) |
photopea_get_layers Get Layers
Get the full layer tree of the active document as JSON. Returns an array of layer objects with name, type, index, visible, opacity, blendMode, and bounds properties. Groups contain nested children arrays. Use this to discover layer names and indices for other layer operations.
photopea_layer_mask Layer Mask
Add or delete a layer mask, which hides parts of a layer without erasing pixels. 'from_selection' shows only the current selection (use make_selection first). Acts on the target layer, or the active layer if omitted.
| Parameter | Type | Description |
|---|---|---|
action * | string | 'reveal_all' adds a mask that shows everything, 'hide_all' one that hides everything, 'from_selection' one that shows the selection, 'delete' removes the mask |
target | string | number | Layer name (string) or index (number) |
photopea_set_clipping_mask Set Clipping Mask
Clip a layer to the layer directly below it, so it only shows where that layer has pixels (e.g. a photo or texture confined to a text or shape). Set enabled to false to release it.
| Parameter | Type | Description |
|---|---|---|
target * | string | number | Layer name (string) or index (number) |
enabled | boolean | true clips the layer to the one below, false releases it |
photopea_add_adjustment_layer Add Adjustment Layer
Add a non-destructive adjustment layer above the active layer. It changes how all layers below look without touching their pixels and can be hidden or deleted later. Use apply_adjustment to change one layer's pixels instead.
| Parameter | Type | Description |
|---|---|---|
type * | string | 'brightness' uses brightness/contrast, 'hue_sat' uses hue/saturation/lightness, 'levels' uses inputMin/inputMax/gamma |
brightness | number | brightness: -150..150 |
contrast | number | brightness: -50..100 |
gamma | number | levels: midtone gamma, 1 = unchanged |
hue | number | hue_sat: hue shift in degrees |
inputMax | integer | levels: input white point 2..255 |
inputMin | integer | levels: input black point 0..253 |
lightness | number | hue_sat: -100..100 |
saturation | number | hue_sat: -100..100 |
photopea_merge_layers Merge Layers
Merge layers: 'down' merges the active layer into the one below, 'flatten' merges everything into a single background layer. Layer styles and masks get baked into pixels.
| Parameter | Type | Description |
|---|---|---|
mode * | string | Which layers to merge |
photopea_set_layer_style Set Layer Style
Set a layer's effects: drop shadow, outer glow and/or stroke. Replaces the layer's existing effects; pass none to clear them. Effects stay editable and follow the layer's shape, which suits text and logos.
| Parameter | Type | Description |
|---|---|---|
dropShadow | object | |
outerGlow | object | |
stroke | object | |
target | string | number | Layer name (string) or index (number) |
photopea_add_text Add Text
Add a new text layer to the active document at the specified position. The text layer becomes the active layer. Use paragraphBounds to create a text box with word wrapping, or omit for point text. Use load_font to add custom fonts, and list_fonts to find available font names.
| Parameter | Type | Description |
|---|---|---|
content * | string | Text content to display on the layer |
x * | number | X position in pixels from the left edge of the document |
y * | number | Y position in pixels from the top edge of the document |
alignment | string | Text alignment |
bold | boolean | Apply faux bold |
color | string | Color as hex string (e.g. #ff0000) |
font | string | Font PostScript name (e.g. ArialMT, Helvetica-Bold). Use list_fonts to find available names. |
italic | boolean | Apply faux italic |
letterSpacing | number | Letter tracking/spacing |
lineHeight | number | Line height (leading) |
paragraphBounds | Paragraph text box bounds | |
size | number | Font size in points (default varies by document resolution) |
photopea_edit_text Edit Text
Modify the content or style of an existing text layer. Only specified properties are changed — omit parameters to keep their current values. Use get_layers to find text layer names if needed.
| Parameter | Type | Description |
|---|---|---|
target * | string | number | Layer name (string) or index (number) |
alignment | string | Text alignment |
color | string | Color as hex string (e.g. #ff0000) |
content | string | New text content to replace existing text |
font | string | New font PostScript name (use list_fonts to find available names) |
letterSpacing | number | Letter tracking/spacing |
lineHeight | number | Line height (leading) |
size | number | New font size in points |
photopea_add_shape Add Shape
Add a vector shape layer (rectangle or ellipse) to the active document. The shape layer becomes the active layer. Shapes are non-destructive and can be resized with transform_layer without quality loss.
| Parameter | Type | Description |
|---|---|---|
bounds * | object | Shape bounds |
type * | string | Shape type to create |
fillColor | string | Color as hex string (e.g. #ff0000) |
name | string | Name for the shape layer |
strokeColor | Color as hex string (e.g. #ff0000) | |
strokeWidth | number | Stroke width in pixels |
photopea_place_image Place Image
Place an image into the active document from a URL or local file path. Creates a new layer with the placed image as the active layer. Use width/height to resize while preserving aspect ratio, or x/y to position the layer.
| Parameter | Type | Description |
|---|---|---|
source * | string | URL or absolute local file path of the image to place |
height | number | Resize to this height in pixels (preserves aspect ratio if only one dimension is set) |
name | string | Display name for the placed layer in the layers panel |
width | number | Resize to this width in pixels (preserves aspect ratio if only one dimension is set) |
x | number | X position offset in pixels from the left edge |
y | number | Y position offset in pixels from the top edge |
photopea_fill_placeholder Fill Placeholder
Put an image into a template's placeholder layer: the image is scaled to cover (or fit inside) the placeholder's bounds, centered on it, placed above it and masked to its shape. Use it for photo frames, device mockups and social post templates; use edit_text to swap the template's text.
| Parameter | Type | Description |
|---|---|---|
placeholder * | string | number | Placeholder layer name (string) or index (number), e.g. a shape or pixel layer marking where the image goes |
source * | string | URL or absolute local file path of the image |
fit | string | 'cover' fills the placeholder and crops overflow, 'contain' fits the whole image inside it |
mask | boolean | Mask the image to the placeholder's shape (a layer mask, so layers added later can't break it) |
name | string | Display name for the new image layer |
photopea_apply_adjustment Apply Adjustment
Apply a destructive image adjustment to the active layer's pixel data. Use select_layer to target a specific layer first. Modifies pixels directly — use undo to revert if needed.
| Parameter | Type | Description |
|---|---|---|
type * | string | Adjustment type: 'brightness' for brightness/contrast, 'hue_sat' for hue/saturation/lightness, 'levels' for input levels, 'curves' for tone curves |
settings | object | Key-value settings for the adjustment. For brightness: { brightness: -100..100, contrast: -100..100 }. For hue_sat: { hue: -180..180, saturation: -100..100, lightness: -100..100 }. For levels: { input… |
photopea_apply_filter Apply Filter
Apply a destructive filter effect to the active layer's pixel data. Use select_layer to target a specific layer first. Modifies pixels directly — use undo to revert if needed.
| Parameter | Type | Description |
|---|---|---|
type * | string | Filter type to apply to the active layer |
settings | object | Key-value settings for the filter. For gaussian_blur: { radius: pixels }. For unsharp_mask: { amount: 1-500, radius: 0.1-250, threshold: 0-255 }. For motion_blur: { angle: degrees, distance: pixels }.… |
photopea_transform_layer Transform Layer
Scale, rotate, or flip a layer in-place. Modifies the layer's pixel data destructively. Use get_layers to check current layer bounds before transforming, and undo to revert if needed.
| Parameter | Type | Description |
|---|---|---|
target * | string | number | Layer name (string) or index (number) |
flipH | boolean | Flip the layer horizontally (mirror left-right) |
flipV | boolean | Flip the layer vertically (mirror top-bottom) |
rotation | number | Rotation angle in degrees (positive = clockwise, negative = counter-clockwise) |
scaleX | number | Horizontal scale factor (1.0 = no change, 0.5 = half size, 2.0 = double size) |
scaleY | number | Vertical scale factor (1.0 = no change, 0.5 = half size, 2.0 = double size) |
photopea_add_gradient Add Gradient
Apply a linear gradient fill to a layer, replacing its current pixel content. The target layer must already exist — use add_layer to create one first. Colors are distributed evenly across the gradient.
| Parameter | Type | Description |
|---|---|---|
colors * | array | Array of hex color stops distributed evenly along the gradient (minimum 2, e.g. ['#ff0000', '#0000ff']) |
target * | string | number | Layer name (string) or index (number) |
type * | string | Gradient type (currently only 'linear' is supported) |
angle | number | Gradient angle in degrees (0 = left-to-right, 90 = top-to-bottom, default 0) |
photopea_make_selection Make Selection
Create a pixel selection region in the active document. After creating a selection, use fill_selection to fill it with color, or clear_selection to deselect. Use type 'all' to select the entire canvas, or 'rect'/'ellipse' with bounds for a specific region.
| Parameter | Type | Description |
|---|---|---|
type * | string | Selection shape: 'all' selects the entire canvas, 'rect' creates a rectangle, 'ellipse' creates an ellipse |
bounds | object | Selection region bounds in pixels. Required for 'rect' and 'ellipse' types, ignored for 'all'. |
feather | number | Soft edge radius in pixels for anti-aliased selection edges (0 = hard edge) |
photopea_modify_selection Modify Selection
Modify the current active selection. Requires an existing selection created by make_selection. For expand, contract, and feather, the amount parameter specifies pixels. Invert swaps selected and unselected areas.
| Parameter | Type | Description |
|---|---|---|
action * | string | How to modify the selection: 'expand' grows it, 'contract' shrinks it, 'feather' softens edges, 'invert' swaps selected/unselected |
amount | number | Modification amount in pixels (required for expand, contract, feather; ignored for invert) |
photopea_fill_selection Fill Selection
Fill the current selection with a solid color on the active layer. Requires an active selection — use make_selection to create one first. Modifies pixel data on the active layer directly. Use clear_selection afterward to deselect.
| Parameter | Type | Description |
|---|---|---|
color * | string | Color as hex string (e.g. #ff0000) |
blendMode | string | Blend mode for the fill (e.g. normal, multiply, screen, overlay, darken, lighten). Defaults to normal. |
opacity | number | Fill opacity percentage (0 = fully transparent, 100 = fully opaque, default 100) |
photopea_clear_selection Clear Selection
Deselect the current selection in the active document, removing the marching ants. Does not modify any pixel data. Use after fill_selection or other selection-based operations are complete.
photopea_export_image Export Image
Export the active document to a file and save it to the local filesystem. The entire document is flattened and exported in the chosen format. Use create_document or open_file to set up the document before exporting.
| Parameter | Type | Description |
|---|---|---|
format * | string | Output format: 'png' for lossless, 'jpg' for compressed photos, 'webp' for web, 'psd' for Photoshop, 'svg' for vector |
outputPath * | string | Absolute local file path where the exported file will be saved (e.g. /Users/me/output.png) |
quality | number | Compression quality for JPG and WebP (1 = smallest file, 100 = best quality). Ignored for other formats. |
photopea_get_preview Get Preview
See the active document: returns a PNG snapshot, downscaled to maxSize, so you can check layout, colors and text visually. The document is not modified. Call it after visual changes, before exporting.
| Parameter | Type | Description |
|---|---|---|
maxSize | integer | Longest side of the preview in pixels; smaller documents are not upscaled |
photopea_batch_process Batch Process
Run the same edit over many images: opens each input, optionally runs a Photopea script on it, exports it to outputDir as <input name>.<format> (repeated names get -2, -3) and closes it. Use it for bulk resizing, format conversion or watermarking. Existing files with the same name are overwritten.
| Parameter | Type | Description |
|---|---|---|
format * | string | Output format |
inputs * | array | URLs or absolute local file paths of the images |
outputDir * | string | Absolute directory path for the exported files (created if missing) |
quality | number | Compression quality for JPG and WebP (1-100) |
script | string | Photopea JavaScript to run on each image before export, e.g. "app.activeDocument.resizeImage(800, 600);" |
photopea_load_font Load Font
Load a custom font from a URL (TTF or OTF; Photopea cannot open WOFF2) into Photopea. The font becomes available for add_text and edit_text. Use list_fonts to find the PostScript name after loading.
| Parameter | Type | Description |
|---|---|---|
url * | string | URL to a .ttf or .otf font file |
photopea_list_fonts List Fonts
List available fonts in Photopea. Returns font PostScript names that can be used with add_text and edit_text.
| Parameter | Type | Description |
|---|---|---|
search | string | Optional search string to filter fonts by name |
photopea_run_script Run Script
Execute arbitrary Photopea/ExtendScript JavaScript in the Photopea environment. Use this for advanced operations not covered by other tools. Has full access to the Photopea DOM (app, activeDocument, layers). Use with caution — scripts can modify or delete any document data.
| Parameter | Type | Description |
|---|---|---|
script * | string | Photopea JavaScript code to execute. Must call app.echoToOE(result) to return data. Has access to the full Photopea scripting API (app, activeDocument, etc.). |
photopea_undo Undo
Undo one or more recent actions in the active document. Each step reverses one operation from the history. Use after destructive operations (apply_filter, apply_adjustment, fill_selection) to revert changes.
| Parameter | Type | Description |
|---|---|---|
steps | integer | Number of history steps to undo (default 1) |
photopea_redo Redo
Redo one or more previously undone actions in the active document. Only available after using undo — the redo history is cleared when new actions are performed.
| Parameter | Type | Description |
|---|---|---|
steps | integer | Number of history steps to redo (default 1) |