Repository avatar
AI Tools
v0.1.1
active

mcp

com.layergrab/mcp

Split flat PNG/JPG images into up to 16 named transparent layers over an inpainted background.

Documentation

LayerGrab plugins & MCP server

Source code of the LayerGrab plugins for Figma, Sketch and Chrome, the official Model Context Protocol (MCP) server (layergrab-mcp), and the shared client library they use: a Figma plugin that splits an image into editable layers, a Sketch plugin that does the same in Sketch, a Chrome extension that splits any image on the web into layers in a side panel, and an MCP server for Claude Desktop, Cursor and Windsurf.

LayerGrab is an AI image layer separation tool that splits an image into editable layers: up to 16 separate transparent layers, one per element, each named, with the background behind them filled in, or just the single object you name.

Published so that reviewers and users can read what the plugins and MCP server do. Issues and pull requests are welcome; the UXP plugin for Adobe Photoshop is distributed via the Adobe Creative Cloud Marketplace.

What is here

packages/core/     Shared CommonJS client: sign-in (device flow), account, split, unlock, result mapping
packages/mcp/      Official layergrab-mcp stdio server for Claude Desktop, Cursor and Windsurf
plugins/figma/     Figma plugin: src/code.js (main thread), ui.html (panel), manifest.json
plugins/sketch/    Sketch plugin (skpm): src/split.js (command), account/panel/profile, manifest.json
plugins/chrome/    Chrome extension (Manifest V3): side panel, context menu, background worker
scripts/           Syncs packages/core/hub.js into plugins/chrome/lib and packages/mcp/lib

packages/core/hub.js talks to api.layergrab.com. It is plain CommonJS with no design-tool APIs, so the same file runs in Figma's plugin sandbox, in Sketch's CocoaScript runtime, in a Chrome extension, in Photoshop's UXP runtime and under Node for the MCP server and tests. The app key in it is a public identifier, not a secret; a user's own key is only ever issued to that user after they approve the connection in their browser.

How sign-in works

The plugins and MCP server never see a password. Each client asks LayerGrab for a short one-time code, opens layergrab.com/account/connect?code=… in the browser, and polls until the user has signed in with Google there and clicked Approve. The key it receives is stored locally (figma.clientStorage, Sketch's Settings, chrome.storage.local, or ~/.config/layergrab/mcp-credentials.json) and can be revoked from the account page at any time.

Build and run

Requires Node 20+ and pnpm.

pnpm install:all          # packages/core, plugins/figma and plugins/sketch
pnpm test                 # core + MCP unit tests against a scripted fake of the API
pnpm build                # syncs core and bundles the Figma and Sketch plugins
  • Figma: in the desktop app, Plugins › Development › Import plugin from manifest… and pick plugins/figma/manifest.json, then run it from the Development menu.
  • Sketch: pnpm -C plugins/sketch build writes plugins/sketch/layergrab.sketchplugin; double-click it to install, then run Plugins › LayerGrab. Updates come from the appcast in its manifest.
  • Chrome: open chrome://extensions, turn on Developer mode, Load unpacked, choose plugins/chrome.
  • MCP (packages/mcp): run npx -y layergrab-mcp (see packages/mcp/README.md for local stdio configuration), or connect directly to the stateless Streamable HTTP endpoint https://layergrab.com/api/mcp.

All clients share one LayerGrab account and credit balance. Every account's first One layer split in the plugins or the Chrome extension is free (one named element on its own transparent layer, with the gap behind it filled in); after that, splits are charged per layer returned, and any result your balance cannot cover is previewed locked at $0 until unlocked.

Licence

MIT, see LICENSE. Vendored decoders in packages/core/vendor keep their own licences (jpeg-js, pako, UPNG).

NPM
layergrab-mcp
Install Command
npm install layergrab-mcp

Remote