🐛 Default MCP listen addresses to localhost instead of 0.0.0.0

Signed-off-by: moktamd <moktamd@users.noreply.github.com>
This commit is contained in:
moktamd
2026-03-19 11:37:32 +00:00
committed by Andrey Antukh
parent af4548a6ed
commit 4e3dc6532a
4 changed files with 10 additions and 9 deletions

View File

@@ -258,7 +258,7 @@ The Penpot MCP server can be configured using environment variables.
| Environment Variable | Description | Default |
|------------------------------------|----------------------------------------------------------------------------|--------------|
| `PENPOT_MCP_SERVER_LISTEN_ADDRESS` | Address on which the MCP server listens (binds to) | `localhost` |
| `PENPOT_MCP_SERVER_HOST` | Address on which the MCP server listens (binds to) | `localhost` |
| `PENPOT_MCP_SERVER_PORT` | Port for the HTTP/SSE server | `4401` |
| `PENPOT_MCP_WEBSOCKET_PORT` | Port for the WebSocket server (plugin connection) | `4402` |
| `PENPOT_MCP_REPL_PORT` | Port for the REPL server (development/debugging) | `4403` |
@@ -276,7 +276,7 @@ The Penpot MCP server can be configured using environment variables.
| Environment Variable | Description | Default |
|-------------------------------------------|-----------------------------------------------------------------------------------------|--------------|
| `PENPOT_MCP_PLUGIN_SERVER_LISTEN_ADDRESS` | Address on which the plugin web server listens (single address or comma-separated list) | (local only) |
| `PENPOT_MCP_PLUGIN_SERVER_HOST` | Address on which the plugin web server listens (single address or comma-separated list) | (local only) |
## Beyond Local Execution
@@ -303,4 +303,4 @@ you may set the following environment variables to configure the two servers
* Auto-formatting: Use `pnpm run fmt`
* Generating API type data: See [types-generator/README.md](types-generator/README.md)
* Packaging and publishing:
- Create npm package: `bash scripts/pack` (sets version and then calls `npm pack`)
- Create npm package: `bash scripts/pack` (sets version and then calls `npm pack`)

View File

@@ -4,7 +4,7 @@
"version": "1.0.0",
"type": "module",
"scripts": {
"start": "vite build --watch --config vite.config.ts",
"start": "cross-env PENPOT_MCP_PLUGIN_SERVER_HOST=0.0.0.0 vite build --watch --config vite.config.ts",
"start:multi-user": "pnpm run start",
"build": "tsc && vite build --config vite.release.config.ts",
"types:check": "tsc --noEmit",

View File

@@ -2,13 +2,14 @@ import { defineConfig } from "vite";
import livePreview from "vite-live-preview";
let WS_URI = process.env.WS_URI || "http://localhost:4402";
let SERVER_HOST = process.env.PENPOT_MCP_PLUGIN_SERVER_HOST ?? "localhost";
console.log("Will define PENPOT_MCP_WEBSOCKET_URL as:", JSON.stringify(WS_URI));
export default defineConfig({
base: "./",
plugins: [
livePreview({
base: "./",
plugins: [
livePreview({
reload: true,
config: {
build: {
@@ -29,7 +30,7 @@ export default defineConfig({
},
},
preview: {
host: "0.0.0.0",
host: SERVER_HOST,
port: 4400,
cors: true,
allowedHosts: [],

View File

@@ -75,7 +75,7 @@ export class PenpotMcpServer {
constructor(private isMultiUser: boolean = false) {
// read port configuration from environment variables
this.host = process.env.PENPOT_MCP_SERVER_HOST ?? "0.0.0.0";
this.host = process.env.PENPOT_MCP_SERVER_HOST ?? "localhost";
this.port = parseInt(process.env.PENPOT_MCP_SERVER_PORT ?? "4401", 10);
this.webSocketPort = parseInt(process.env.PENPOT_MCP_WEBSOCKET_PORT ?? "4402", 10);
this.replPort = parseInt(process.env.PENPOT_MCP_REPL_PORT ?? "4403", 10);