Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions mcp/playwright-mcp-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,32 @@ set -e
# Log file for debugging
LOG_FILE="$HOME/.playwright-mcp.log"

# Get the directory of this script
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Check if playwright-mcp is installed
if ! command -v playwright-mcp &> /dev/null; then
echo "Error: playwright-mcp not found. Please run mcp/setup-playwright-mcp.sh first." | tee -a "$LOG_FILE"
exit 1
echo "playwright-mcp not found. Attempting to install automatically..." | tee -a "$LOG_FILE"

# Check if setup script exists
if [[ -f "$SCRIPT_DIR/setup-playwright-mcp.sh" ]]; then
echo "Running setup script..." | tee -a "$LOG_FILE"
# Make sure it's executable
chmod +x "$SCRIPT_DIR/setup-playwright-mcp.sh"
# Run the setup script
"$SCRIPT_DIR/setup-playwright-mcp.sh"

# Check again if installation was successful
if ! command -v playwright-mcp &> /dev/null; then
echo "Error: Installation failed. Please run mcp/setup-playwright-mcp.sh manually." | tee -a "$LOG_FILE"
exit 1
fi

echo "Installation successful!" | tee -a "$LOG_FILE"
else
echo "Error: Setup script not found at $SCRIPT_DIR/setup-playwright-mcp.sh" | tee -a "$LOG_FILE"
exit 1
fi
fi

# Set default log level if not provided
Expand Down