SuperAPIAI Directory

photopea-mcp-server

github.com · AI images

Image editing through Photopea: documents, layers, text, shapes, filters, effects and export.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS · API

About this tool

Purpose

Photopea MCP Server is used to let AI agents drive Photopea to complete image editing tasks. Photopea is a free, browser-based Photoshop alternative. Users can design posters, edit photos, and transform images in the terminal; the agent sends editing commands via the MCP protocol, and the server translates them into Photopea JavaScript API calls and bridges them to the browser via WebSocket for execution.

Main Capabilities

The server registers 34 tools, divided into the following categories:

  • Document (5 tools)
  • Layers (11 tools)
  • Text and shapes (3 tools)
  • Images and effects (9 tools)
  • Export and utilities (6 tools)

Typical task examples:

  • Create a poster: create a 1920x1080 document, dark blue background, add a white 72px Arial title "Hello World", export as PNG to ~/Desktop/poster.png.
  • Edit a photo: open ~/photos/portrait.jpg, increase brightness by 30, apply a 2px Gaussian blur, export as JPG to ~/Desktop/edited.jpg.
  • Composite an image: create a 1200x630 document, use ~/assets/background.png as the base layer, then place ~/assets/logo.png and move it to the top-right corner.
  • Batch adjustments: open ~/photos/sunset.jpg, apply Hue/Saturation +20 saturation, apply USM sharpening (amount 50, radius 2), export as PNG.

Usage

Installation methods:

  • npx (recommended)
  • Global installation

Integrate into an MCP client:

  • Claude Desktop: add to the configuration file (on macOS the path is ~/Library/Application Support/Claude/claude_desktop_config.json)
  • Cursor: add to MCP settings (project .cursor/mcp.json or global ~/.cursor/mcp.json)
  • VS Code (Copilot): add to project .vscode/mcp.json
  • Windsurf: add to MCP settings (~/.windsurf/mcp.json)

After installation, start a new Claude Code session and ask it to edit an image. On the first tool call, the Photopea editor opens automatically in the browser.

Architecture Components

The server contains four main components:

  1. MCP Server (src/server.ts): uses the MCP SDK to register all 34 tools and connects via stdio transport.
  2. WebSocket Bridge (src/bridge/websocket-server.ts): manages the connection between the MCP server and the browser, queues script execution requests, and handles responses with timeouts.
  3. Script Builder (src/bridge/script-builder.ts): pure functions that convert tool parameters into Photopea JavaScript API calls; each builder function generates a script string executable by Photopea.
  4. Browser Frontend (src/frontend/index.html): a single-page application that loads Photopea in an iframe, connects to the WebSocket bridge, forwards scripts to Photopea via postMessage, and returns results via WebSocket.

Security and Limitations

  • The MCP server binds to 127.0.0.1 (local only) and cannot be accessed from the network.
  • The photopea_run_script tool executes arbitrary JavaScript inside Photopea's sandboxed iframe, is marked as a destructive operation, and requires user approval in MCP clients that support tool annotations.
  • File operations (open_file, export_image, place_image) read and write files with the permissions of the user running the server.

Known limitations:

  • Heavy scripts (for example, gradients containing many color steps) may cause the Photopea browser UI to become unresponsive. The operation will still complete successfully in the background, and the export will work as expected.
  • Refreshing the browser page discards all unsaved work. Export the document before refreshing.
  • Only one browser tab can be open at a time. Multiple tabs will contend for the WebSocket connection.
  • reThe order_layer tool may cause the Photopea UI to become unresponsive. To avoid this issue, create layers in the desired order instead of reordering them after creation.

Use Cases

Suitable for users who need to automate image editing, poster design, photo adjustment, image compositing, and other tasks through AI agents, and especially suitable for developers or designers who already use MCP clients such as Claude Desktop, Cursor, VS Code (Copilot), and Windsurf.

Environment Requirements

Requires a modern web browser (Chrome, Firefox, Edge, Safari).

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools