mirror of
https://github.com/penpot/penpot.git
synced 2026-11-26 21:00:32 +00:00
Closing a plugin removes its globals (console, penpot, ...) while a task of the MCP plugin may still be running. Under SES a removed global reads as undefined, so the task failed at its next use of console or penpot, and the catch handlers failed again on console.error. The rejection reached the workspace as "Cannot read properties of undefined (reading 'error')", for tasks that succeeded as well as for failed ones. A task that ends after the plugin closed now returns quietly. It cannot answer: the UI iframe and its WebSocket are gone, and the MCP server already fails the task when the plugin connection closes. The outer catch logs through the console reference taken at load, so it cannot throw. Tests: PluginTaskRequest.test.ts runs TaskHandler.ts and plugin.ts in one sandbox, removes the globals while a task waits, and checks that no rejection escapes and no error is logged when the task ends in success or failure. A task that fails while the plugin is open still sends its error response. Closes #12503 AI-assisted-by: claude-opus-5-5
Penpot MCP Plugin
This project contains a Penpot plugin that accompanies the Penpot MCP server. It connects to the MCP server via WebSocket, subsequently allowing the MCP server to execute tasks in Penpot using the Plugin API.
Setup
-
Install Dependencies
pnpm install -
Build the Project
pnpm run build -
Start a Local Development Server
pnpm run startThis will start a local development server at
http://localhost:4400.