Alonso Torres eb2c8cf359
🐛 Check Host and Origin headers in the MCP server (#13117)
* 🐛 Check Host and Origin headers in the MCP server

The MCP endpoint, the REPL server and the plugin WebSocket accepted
requests with any Host and Origin header, so a web page open in the
user's browser could drive a local MCP server: connect as the plugin
and call its tools.

RequestGuard checks both headers against an allowlist and rejects other
requests with HTTP 403, or WebSocket close code 1008. The list comes
from PENPOT_MCP_ALLOWED_HOSTS, where "*" turns the check off. When it
is unset, local mode allows only loopback names and remote mode allows
any host, since remote mode relies on user tokens and has no file
access.

AI-assisted-by: claude-opus-5-5

* 🐛 Keep the Host and Origin check on in single-user remote mode

The default allowlist followed remote mode, so a single-user server with
PENPOT_MCP_REMOTE_MODE=true accepted any Host and Origin. It requires no
user token either, so a web page could still drive it and run code in the
user's Penpot session. The default now follows multi-user mode: single-user
servers allow only loopback names, and multi-user servers, which rely on
user tokens, allow any host. Startup warns when the check is off in
single-user mode.

PENPOT_MCP_ALLOWED_HOSTS entries with a scheme, port or path never matched,
so every request failed with 403. The server now refuses to start and names
the bad entry.

AI-assisted-by: claude-opus-5-5
2026-11-17 16:01:49 +01:00
..
2026-02-04 12:22:36 +01:00
2026-02-04 12:22:36 +01:00

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

  1. Install Dependencies

     pnpm install
    
  2. Build the Project

     pnpm run build
    
  3. Start a Local Development Server

     pnpm run start
    

    This will start a local development server at http://localhost:4400.