mirror of
https://github.com/penpot/penpot-mcp.git
synced 2026-04-25 11:18:37 +00:00
Replace CLI parameters with environment variables, keeping only --multi-user and --help Environment variables: - PENPOT_MCP_SERVER_PORT (new, replaces CLI param) - PENPOT_MCP_WEBSOCKET_PORT (new) - PENPOT_MCP_REPL_PORT (new) - PENPOT_MCP_SERVER_ADDRESS (new) - PENPOT_MCP_REMOTE_MODE (existing) - PENPOT_MCP_LOG_LEVEL (renamed from LOG_LEVEL, replaces CLI param) - PENPOT_MCP_LOG_DIR (renamed from LOG_DIR, replaces CLI param) - PENPOT_MCP_PLUGIN_SERVER_LISTEN_ADDRESS (renamed from PENPOT_MCP_PLUGIN_SERVER_ALLOWED_HOSTS) Additional changes: - Plugin now constructs WebSocket URL from server address and port (replaces PENPOT_MCP_WEBSOCKET_URL) - Use configured server address in all startup log messages - Document all configuration options in README.md
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import livePreview from "vite-live-preview";
|
|
|
|
// Debug: Log the environment variables
|
|
console.log("MULTI_USER_MODE env:", process.env.MULTI_USER_MODE);
|
|
console.log("Will define IS_MULTI_USER_MODE as:", JSON.stringify(process.env.MULTI_USER_MODE === "true"));
|
|
|
|
const serverAddress = process.env.PENPOT_MCP_SERVER_ADDRESS || "localhost";
|
|
const websocketPort = process.env.PENPOT_MCP_WEBSOCKET_PORT || "4402";
|
|
const websocketUrl = `ws://${serverAddress}:${websocketPort}`;
|
|
console.log("Will define PENPOT_MCP_WEBSOCKET_URL as:", JSON.stringify(websocketUrl));
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
livePreview({
|
|
reload: true,
|
|
config: {
|
|
build: {
|
|
sourcemap: true,
|
|
},
|
|
},
|
|
}),
|
|
],
|
|
build: {
|
|
rollupOptions: {
|
|
input: {
|
|
plugin: "src/plugin.ts",
|
|
index: "./index.html",
|
|
},
|
|
output: {
|
|
entryFileNames: "[name].js",
|
|
},
|
|
},
|
|
},
|
|
preview: {
|
|
port: 4400,
|
|
cors: true,
|
|
allowedHosts: process.env.PENPOT_MCP_PLUGIN_SERVER_LISTEN_ADDRESS
|
|
? process.env.PENPOT_MCP_PLUGIN_SERVER_LISTEN_ADDRESS.split(",").map((h) => h.trim())
|
|
: [],
|
|
},
|
|
define: {
|
|
IS_MULTI_USER_MODE: JSON.stringify(process.env.MULTI_USER_MODE === "true"),
|
|
PENPOT_MCP_WEBSOCKET_URL: JSON.stringify(websocketUrl),
|
|
},
|
|
});
|