Skip to content

Guide · Agent skill

How to use the cli-anything-safari Safari automation skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

cli-anything-safari is an agent skill that teaches an AI agent to control the Safari browser on a Mac through a command-line tool. It wraps the safari-mcp server, so the agent can open pages, click, fill forms, take snapshots and screenshots, read cookies and storage, capture network activity and save pages as PDF. This guide explains what the skill does, how to install it, how to ask for things that trigger it, and what to watch for on safety.

Safari Browser Automation CLIHKUDS/CLI-Anything · Apache-2.0

Quick start

  1. 1Check macOS and Safari. Confirm you are on a Mac with Safari installed. The skill does not run on Windows or Linux.
  2. 2Install Node.js and Python. Install Node.js 18 or newer and Python 3.10 or newer. The source suggests brew install node or the download from nodejs.org.
  3. 3Enable Apple Events for JavaScript. In Safari, open the Develop menu and choose Allow JavaScript from Apple Events.
  4. 4Add the skill. Download the ZIP from this page and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder, or upload it under Settings → Capabilities → Skills in the Claude apps.
  5. 5Install the CLI. Change into safari/agent-harness and run pip install -e . The first tool call downloads the safari-mcp npm package.
  6. 6Test with a simple command. Run cli-anything-safari tools count, which the source says should return 84, then try a navigate and snapshot.
  7. 7Ask the agent in plain language. Describe the browser task you want, and let the agent choose the CLI commands. Review any action that touches logins or forms.

What does the cli-anything-safari skill let an agent do?

An agent skill is a folder of instructions and tools that an AI agent can load when a task matches it. This skill's SKILL.md describes a Python Click command-line interface for Safari browser automation on macOS. The CLI wraps the safari-mcp Node.js MCP server, and the source states that all 84 of its tools are exposed through the CLI with the argument names and types the MCP server expects.

Because the skill drives the real Safari app, it can keep existing logins, according to the listing. The CLI has five top-level commands: tool, tools, raw, session and repl.

  • tool: call any of safari-mcp's 84 tools
  • tools: inspect the bundled tool registry (list, describe, count)
  • raw: call a tool by full name with raw JSON arguments
  • session: show in-memory session state such as the last URL
  • repl: an interactive prompt, the default when no subcommand is given

How do you install the cli-anything-safari skill?

There are two parts: adding the skill so your agent can find it, and installing the Python CLI it calls. For the skill itself, download the ZIP from this page. You can unzip it into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder to share it with one codebase. In the Claude apps, you can instead upload the ZIP under Settings → Capabilities → Skills.

For the CLI, the source says to change into the agent-harness folder inside the safari directory and run an editable install. The first tool call then downloads the safari-mcp npm package, which the source describes as a one-time download of a few MB. Check the prerequisites in the next section before you start.

cd safari/agent-harness pip install -e .

What do you need before installing?

The skill only works on macOS, because safari-mcp is macOS-only. Safari must be installed, which it is on a standard Mac. You also need Node.js 18 or newer, Python 3.10 or newer, and one Safari setting that the source calls out explicitly.

  • macOS (required)
  • Safari, already installed on macOS
  • Node.js 18+ (for example via brew install node, or from nodejs.org)
  • Python 3.10+
  • In Safari, enable Develop → Allow JavaScript from Apple Events

How do you trigger the skill with natural requests?

You do not run the CLI yourself when the skill is active. You ask the agent in plain language for a browser task that matches the skill's description, such as opening a page, filling a form or reading the contents of a site. The agent then chooses the matching CLI commands. The skill description focuses on Safari automation on macOS, so requests that name Safari or a browser task on your Mac are the clearest triggers.

If you want to see what the agent can call, you can run the discovery commands yourself. They confirm the tool count and show each tool's arguments.

  • Open example.com in Safari and tell me the main headings on the page
  • Log into the site in my Safari window and take a screenshot of the dashboard
  • Save the pricing page as a PDF in /tmp
cli-anything-safari tools count cli-anything-safari tools describe safari_click

What are the most useful commands and examples?

