Skip to main content
Glama

Safari DevTools MCP

npm version npm downloads license node

safari-devtools-mcp lets your coding agent (such as Claude, Cursor, Copilot or Gemini) control and inspect a live Safari browser on macOS. It acts as a Model-Context-Protocol (MCP) server, giving your AI coding assistant access to Safari DevTools for debugging, automation, and testing.

Chrome developers get powerful AI debugging through chrome-devtools-mcp by Google. Safari developers should have something equivalent — this project brings that same experience to Safari, with matching tool names and parameter schemas so you can swap between browsers with minimal friction.

Changelog | Contributing

Note: This server exposes browser content (page data, console logs, network traffic) to MCP clients. Avoid browsing sensitive websites or entering credentials while a session is active.

Related MCP server: Safari MCP Server

Why safari-devtools-mcp?

This project uses WebDriver for capabilities that scripting alone cannot provide:

  • Network request/response body capture — intercepts fetch and XHR calls with full headers, payloads, and timing

  • DOM snapshots via accessibility tree — stable element UIDs that survive page re-renders, not brittle CSS selectors

  • CSS computed style inspection — read any computed property from any element

  • Cookie and storage management — read, write, and delete cookies, localStorage, and sessionStorage

  • Element-level screenshots — capture individual elements, not just the full viewport

  • Session auto-recovery — detects dead SafariDriver sessions and reconnects transparently

Key features

  • Browser debugging: Capture console logs, inspect network requests, and evaluate JavaScript — with stack traces and full request/response details.

  • Reliable automation: Click, type, fill forms, drag and drop, and press keyboard shortcuts using accessibility-tree snapshots with stable UIDs.

  • Native macOS integration: Tab management via AppleScript for listing, switching, and controlling Safari tabs across windows

Requirements

  • macOS (Safari and SafariDriver are Apple-exclusive)

  • Node.js 18+ (22+ recommended)

  • Safari with remote automation enabled

Safari setup

  1. Open Safari > Settings > Advanced > check "Show features for web developers"

  2. Develop menu > check "Allow Remote Automation"

  3. Authorize SafariDriver:

    sudo safaridriver --enable

Getting started

Standard MCP config:

{
  "mcpServers": {
    "safari-devtools": {
      "command": "npx",
      "args": ["-y", "safari-devtools-mcp@latest"]
    }
  }
}
claude mcp add safari-devtools -- npx -y safari-devtools-mcp@latest

Or add to your project's .mcp.json using the standard config above.

Add the standard config to ~/Library/Application Support/Claude/claude_desktop_config.json.

Add the standard config to your Cursor MCP settings.

Add the standard config to .vscode/mcp.json.

copilot mcp add safari-devtools -- npx -y safari-devtools-mcp@latest
gemini mcp add safari-devtools -- npx -y safari-devtools-mcp@latest

Or add the standard config to your ~/.gemini/settings.json.

Add the standard config to your .gemini/settings.json in the project root.

Add the standard config to your .junie/mcp.json in the project root.

Open "Install MCP Server" in Raycast and fill in:

  • Command: npx

  • Arguments: -y safari-devtools-mcp@latest

Or copy the standard config JSON above before opening the command — Raycast will auto-fill the form.

Add the standard config to your .vs/mcp.json in the solution root.

Add the standard config to your Warp MCP settings file at ~/.warp/mcp.json.

git clone https://github.com/HayoDev/safari-devtools-mcp.git
cd safari-devtools-mcp
npm install && npm run build

Then point your MCP client to the built entry point:

{
  "mcpServers": {
    "safari-devtools": {
      "command": "node",
      "args": [
        "/path/to/safari-devtools-mcp/build/src/bin/safari-devtools-mcp.js"
      ]
    }
  }
}

Your first prompt

Navigate to https://example.com, take a snapshot, and list any console errors.

Slim mode

Use --slim to reduce token usage with shorter tool descriptions. Useful when working with context-limited models or long conversations:

{
  "mcpServers": {
    "safari-devtools": {
      "command": "npx",
      "args": ["-y", "safari-devtools-mcp@latest", "--slim"]
    }
  }
}

