cli-anything-safari
What it does
This skill lets an AI agent drive Safari on a Mac, using the browser you already use with your own sign-ins. It is for people who want routine web tasks done automatically.
When to use it
- βWhen you want an agent to open a website and read what is on the page.
- βWhen you need to automate a repeated browsing task in Safari from a script.
- βWhen you want the agent to use a site where you are already logged in.
Skill link
https://github.com/HKUDS/CLI-Anything/blob/main/safari/agent-harness/cli_anything/safari/skills/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βI want the agent to open our company dashboard in Safari and list the three most recent reports.β
5 new skills a week. 1 minute to read.
How it works
The agent sends commands to the safari-mcp server on your Mac, which controls Safari through Apple's automation settings. Each command runs one browser action and returns the result.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
cli-anything-safari
A command-line interface for Safari browser automation on macOS. Wraps the
safari-mcp Node.js MCP
server in a Python Click CLI.
Feature parity is guaranteed. Every Click command is generated
automatically from safari-mcp's tool schema (bundled as
resources/tools.json). All 84 tools are reachable with the exact
argument names and types the MCP server expects.
When to use this CLI
Each CLI invocation spawns a fresh subprocess, so there is per-call
overhead. If your agent speaks MCP natively (Claude Code, Cursor, Cline,
etc.), using safari-mcp directly over MCP stdio will be faster.
Use this CLI when:
- Your agent framework does not speak MCP (Codex CLI, GitHub Copilot CLI, custom scripts, older agent frameworks).
- You need to script browser automation from bash β
cli-anything-safari --json tool snapshot | jq '...'. - You run in CI/CD and want cron-able, subprocess-friendly output.
- You're debugging interactively from Terminal.
Installation
Prerequisites
- macOS β Safari MCP is macOS-only.
- Safari β already installed on macOS.
- Node.js 18+ β
brew install nodeor from https://nodejs.org/ - Python 3.10+
- Enable Apple Events for Safari: Safari β Develop β Allow JavaScript from Apple Events
Install the CLI
cd safari/agent-harness
pip install -e .
The first tool call will download the safari-mcp npm package (one-time, a few MB).
Command Structure
The CLI has 5 top-level commands:
| Command | Purpose |
|---|---|
tool |
Call any of safari-mcp's 84 tools (dynamic, schema-driven) |
tools |
Inspect the bundled tool registry (list, describe, count) |
raw |
Escape hatch β call a tool by full name with raw JSON args |
session |
In-memory session state (last URL, current tab) |
repl |
Interactive REPL (default when no subcommand given) |
Usage Examples
Discover the tool surface
# Count of tools (sanity check β must match safari-mcp's registered tools)
cli-anything-safari tools count
# β 84
# List every tool
cli-anything-safari tools list
cli-anything-safari tools list --filter click # filter by substring
# Full schema for one tool (JSON or human format)
cli-anything-safari tools describe safari_scroll
cli-anything-safari --json tools describe safari_click
Call a tool (schema-driven)
# Navigate
cli-anything-safari tool navigate --url https://example.com
# Take a snapshot (preferred over screenshot β structured text with ref IDs)
cli-anything-safari --json tool snapshot
# Click by ref (refs come from snapshot; they expire on the next snapshot!)
cli-anything-safari tool click --ref 0_5
# Click by selector or visible text
cli-anything-safari tool click --selector "#submit"
cli-anything-safari tool click --text "Log in"
# Fill a field
cli-anything-safari tool fill --selector "#email" --value "user@example.com"
# Scroll by direction/amount (NOT x/y β note the schema!)
cli-anything-safari tool scroll --direction down --amount 500
# Drag one element onto another
cli-anything-safari tool drag \
--source-selector ".card" \
--target-selector ".trash"
# Screenshot β returns base64 JPEG in stdout. Decode with:
cli-anything-safari --json tool screenshot --full-page \
| python3 -c "import sys,json,base64; \
d=json.load(sys.stdin); \
open('/tmp/shot.jpg','wb').write(base64.b64decode(d['data']))"
# Save as PDF (this one writes to disk directly)
cli-anything-safari tool save-pdf --path /tmp/page.pdf
# Evaluate JavaScript (note: parameter is --script, not --code)
cli-anything-safari tool evaluate --script "document.title"
Navigate and read in one round-trip
cli-anything-safari --json tool navigate-and-read --url https://example.com
Form fill (bulk)
safari_fill_form takes an array of {selector, value} objects.
Pass it as a JSON string:
cli-anything-safari tool fill-form --fields '[
{"selector": "#email", "value": "user@example.com"},
{"selector": "#password", "value": "hunter2"}
]'
Run cli-anything-safari tools describe safari_fill_form to see the
exact schema, including any new fields safari-mcp adds upstream.
Net
FAQ
What must be set up first?
You need Node.js 18 or newer, and the Allow JavaScript from Apple Events setting turned on in Safari's Develop menu.
Does it work on Windows?
No. The skill is for macOS only, since Safari and its automation tools run only on Mac.
Will it keep my logins?
Yes. It controls your real Safari, so sites where you are already signed in stay signed in.
Details
Original description by the author
Safari browser automation CLI on macOS via safari-mcp. Controls real Safari (native, keeps logins) by wrapping the safari-mcp MCP server. Every one of the 84 MCP tools is exposed 1:1 with schema-accurate arguments β guaranteed parity, no manual drift.
repo: HKUDS/CLI-Anything
Popularity
- GitHub stars
- 58k
- Ranking position
- #3243
- License
- Apache-2.0
- Updated
- 9/21/2026
Comments
- β¦
More skills from this repository
cli-anything-3mf
58kLets your agent inspect and fix 3D printing files, including finding round holes, resizing them, repairing meshes, and comparing two files.
cli-anything-qgis
58kLets your agent open, edit, and export QGIS map projects from the terminal, including layers, features, print layouts, and processing tools.
cli-anything-adguardhome
58kLets your agent manage AdGuard Home, a network-wide ad blocker, including filters, DNS rewrites, clients, and query logs.
cli-anything-anygen
58kLets your agent generate slides, documents, websites, and diagrams from a written prompt using the AnyGen service.
Similar skills
test-driven-development
311kTeaches your agent to write a failing test first, watch it fail, then write the smallest code that passes, before building any feature or fix.
verification-before-completion
311kTeaches your agent to run real checks and read their output before claiming that a task, fix, or build is complete or passing.
migrate-to-shoehorn
310kReplaces risky type casts in your test files with the shoehorn library, so tests can use partial data and still pass type checks.