mirror of
https://github.com/penpot/penpot.git
synced 2026-02-12 14:42:56 +00:00
⏪ Backport MCP related changes from develop (#8306)
This commit is contained in:
17
.github/workflows/build-docker.yml
vendored
17
.github/workflows/build-docker.yml
vendored
@@ -59,6 +59,7 @@ jobs:
|
|||||||
mv penpot/frontend bundle-frontend
|
mv penpot/frontend bundle-frontend
|
||||||
mv penpot/exporter bundle-exporter
|
mv penpot/exporter bundle-exporter
|
||||||
mv penpot/storybook bundle-storybook
|
mv penpot/storybook bundle-storybook
|
||||||
|
mv penpot/mcp bundle-mcp
|
||||||
popd
|
popd
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
@@ -89,6 +90,7 @@ jobs:
|
|||||||
backend
|
backend
|
||||||
exporter
|
exporter
|
||||||
storybook
|
storybook
|
||||||
|
mcp
|
||||||
labels: |
|
labels: |
|
||||||
bundle_version=${{ steps.bundles.outputs.bundle_version }}
|
bundle_version=${{ steps.bundles.outputs.bundle_version }}
|
||||||
|
|
||||||
@@ -152,6 +154,21 @@ jobs:
|
|||||||
cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache
|
cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache
|
||||||
cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache,mode=max
|
cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache,mode=max
|
||||||
|
|
||||||
|
- name: Build and push MCP Docker image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
env:
|
||||||
|
DOCKER_IMAGE: 'mcp'
|
||||||
|
BUNDLE_PATH: './bundle-mcp'
|
||||||
|
with:
|
||||||
|
context: ./docker/images/
|
||||||
|
file: ./docker/images/Dockerfile.mcp
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ steps.vars.outputs.gh_ref }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache
|
||||||
|
cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache,mode=max
|
||||||
|
|
||||||
- name: Notify Mattermost
|
- name: Notify Mattermost
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: mattermost/action-mattermost-notify@master
|
uses: mattermost/action-mattermost-notify@master
|
||||||
|
|||||||
45
manage.sh
45
manage.sh
@@ -124,7 +124,7 @@ function run-devenv-shell {
|
|||||||
docker exec -ti \
|
docker exec -ti \
|
||||||
-e JAVA_OPTS="$JAVA_OPTS" \
|
-e JAVA_OPTS="$JAVA_OPTS" \
|
||||||
-e EXTERNAL_UID=$CURRENT_USER_ID \
|
-e EXTERNAL_UID=$CURRENT_USER_ID \
|
||||||
penpot-devenv-main sudo -EH -u penpot bash;
|
penpot-devenv-main sudo -EH -u penpot $@
|
||||||
}
|
}
|
||||||
|
|
||||||
function run-devenv-isolated-shell {
|
function run-devenv-isolated-shell {
|
||||||
@@ -138,7 +138,7 @@ function run-devenv-isolated-shell {
|
|||||||
-e SHADOWCLJS_EXTRA_PARAMS=$SHADOWCLJS_EXTRA_PARAMS \
|
-e SHADOWCLJS_EXTRA_PARAMS=$SHADOWCLJS_EXTRA_PARAMS \
|
||||||
-e JAVA_OPTS="$JAVA_OPTS" \
|
-e JAVA_OPTS="$JAVA_OPTS" \
|
||||||
-w /home/penpot/penpot/$1 \
|
-w /home/penpot/penpot/$1 \
|
||||||
$DEVENV_IMGNAME:latest sudo -EH -u penpot bash
|
$DEVENV_IMGNAME:latest sudo -EH -u penpot $@
|
||||||
}
|
}
|
||||||
|
|
||||||
function build-imagemagick-docker-image {
|
function build-imagemagick-docker-image {
|
||||||
@@ -215,6 +215,23 @@ function build-frontend-bundle {
|
|||||||
echo ">> bundle frontend end";
|
echo ">> bundle frontend end";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function build-mcp-bundle {
|
||||||
|
echo ">> bundle mcp start";
|
||||||
|
|
||||||
|
mkdir -p ./bundles
|
||||||
|
local version=$(print-current-version);
|
||||||
|
local bundle_dir="./bundles/mcp";
|
||||||
|
|
||||||
|
build "mcp";
|
||||||
|
|
||||||
|
rm -rf $bundle_dir;
|
||||||
|
mv ./mcp/dist $bundle_dir;
|
||||||
|
echo $version > $bundle_dir/version.txt;
|
||||||
|
put-license-file $bundle_dir;
|
||||||
|
echo ">> bundle mcp end";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function build-backend-bundle {
|
function build-backend-bundle {
|
||||||
echo ">> bundle backend start";
|
echo ">> bundle backend start";
|
||||||
|
|
||||||
@@ -309,6 +326,16 @@ function build-exporter-docker-image {
|
|||||||
popd;
|
popd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function build-mcp-docker-image {
|
||||||
|
rsync -avr --delete ./bundles/mcp/ ./docker/images/bundle-mcp/;
|
||||||
|
pushd ./docker/images;
|
||||||
|
docker build \
|
||||||
|
-t penpotapp/mcp:$CURRENT_BRANCH -t penpotapp/mcp:latest \
|
||||||
|
--build-arg BUNDLE_PATH="./bundle-mcp/" \
|
||||||
|
-f Dockerfile.mcp .;
|
||||||
|
popd;
|
||||||
|
}
|
||||||
|
|
||||||
function build-storybook-docker-image {
|
function build-storybook-docker-image {
|
||||||
rsync -avr --delete ./bundles/storybook/ ./docker/images/bundle-storybook/;
|
rsync -avr --delete ./bundles/storybook/ ./docker/images/bundle-storybook/;
|
||||||
pushd ./docker/images;
|
pushd ./docker/images;
|
||||||
@@ -335,17 +362,19 @@ function usage {
|
|||||||
echo "- isolated-shell Starts a bash shell in a new devenv container."
|
echo "- isolated-shell Starts a bash shell in a new devenv container."
|
||||||
echo "- log-devenv Show logs of the running devenv docker compose service."
|
echo "- log-devenv Show logs of the running devenv docker compose service."
|
||||||
echo ""
|
echo ""
|
||||||
echo "- build-bundle Build all bundles (frontend, backend and exporter)."
|
echo "- build-bundle Build all bundles (frontend, backend, exporter, storybook and mcp)."
|
||||||
echo "- build-frontend-bundle Build frontend bundle"
|
echo "- build-frontend-bundle Build frontend bundle"
|
||||||
echo "- build-backend-bundle Build backend bundle."
|
echo "- build-backend-bundle Build backend bundle."
|
||||||
echo "- build-exporter-bundle Build exporter bundle."
|
echo "- build-exporter-bundle Build exporter bundle."
|
||||||
echo "- build-storybook-bundle Build storybook bundle."
|
echo "- build-storybook-bundle Build storybook bundle."
|
||||||
|
echo "- build-mcp-bundle Build mcp bundle."
|
||||||
echo "- build-docs-bundle Build docs bundle."
|
echo "- build-docs-bundle Build docs bundle."
|
||||||
echo ""
|
echo ""
|
||||||
echo "- build-docker-images Build all docker images (frontend, backend and exporter)."
|
echo "- build-docker-images Build all docker images (frontend, backend and exporter)."
|
||||||
echo "- build-frontend-docker-image Build frontend docker images."
|
echo "- build-frontend-docker-image Build frontend docker images."
|
||||||
echo "- build-backend-docker-image Build backend docker images."
|
echo "- build-backend-docker-image Build backend docker images."
|
||||||
echo "- build-exporter-docker-image Build exporter docker images."
|
echo "- build-exporter-docker-image Build exporter docker images."
|
||||||
|
echo "- build-mcp-docker-image Build exporter docker images."
|
||||||
echo "- build-storybook-docker-image Build storybook docker images."
|
echo "- build-storybook-docker-image Build storybook docker images."
|
||||||
echo ""
|
echo ""
|
||||||
echo "- version Show penpot's version."
|
echo "- version Show penpot's version."
|
||||||
@@ -397,6 +426,7 @@ case $1 in
|
|||||||
## production builds
|
## production builds
|
||||||
build-bundle)
|
build-bundle)
|
||||||
build-frontend-bundle;
|
build-frontend-bundle;
|
||||||
|
build-mcp-bundle;
|
||||||
build-backend-bundle;
|
build-backend-bundle;
|
||||||
build-exporter-bundle;
|
build-exporter-bundle;
|
||||||
build-storybook-bundle;
|
build-storybook-bundle;
|
||||||
@@ -406,6 +436,10 @@ case $1 in
|
|||||||
build-frontend-bundle;
|
build-frontend-bundle;
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
build-mcp-bundle)
|
||||||
|
build-mcp-bundle;
|
||||||
|
;;
|
||||||
|
|
||||||
build-backend-bundle)
|
build-backend-bundle)
|
||||||
build-backend-bundle;
|
build-backend-bundle;
|
||||||
;;
|
;;
|
||||||
@@ -431,6 +465,7 @@ case $1 in
|
|||||||
build-frontend-docker-image
|
build-frontend-docker-image
|
||||||
build-backend-docker-image
|
build-backend-docker-image
|
||||||
build-exporter-docker-image
|
build-exporter-docker-image
|
||||||
|
build-mcp-docker-image
|
||||||
build-storybook-docker-image
|
build-storybook-docker-image
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -446,6 +481,10 @@ case $1 in
|
|||||||
build-exporter-docker-image
|
build-exporter-docker-image
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
build-mcp-docker-image)
|
||||||
|
build-mcp-docker-image
|
||||||
|
;;
|
||||||
|
|
||||||
build-storybook-docker-image)
|
build-storybook-docker-image)
|
||||||
build-storybook-docker-image
|
build-storybook-docker-image
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Penpot MCP Plugin",
|
"name": "Penpot MCP Plugin",
|
||||||
"code": "plugin.js",
|
"code": "plugin.js",
|
||||||
|
"version": 2,
|
||||||
"description": "This plugin enables interaction with the Penpot MCP server",
|
"description": "This plugin enables interaction with the Penpot MCP server",
|
||||||
"permissions": ["content:read", "content:write", "library:read", "library:write", "comment:read", "comment:write"]
|
"permissions": ["content:read", "content:write", "library:read", "library:write", "comment:read", "comment:write"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ export class PenpotMcpServer {
|
|||||||
this.port = parseInt(process.env.PENPOT_MCP_SERVER_PORT ?? "4401", 10);
|
this.port = parseInt(process.env.PENPOT_MCP_SERVER_PORT ?? "4401", 10);
|
||||||
this.webSocketPort = parseInt(process.env.PENPOT_MCP_WEBSOCKET_PORT ?? "4402", 10);
|
this.webSocketPort = parseInt(process.env.PENPOT_MCP_WEBSOCKET_PORT ?? "4402", 10);
|
||||||
this.replPort = parseInt(process.env.PENPOT_MCP_REPL_PORT ?? "4403", 10);
|
this.replPort = parseInt(process.env.PENPOT_MCP_REPL_PORT ?? "4403", 10);
|
||||||
this.listenAddress = process.env.PENPOT_MCP_SERVER_LISTEN_ADDRESS ?? "localhost";
|
this.listenAddress = process.env.PENPOT_MCP_SERVER_LISTEN_ADDRESS ?? "0.0.0.0";
|
||||||
this.serverAddress = process.env.PENPOT_MCP_SERVER_ADDRESS ?? "localhost";
|
this.serverAddress = process.env.PENPOT_MCP_SERVER_ADDRESS ?? "0.0.0.0";
|
||||||
|
|
||||||
this.configLoader = new ConfigurationLoader(process.cwd());
|
this.configLoader = new ConfigurationLoader(process.cwd());
|
||||||
this.apiDocs = new ApiDocs();
|
this.apiDocs = new ApiDocs();
|
||||||
|
|||||||
Reference in New Issue
Block a user