Prompts (skills)

The server exposes guided debugging workflows as MCP prompts. Clients that support prompts (e.g. Claude Desktop, Claude Code) can invoke them by name:

Prompt

Description

safari-devtools

Getting started — tool overview, recommended workflow, and Safari-specific notes

a11y-debugging

Accessibility audit — a11y tree inspection, axe-core injection, WCAG checks

safari-specific-debugging

Debug WebKit quirks — CSS prefixes, JS feature gaps, ITP/CORS issues

performance-debugging

Performance analysis — Navigation Timing, Core Web Vitals, resource waterfall

Tools (45)

Debugging

Tool

Description

list_console_messages

List console messages with filtering by level (log, warn, error)

get_console_message

Get a detailed message including stack trace and arguments

clear_console

Clear all captured console messages

list_network_requests

Monitor network requests — Fetch, XHR, and resource loads

get_network_request

Get full request/response details with headers and body

clear_network

Clear all captured network requests

evaluate_script

Execute JavaScript in the browser context and return results

take_screenshot

Capture a PNG screenshot of the page or a specific element

take_snapshot

Accessibility-tree snapshot of the DOM with stable UIDs for element targeting

Page content

Tool

Description

get_page_content

Get the page title, URL, and visible text content

get_html_source

Get the full HTML source of the page

extract_links

Extract all links with their text, href, and rel attributes

extract_meta

Extract meta tags (og:, twitter:, description, etc.)

Navigation

Tool

Description

list_pages

List all open Safari tabs across windows

select_page

Switch to a specific tab

new_page

Open a new tab and navigate to a URL

close_page

Close a tab

navigate_page

Navigate to a URL, go back, forward, or reload

wait_for

Wait for specific text to appear on the page

resize_page

Resize the browser window

handle_dialog

Accept or dismiss browser dialogs (alert, confirm, prompt)

Scroll

Tool

Description

scroll

Scroll the page in any direction by a given amount

scroll_to_element

Scroll an element into view by its UID

CSS inspection

Tool

Description

get_computed_style

Get computed CSS styles for any element by UID

Cookies & storage

Tool

Description

get_cookies

Get browser cookies, optionally filtered by name or domain

set_cookie

Set a cookie with name, value, and optional attributes

delete_cookie

Delete a cookie by name, or delete all cookies

get_storage

Read from localStorage or sessionStorage

set_storage

Write a key-value pair to localStorage or sessionStorage

delete_storage

Delete a key or clear all entries from localStorage/sessionStorage

Input automation

Tool

Description

click

Click an element by UID from a snapshot

click_at

Click at specific x/y coordinates

right_click

Right-click (context menu) on an element

select_option

Select an option from a dropdown by value or label

hover

Hover over an element

fill

Type into an input field or select from a dropdown

fill_form

Fill multiple form fields at once

type_text

Type text into the currently focused element

drag

Drag and drop between elements or coordinates

press_key

Press a key or combination (e.g., Meta+A, Enter)

upload_file

Upload a file through a file input

iOS Safari validation

Tool

Description

inspect_viewport_meta

Parse the viewport meta tag and validate against iOS best practices (width, zoom, viewport-fit)

get_safe_area_insets

Read CSS safe-area-inset values and check whether the page handles notched devices correctly

check_ios_web_app_readiness

Audit the page for Add to Home Screen / PWA readiness (apple-touch-icon, manifest, splash screens, status bar)

check_webkit_compatibility

Check page CSS against the live Safari session via CSS.supports()

Architecture

MCP Client (Claude, Cursor, etc.)
    | stdio (MCP protocol)
    v
Safari DevTools MCP Server
    |
    v
+-------------------------------+
|  SafariDriver                 |
|  +-- Selenium WebDriver       | <-- Browser automation
|  +-- JS Injection             | <-- Console/Network capture
|  +-- AppleScript (osascript)  | <-- Native tab management
+-------------------------------+
    |
    v
Safari Browser

