Skip to content

Commit 6203a26

Browse files
committed
Add entrypoint script to support optional BROWSER_URL
The entrypoint script checks if BROWSER_URL environment variable is set and only passes --browserUrl flag if it's provided. This allows the MCP registry to support optional browser connection without template issues. Default behavior (no BROWSER_URL): Launches Chrome in headless mode With BROWSER_URL: Connects to existing Chrome instance
1 parent 4bfa245 commit 6203a26

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ WORKDIR /app
4545
COPY --from=builder /app/build ./build
4646
COPY --from=builder /app/node_modules ./node_modules
4747

48+
# Copy entrypoint script
49+
COPY docker-entrypoint.sh /usr/local/bin/
50+
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
51+
4852
# Set environment to tell Puppeteer where Chromium is installed
4953
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
5054

@@ -56,5 +60,5 @@ RUN groupadd -r mcpuser && useradd -r -g mcpuser -G audio,video mcpuser \
5660

5761
USER mcpuser
5862

59-
# Expose MCP server via stdio
60-
ENTRYPOINT ["node", "build/src/index.js"]
63+
# Use entrypoint script that handles optional BROWSER_URL
64+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

docker-entrypoint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Build command with optional arguments
5+
CMD="node build/src/index.js"
6+
7+
# Add browserUrl if BROWSER_URL is set and not empty
8+
if [ -n "$BROWSER_URL" ]; then
9+
CMD="$CMD --browserUrl $BROWSER_URL"
10+
fi
11+
12+
# Execute the command
13+
exec $CMD "$@"

0 commit comments

Comments
 (0)