From 7edb64e46425a09c02d2bbfed8a6541a006e77a9 Mon Sep 17 00:00:00 2001 From: Morgan Joyce Date: Tue, 22 Jul 2025 14:50:09 -0500 Subject: [PATCH] refactor(mcp): simplify Playwright MCP server configuration - Replace wrapper script with direct npx command - Use @microsoft/playwright-mcp@latest to always get the latest version - Remove unnecessary setup and wrapper scripts - Eliminate maintenance overhead Principle: subtraction-creates-value --- mcp/mcp.json | 6 +++-- mcp/playwright-mcp-wrapper.sh | 27 ----------------------- mcp/setup-playwright-mcp.sh | 41 ----------------------------------- 3 files changed, 4 insertions(+), 70 deletions(-) delete mode 100755 mcp/playwright-mcp-wrapper.sh delete mode 100755 mcp/setup-playwright-mcp.sh diff --git a/mcp/mcp.json b/mcp/mcp.json index 4183423f..4b8aac69 100644 --- a/mcp/mcp.json +++ b/mcp/mcp.json @@ -57,8 +57,10 @@ } }, "playwright": { - "command": "playwright-mcp-wrapper.sh", - "args": [], + "command": "npx", + "args": [ + "@microsoft/playwright-mcp@latest" + ], "env": { "FASTMCP_LOG_LEVEL": "ERROR" } diff --git a/mcp/playwright-mcp-wrapper.sh b/mcp/playwright-mcp-wrapper.sh deleted file mode 100755 index cc7c81aa..00000000 --- a/mcp/playwright-mcp-wrapper.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Wrapper script for Microsoft Playwright MCP server -# This script handles execution and error handling for the Playwright MCP server - -set -e - -# Log file for debugging -LOG_FILE="$HOME/.playwright-mcp.log" - -# 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 -fi - -# Set default log level if not provided -export FASTMCP_LOG_LEVEL="${FASTMCP_LOG_LEVEL:-ERROR}" - -echo "Starting Microsoft Playwright MCP server..." | tee -a "$LOG_FILE" -echo "$(date): Playwright MCP server started" >> "$LOG_FILE" - -# Execute the Playwright MCP server -playwright-mcp "$@" -exit_code=$? -# Log the exit code -echo "$(date): Playwright MCP server exited with code $exit_code" >> "$LOG_FILE" -exit $exit_code diff --git a/mcp/setup-playwright-mcp.sh b/mcp/setup-playwright-mcp.sh deleted file mode 100755 index 22be3b29..00000000 --- a/mcp/setup-playwright-mcp.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Setup script for Microsoft Playwright MCP server -# Following the Spilled Coffee Principle - anyone should be able to set this up easily - -set -e - -echo "Setting up Microsoft Playwright MCP server..." - -# Check if npm is installed -if ! command -v npm &> /dev/null; then - echo "Error: npm is required but not installed. Please install Node.js and npm first." - exit 1 -fi - -# Install the official Microsoft Playwright MCP server -echo "Installing @microsoft/playwright-mcp..." -npm install -g @microsoft/playwright-mcp - -# Verify installation -if ! command -v playwright-mcp &> /dev/null; then - echo "Error: Installation failed. playwright-mcp command not found." - exit 1 -fi - -# Get the installed version -# Extract version using npm list and awk for simpler parsing -PLAYWRIGHT_MCP_VERSION=$(npm list -g @microsoft/playwright-mcp --depth=0 | awk -F@ '/playwright-mcp/ {print $NF}') -echo "Successfully installed @microsoft/playwright-mcp version $PLAYWRIGHT_MCP_VERSION" - -# Check if npx is installed -if ! command -v npx &> /dev/null; then - echo "Error: npx is required but not installed. Please install Node.js and npm first." - exit 1 -fi - -# Install Playwright browsers -echo "Installing Playwright browsers..." -npx playwright install - -echo "Playwright MCP server setup complete!" -echo "You can now use the Playwright MCP server through the mcp/playwright-mcp-wrapper.sh script."