Known limitations

  • Single session: Safari only allows one WebDriver session at a time. Running multiple instances is not supported.

  • macOS only: Safari and SafariDriver are Apple-exclusive — this server does not work on Linux or Windows.

  • No headless mode: Safari does not support headless operation. A visible browser window is required.

  • Console pre-injection gap: Console messages logged before the capture script is injected are not captured.

  • Network pre-injection gap: Network requests made before injection are backfilled via the Performance API with limited detail (timing and size, but no headers or status codes).

  • PNG only: Safari WebDriver only supports PNG screenshots — no JPEG or WebP. Full-page capture is not available.

  • AppleScript permissions: Tab management features require macOS Accessibility permissions for osascript.

Credits

  • chrome-devtools-mcp by Google/ChromeDevTools — the inspiration and interface standard this project mirrors. Tool names and schemas are intentionally compatible so you can switch between Chrome and Safari seamlessly.

  • safari-mcp-server — prior art for Safari MCP integration that we studied during development.

License

MIT

Available Tools

49 tools
check_ios_web_app_readinessA

Audit the page for iOS Safari "Add to Home Screen" / PWA readiness. Checks apple-touch-icon, apple-mobile-web-app-capable, status bar style, theme-color, manifest link, and splash screen configuration.

Inputs: no named parameters.

check_webkit_compatibilityA

Check CSS on the current page against the live Safari session. Extracts every CSS property via structured DOM APIs, runs CSS.supports() in the actual browser, and reports what is broken right now — unsupported properties, missing -webkit- prefixes, and known Safari rendering quirks.

Inputs: no named parameters.

clear_consoleA

Clear all captured console messages.

Inputs: no named parameters.

clear_networkA

Clear all captured network requests.

Inputs: no named parameters.

clickC

Clicks on the provided element.

Inputs: uid (required), dblClick.

click_atC

Clicks at the provided coordinates.

Inputs: x (required), y (required), dblClick.

close_pageA

Closes a page by its ID. The last open page cannot be closed.

Inputs: pageId (required).

delete_storageA

Delete a key from localStorage or sessionStorage, or clear all entries.

Inputs: key, storageType.

dragB

Drag an element onto another element.

Inputs: to_uid (required), from_uid (required).

evaluate_scriptA

Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON, so returned values have to be JSON-serializable.

Inputs: function (required), args.

extract_metaA

Extract meta tags from the current page (og:, twitter:, description, etc.).

Inputs: no named parameters.

fillC

Type text into an input, text area or select an option from a element.

Inputs: uid (required), value (required).

fill_formB

Fill out multiple form elements at once.

Inputs: elements (required).

get_color_schemeA

Check the currently active color scheme preference (light or dark) as seen by the page, and whether an MCP override is active.

Inputs: no named parameters.

get_computed_styleA

Get computed CSS styles for an element by its UID from a snapshot. Returns commonly useful properties by default, or specify exact properties.

Inputs: uid (required), properties.

get_console_messageA

Gets a console message by its ID. You can get all messages by calling list_console_messages.

Inputs: msgid (required).

get_cookiesA

Get browser cookies for the current page. Optionally filter by name or domain.

Inputs: name, domain.

get_html_sourceA

Get the full HTML source of the current page.

Inputs: filePath.

get_network_requestB

Gets a network request by its reqid from the listed requests.

Inputs: reqid (required).

get_page_contentA

Get the page title, URL, and visible text content.

Inputs: no named parameters.

get_safe_area_insetsA

Read the current CSS safe-area-inset values (top, right, bottom, left) as seen by the page. These are non-zero on notched iPhones when viewport-fit=cover is set. Also checks whether the page uses env(safe-area-inset-*) in its stylesheets.

Inputs: no named parameters.

get_storageA

Read from localStorage or sessionStorage. Returns all entries or a specific key.

Inputs: key, storageType.

handle_dialogB

If a browser dialog was opened, use this command to handle it.

Inputs: action (required), promptText.

hoverC

Hover over the provided element.

Inputs: uid (required).

inspect_viewport_metaA

