Skip to content

Detect serialisation issues in MCP plugin, preventing timeout #9634

@opcode81

Description

@opcode81

Implementation issues in the data structures returned by the plugin API can cause penpot.ui.sendMessage to fail with an error like this:

plugin sendMessage: the message could not be cloned. Ensure the message does not contain functions, DOM nodes, or other non-serializable values. DataCloneError: Failed to execute 'structuredClone' on 'Window': [object Array] could not be cloned.

sendMessage is used to provide the content to be sent back to the MCP server over the WebSocket by the MCP server.
If sendMessage fails, the MCP server thus never gets a response, triggering a timeout on the MCP server side.
This should be prevented, i.e. the operation should fail fast.

Metadata

Metadata

Assignees

Labels

IOP MCPTasks related to the MCP initiative

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions