#!/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