Parse the viewport meta tag and validate it against iOS Safari best practices. Reports issues like missing width=device-width, disabled zoom (accessibility violation), missing viewport-fit=cover for safe areas, and other common misconfiguration.

Inputs: no named parameters.

list_console_messagesA

List all console messages for the currently selected page since the last navigation.

Inputs: types, pageIdx, pageSize.

list_network_requestsA

List all network requests for the currently selected page since the last navigation. Includes historical requests made before monitoring started (with limited detail).

Inputs: pageIdx, pageSize, resourceTypes.

list_pagesC

Get a list of pages (tabs) open in Safari.

Inputs: no named parameters.

new_pageA

Open a new tab and load a URL.

Inputs: url (required).

press_keyA

Press a key or key combination. Use this when other input methods like fill() cannot be used.

Inputs: key (required).

reset_device_emulationA

Remove all device emulation overrides and restore the original viewport size, JS-level user agent, device pixel ratio, and touch settings.

Inputs: no named parameters.

resize_pageB

Resizes the selected page's window so that the page has specified dimensions.

Inputs: width (required), height (required).

right_clickB

Right-click (context click) on the provided element.

Inputs: uid (required).

scrollA

Scroll the page in a direction by a given amount of pixels.

Inputs: direction (required), amount.

scroll_to_elementB

Scroll an element into view by its UID from a snapshot.

Inputs: uid (required).

select_optionA

Select an option from a dropdown by value or visible label.

Inputs: uid (required), label, value.

select_pageA

Select a page as context for future tool calls.

Inputs: pageId (required).

set_color_schemeA

Emulate prefers-color-scheme (light/dark mode) in the current page. Overrides CSS @media rules, the color-scheme property, and JavaScript matchMedia() (including change events) so the page behaves as if the OS preference changed. Use "reset" to restore the system default.

Inputs: colorScheme (required).

set_device_emulationA

Emulate an Apple device by resizing the viewport and overriding device pixel ratio and touch support at the JS level. The user agent is overridden via navigator.userAgent (JS-level only — HTTP request headers are not affected). Choose a preset (iPhone SE, iPhone 14, iPhone 15 Pro, iPhone 16 Pro Max, iPad Mini, iPad Air, iPad Pro 11, iPad Pro 13) or provide custom values. Use reset_device_emulation to restore defaults.

Inputs: width, device, height, userAgent, +1 more.

set_storageA

Write a key-value pair to localStorage or sessionStorage.

Inputs: key (required), value (required), storageType.

take_screenshotB

Take a screenshot of the page or element.

Inputs: uid, filePath.

take_snapshotA

Take a text snapshot of the currently selected page based on the DOM/a11y tree. The snapshot lists page elements along with a unique identifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot.

Inputs: verbose, filePath.

type_textB

Type text using keyboard into a previously focused input.

Inputs: text (required), submitKey.

upload_fileA

Upload a file through a provided file input element.

Inputs: uid (required), filePath (required).

wait_forA

Wait for a condition on the page: text content, a CSS selector, or a JS predicate. Returns a snapshot once the condition is met. At least one condition (text, selector, or predicate) must be provided.

Inputs: text, timeout, visible, selector, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 49 tools

    Disambiguation4/5

    Most tools have distinct purposes (e.g., take_screenshot vs take_snapshot), but some overlap exists among input methods like type_text, fill, fill_form, and press_key, which could confuse an agent. Descriptions help differentiate them.

    Naming Consistency5/5

    All tools follow a consistent snake_case verb_noun pattern (e.g., list_console_messages, get_network_request, set_cookie). Even compound names like scroll_to_element maintain the pattern. No mixing of conventions.

    Tool Count2/5

    With 49 tools, the set is far beyond the typical well-scoped range (3-15). While the server attempts to cover many aspects of Safari DevTools, the sheer number makes the surface heavy for an agent to navigate and select effectively.

    Completeness5/5

    The tool set covers a wide range of debugging and automation tasks: page lifecycle, console/network inspection, element interaction, storage, cookies, device emulation, accessibility, PWA auditing, and WebKit compatibility. No obvious gaps for the intended domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers