Add mcp plugin into the frontend bundle

This commit is contained in:
Andrey Antukh
2026-02-09 15:37:57 +01:00
parent 0027e9031a
commit 5ec345162a
5 changed files with 25 additions and 15 deletions

View File

@@ -121,7 +121,7 @@ http {
proxy_http_version 1.1;
}
location /mcp {
location /plugins/mcp {
alias /home/penpot/penpot/mcp/packages/plugin/dist;
proxy_http_version 1.1;
}

View File

@@ -129,6 +129,11 @@ http {
proxy_buffering off;
}
location /plugins {
alias /var/www/app/plugins;
proxy_http_version 1.1;
}
location /readyz {
access_log off;
proxy_pass $PENPOT_BACKEND_URI$request_uri;

View File

@@ -4,8 +4,6 @@
set -ex
export INCLUDE_STORYBOOK=${BUILD_STORYBOOK:-no};
export INCLUDE_WASM=${BUILD_WASM:-yes};
export EXTRA_PARAMS=$SHADOWCLJS_EXTRA_PARAMS;
export BUILD_DATE=$(date -R);
@@ -18,6 +16,8 @@ export VERSION_TAG="${VERSION}-${BUILD_TS}";
# performant code on macros (example: rumext)
export NODE_ENV=production;
rm -rf node_modules;
corepack enable;
corepack install;
pnpm install;
@@ -28,10 +28,17 @@ rm -rf resources/public;
mkdir -p resources/public;
mkdir -p target/dist;
# Build render wasm binary
pushd ../render-wasm;
./build
popd
pushd ../mcp;
rm -rf node_modules;
./scripts/setup
WS_URI="/mcp/ws" pnpm run --filter "mcp-plugin" build:multi-user
popd;
pnpm run build:app:main $EXTRA_PARAMS;
pnpm run build:app:libs;
pnpm run build:app:assets;
@@ -40,8 +47,6 @@ sed -i "s/\.\/render.js/.\/render.js?version=$VERSION_TAG/g" resources/public/js
rsync -avr resources/public/ target/dist/
if [ "$INCLUDE_STORYBOOK" = "yes" ]; then
# build storybook
pnpm run build:storybook || exit 1;
rsync -avr storybook-static/ target/dist/storybook-static;
fi
# Include the MCP plugin on the bundle
mkdir -p target/dist/plugins/mcp/;
rsync -avr ../mcp/packages/plugin/dist/ target/dist/plugins/mcp/

View File

@@ -13,7 +13,7 @@ export VERSION_TAG="${VERSION}-${BUILD_TS}";
export NODE_ENV=production;
corepack enable;
corepack install || exit 1;
pnpm install || exit 1;
corepack install;
pnpm install;
pnpm run build:storybook || exit 1;
pnpm run build:storybook;

View File

@@ -1,14 +1,14 @@
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"));
let WS_URI = process.env.WS_URI || "http://localhost:4402";
let MULTI_USER_MODE = process.env.MULTI_USER_MODE === "true";
let WS_URI = "http://localhost:4402";
console.log("Will define IS_MULTI_USER_MODE as:", JSON.stringify(MULTI_USER_MODE));
console.log("Will define PENPOT_MCP_WEBSOCKET_URL as:", JSON.stringify(WS_URI));
export default defineConfig({
base: "./",
plugins: [
livePreview({
reload: true,