The source recommends taking a snapshot before clicking, since snapshots return structured text with ref IDs. Refs come from the snapshot and expire on the next snapshot, so take a fresh one before using a ref. You can also click by CSS selector or by visible text. Scroll uses direction and amount rather than x and y coordinates.

For screenshots, the tool returns base64 JPEG data in the JSON response, so you decode it yourself. Save-pdf writes to disk directly. Evaluate takes --script, not --code.

  • Use --json for output an agent or script can parse
  • Use tools describe <name> before file-handling tools, since their path argument names differ
  • export-storage prints JSON to stdout, so redirect it to a file
  • fill-form takes an array of selector and value objects as a JSON string
cli-anything-safari --json tool snapshot cli-anything-safari tool click --ref 0_5 cli-anything-safari tool fill --selector "#email" --value "user@example.com" cli-anything-safari tool save-pdf --path /tmp/page.pdf cli-anything-safari tool evaluate --script "document.title"

What safety issues should you know about?

The skill runs scripts and uses the network, according to the listing. The tool can read cookies and storage and can fill passwords into forms, so only use it on sites and accounts you control. Because it uses your real Safari app, a session may already be logged in, which makes careless automation more consequential.

Each CLI call starts a new subprocess and exits, and the CLI keeps no persistent session. Check return codes, since non-zero values signal URL validation failures, MCP call failures or invalid JSON arguments.

  • Only automate accounts you own or are authorised to use
  • Be careful with commands that read cookies, storage or fill credentials
  • The first call downloads the safari-mcp npm package from the network
  • Parse stderr for errors and stdout for data

What tips help when things go wrong?

Most setup problems come from the Safari setting or from skipping the prerequisites. If a tool call fails, confirm you are on macOS, that Node.js and Python meet the minimum versions, and that Allow JavaScript from Apple Events is enabled. For agents that already speak MCP natively, the source suggests using safari-mcp directly, because each CLI call adds per-call overhead.

  • Use snapshot before click, and re-snapshot when refs stop working
  • Run tools describe before guessing argument names
  • Use --json for anything an agent will parse
  • Choose direct MCP use if your agent is MCP-native and speed matters

What people use it for

  • Letting an agent that cannot speak MCP run Safari actions through a bash-callable tool
  • Scripting repeatable Safari checks from Terminal or a cron job on a Mac
  • Piping snapshot output into jq for structured processing
  • Saving pages as PDF or capturing screenshots for records
  • Inspecting network activity and performance metrics while debugging a site

Frequently asked questions

Is cli-anything-safari free to use?

The skill is listed under the Apache-2.0 licence. Check the licence file in the source repository for the full terms. The safari-mcp npm package is an external dependency that the first tool call downloads.

How do I install the cli-anything-safari skill?

Download the ZIP from this page and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder. In the Claude apps you can upload it under Settings → Capabilities → Skills. To install the CLI, run pip install -e . inside safari/agent-harness.

Does cli-anything-safari work on Windows or Linux?

No. The underlying safari-mcp server is macOS-only, and the skill requires macOS and Safari.

What do I need to run cli-anything-safari?

You need macOS, Safari, Node.js 18 or newer, Python 3.10 or newer, and the Allow JavaScript from Apple Events setting enabled in Safari's Develop menu. The safari-mcp npm package is downloaded on first use.

Is there a better alternative for Claude Code users?

The source recommends using safari-mcp directly over MCP for agents that speak MCP natively, such as Claude Code, Cursor and Cline, because each CLI call spawns a new subprocess and is slower. Use this CLI when your agent cannot speak MCP or when you need bash scripting.

Can it log into websites for me?

It can use your real Safari app, which can keep existing logins, and it can fill fields such as email and password. Because it can also read cookies and storage, only use it with accounts you control.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Choose this skill if you are on a Mac and your agent cannot speak MCP, or you want to script Safari from Terminal or CI. Pick safari-mcp directly if your agent already uses MCP, since it avoids the per-call overhead, or a different tool if you are on Windows or Linux.

Download the skill