Skip to main content
Glama

Safari MCP Server

by lxman
setup.sh•2.85 kB
#!/bin/bash # Safari MCP Server Setup Script # This script helps set up the development environment echo "šŸš€ Setting up Safari MCP Server..." # Check if we're on macOS if [[ "$OSTYPE" != "darwin"* ]]; then echo "āŒ Error: This server only works on macOS" echo " Safari and SafariDriver are only available on macOS systems" exit 1 fi # Check if Node.js is installed if ! command -v node &> /dev/null; then echo "āŒ Error: Node.js is not installed" echo " Please install Node.js 18+ from https://nodejs.org/" exit 1 fi # Check Node.js version NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1) if [ "$NODE_VERSION" -lt 18 ]; then echo "āŒ Error: Node.js version 18+ is required" echo " Current version: $(node -v)" echo " Please update Node.js from https://nodejs.org/" exit 1 fi echo "āœ… Node.js version: $(node -v)" # Check if Safari is available if ! command -v safaridriver &> /dev/null; then echo "āŒ Error: SafariDriver not found" echo " SafariDriver should be available at /usr/bin/safaridriver" echo " Make sure you're running macOS with Safari 10+" exit 1 fi echo "āœ… SafariDriver found: $(which safaridriver)" # Install dependencies echo "šŸ“¦ Installing dependencies..." npm install if [ $? -ne 0 ]; then echo "āŒ Error: Failed to install dependencies" exit 1 fi echo "āœ… Dependencies installed" # Build the project echo "šŸ”Ø Building project..." npm run build if [ $? -ne 0 ]; then echo "āŒ Error: Failed to build project" exit 1 fi echo "āœ… Project built successfully" # Check Safari configuration echo "šŸ” Checking Safari configuration..." # Check if Developer menu is enabled (we can't check this programmatically) echo "āš ļø Please ensure Safari is configured:" echo " 1. Safari → Preferences → Advanced → 'Show Develop menu in menu bar' āœ“" echo " 2. Develop → Allow Remote Automation āœ“" # Try to enable SafariDriver echo "šŸ”§ Attempting to enable SafariDriver..." echo " You may be prompted for your admin password..." sudo safaridriver --enable if [ $? -eq 0 ]; then echo "āœ… SafariDriver enabled successfully" else echo "āš ļø SafariDriver enable failed. You may need to run manually:" echo " sudo safaridriver --enable" fi echo "" echo "šŸŽ‰ Setup complete!" echo "" echo "Next steps:" echo "1. Run the server: npm start" echo "2. Add to Claude Desktop config:" echo " File location: ~/Library/Application Support/Claude/claude_desktop_config.json" echo "" echo " Add this configuration:" echo " {" echo ' "mcpServers": {' echo ' "safari-devtools": {' echo ' "command": "node",' echo " \"args\": [\"$(pwd)/build/index.js\"]" echo " }" echo " }" echo " }" echo "" echo "3. Restart Claude Desktop to load the server" echo "" echo "For more information, see README.md"

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lxman/safari-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server