mirror of
https://github.com/penpot/penpot.git
synced 2026-11-02 08:00:36 +00:00
A browser freezes background tabs, and a frozen Penpot tab cannot run the MCP plugin. A browser extension can wake such a tab, so let it connect to the MCP server as a wake agent. Define the messages the extension exchanges with the Penpot page and with the server: the page's session announcement, and the agent's initialization, session list, heartbeat and wake result, and the server's wake request. The server checks the agent messages with zod schemas. The plugin WebSocket endpoint accepts agents: a socket whose first message is initialize-wake-agent goes to a wake agent registry, which then handles its messages, keep-alive pings and close. It never becomes a plugin connection, so it is not listed as a Penpot session and does not displace the plugin connection of the same session. Agents go through the same user token checks as plugins. The registry keeps the sessions each agent can wake, sends wake requests and matches their results by request ID. A request fails when no agent holds the session, the agent disconnects or it does not answer in time. An agent may only wake sessions it registered under the same token, and a reconnecting agent replaces its previous connection.
Penpot MCP Server
A Model Context Protocol (MCP) server that provides Penpot integration capabilities for AI clients supporting the model context protocol (MCP).
Setup
-
Install Dependencies
pnpm install -
Build the Project
pnpm run build -
Run the Server
pnpm run start
Penpot Plugin API REPL
The MCP server includes a REPL interface for testing Penpot Plugin API calls. To use it, connect to the URL reported at startup.