Skip to content

Commit 0a7bdd9

Browse files
committed
adds chrome-devtools-mcp so we don't have to use npx
currently latest release while we're only experimenting but I've tested that we get a fixed version if we change in VERSION
1 parent a69bd7a commit 0a7bdd9

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

bin/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ zap-pretty
5252
act
5353
parquet-tools
5454
osv-scanner
55+
chrome-devtools-mcp

bin/y-chrome-devtools-mcp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
[ -z "$DEBUG" ] || set -x
3+
set -e
4+
5+
YBIN="$(dirname $0)"
6+
PACKAGE_NAME="chrome-devtools-mcp"
7+
VERSION="latest"
8+
9+
if ! command -v npm &> /dev/null; then
10+
echo "npm is required but not installed" 1>&2
11+
exit 1
12+
fi
13+
14+
# Get the package version info
15+
if [ "$VERSION" = "latest" ]; then
16+
ACTUAL_VERSION=$(cd $YBIN; npm view $PACKAGE_NAME version)
17+
else
18+
ACTUAL_VERSION=$VERSION
19+
fi
20+
21+
BIN_DIR="$YBIN/y-$PACKAGE_NAME-$ACTUAL_VERSION-bin"
22+
23+
# Download and install if not already cached
24+
if [ ! -d "$BIN_DIR" ]; then
25+
echo "Installing $PACKAGE_NAME@$ACTUAL_VERSION..." 1>&2
26+
27+
TEMP_DIR=$(mktemp -d)
28+
trap "rm -rf $TEMP_DIR" EXIT
29+
30+
cd "$TEMP_DIR"
31+
npm install "$PACKAGE_NAME@$ACTUAL_VERSION" --prefix . --no-save --omit=dev --ignore-scripts
32+
33+
# Move the installed package to cache
34+
mv "$TEMP_DIR/node_modules/$PACKAGE_NAME" "$BIN_DIR"
35+
fi
36+
37+
# Installed, now run with our rules
38+
39+
if echo "$@" | grep -q "\-\-help"; then
40+
true
41+
elif echo "$@" | grep -q "\-\-version"; then
42+
true
43+
elif ! echo "$@" | grep -q "\-\-isolated"; then
44+
echo "Error: $0 requires --isolated" 1>&2
45+
[ "DEVTOOLS_MCP_ALLOW_NON_ISOLATED" = "1" ] && echo "Overriding due to DEVTOOLS_MCP_ALLOW_NON_ISOLATED=$DEVTOOLS_MCP_ALLOW_NON_ISOLATED" 1>&2 || exit 1
46+
fi
47+
48+
/usr/bin/env node $BIN_DIR/build/src/index.js "$@"

0 commit comments

Comments
 (0)