safari-mcp
README.md
# safari-mcp
<!-- mcp-name: io.github.stefanogarzon/safari-mcp -->
MCP server that lets Claude (or any MCP client) drive your real Safari (logged-in tabs included) via AppleScript.
Tools: `tabs`, `navigate`, `select_tab`, `close_tab`, `read_page`, `click`, `type_text`, `scroll`, `javascript`, `screenshot`.
`read_page` numbers interactive elements; pass the number as `ref` to `click`/`type_text`.
## Setup (once)
1. Safari > Settings > Advanced > "Show features for web developers".
2. Safari > Develop > "Allow JavaScript from Apple Events".
3. System Settings > Privacy & Security > Screen Recording: allow the terminal running Claude Code (for `screenshot`).
4. First call triggers an Automation prompt ("control Safari"): allow.
## Install
macOS only. Needs [uv](https://docs.astral.sh/uv/).
Claude Code plugin (runs the locked uv project shipped in the plugin):
```
/plugin marketplace add stefanogarzon/safari-mcp
/plugin install safari-mcp@safari-mcp
```
Claude Code without the plugin:
```sh
claude mcp add -s user safari -- uvx safari-mcp
```
Other MCP clients (Claude Desktop, Cursor, VS Code):
```json
{ "mcpServers": { "safari": { "command": "uvx", "args": ["safari-mcp"] } } }
```
## Develop
```sh
uv sync
uv run pytest # tests
uv run ruff check . && uv run pyright src
```
## Release
Bump `version` in `pyproject.toml`, `server.json` and `.claude-plugin/plugin.json`, then push a tag `vX.Y.Z`.
The Release workflow tests, publishes to PyPI (trusted publishing) and to the MCP registry.
## Limits
Security: page text goes back to the model, and `javascript` runs arbitrary code in your logged-in tabs. A malicious page can try prompt injection; review actions on sensitive sites.
Clicks and typing are synthetic DOM events (rare sites ignore them). No console/network capture.
For automated tests of our own sites use Playwright WebKit instead.