axtree-mcp
README.md
# axtree-mcp
<!-- mcp-name: io.github.vishnu-kalaparty/axtree-mcp -->
axtree-mcp is an MCP server that lets an AI agent read and use the apps on your Mac through the accessibility tree, the text description of a window that screen readers use. It asks you before a press that sends, deletes or installs. It refuses to press anything that pays and it never reads or types a password. The model has no way to switch those rules off. Only you can, with `--confirm none`, which turns the questions off and keeps the refusals.
This is an early version. It runs on macOS only. A version tag publishes the package to PyPI and the MCP Registry; until the first one, run it from a clone as shown below.
## What the model sees
A read returns one line for each thing that can be used, with a short name. This is the project's own test window.
<window app="Fixture" title="Fixture" untrusted>
[field e1 Name]
[field e2 Notes]
[secure field] Password (not read; the user types it)
[button e3] Wrap (off)
[slider e4 Quality] 20
[button e5] Format: PDF
[button e6] Send
[button e7] Pay now
</window>
The model acts by name, and the reply holds only what changed.
ax_act {"ref": "e3", "action": "press"}
1. Done: press Wrap.
<window app="Fixture" title="Fixture" untrusted>
~ [button e3] Wrap (on)
</window>
Everything inside the window tag is text from the app. The server marks it untrusted, removes hidden characters and replaces angle brackets, so a page cannot close the tag or pass its text off as the server's.
## What it asks and what it refuses
Pressing "Send" stops and asks you. The server builds the question from the label on screen at that moment, and the model writes none of it.
Press “Send” in Fixture?
Window: Fixture
Asked because the label says “send”.
Nothing happens until you answer. The label is read again after you do, and if it changed while you were deciding, the press is dropped.
Pressing "Pay now" is refused without a question, and the button is ringed on screen so you can find it.
1. Refused: “Pay now” moves money. Payments and trades stay with the user. Tell them where the button is. It is ringed on screen.
| The model wants to | The server |
|---|---|
| Read a window, press an ordinary button, type in a field | Does it |
| Press a control that sends, submits, posts, deletes, installs or agrees | Asks you each time |
| Press a generic button inside a dialog that says one of those words | Asks you |
| Press Return in a message box or a form field, or a shortcut whose menu item sends or deletes | Asks you |
| Press a button in a web page after typing into that page | Asks you, because the press may submit what was typed |
| Paste the clipboard | Asks you, because the model cannot see what is on it |
| Open a web address, or take a picture of a window | Asks you |
| Press pay, buy, sell, transfer or a price | Refuses |
| Read or type a password, card number or one-time code field | Refuses |
| Act inside a terminal, a script tool or a code editor | Refuses unless you start it with `--allow-terminals` |
| Drag or hover | Leaves it to you, and can ring the element with `show` |
No tool takes a "confirmed" argument. If your client cannot show a question, the risky action is refused and the model is told to hand it to you. Labels are compared after normalising them, so a button that spells Send with look-alike Cyrillic letters, accents or invisible characters still counts as Send.
## What a read costs
A read of a small window is tens of tokens where a screenshot is over a thousand, and a reply after one press is about the same size as a line or two. [`evals/tokens/RESULTS.md`](evals/tokens/RESULTS.md) has the table, with both screenshot sizes, the size of the tool list and how each number was obtained. `evals/tokens/measure.py --live` prints a row for the window in front of you.
## Tools
| Tool | Does |
|---|---|
| `ax_read` | Reads one window as text: an outline to act on, the text to answer from, the menu bar, or the selection. `find` searches it, text included. |
| `ax_act` | Acts on an element by name: press, type, focus, set a value, scroll to it, right click, double click, show. Up to 12 steps in one call. |
| `ax_key` | Presses a key or shortcut, in the app you name or the one used last |
| `ax_open` | Opens an app by name or a web address, then reads it. An address whose site has an installed app of that name opens in the app, unless `web` is set. |
| `ax_capture` | A picture of one window, for a canvas or a chart. Asked each time, unless `--confirm none`. |
## Run it
You need macOS, Python 3.11 or newer and [uv](https://docs.astral.sh/uv/).
uv sync
uv run axtree-mcp doctor
Add it to Claude Code with the path to this folder.
claude mcp add axtree -- uv run --project /path/to/axtree-mcp axtree-mcp
macOS gives the Accessibility permission to the app that launches the server, which is your terminal or your desktop client, and `doctor` tells you which app that is. Anything else started from that app shares the permission. Screen Recording is needed only for `ax_capture`.
| Switch | Effect |
|---|---|
| `--read-only` | Only reading, pictures and `ax_show` exist for the model |
| `--confirm risky\|all\|none` | `risky` is the default. `all` asks before every action. `none` never asks, and payments and passwords are still refused. |
| `--apps Notes,Safari` | Only these apps can be read or used |
| `--private NAME` | Adds an app that gives its name and nothing else. Password managers are private by default. |
| `--allow-terminals` | Allows acting in terminals, script tools and code editors |
| `--no-capture` | Removes `ax_capture` |
| `--no-browser-wake` | Never turns on a browser's accessibility mode |
| `--quiet-when-running BUNDLE_ID` | While that app is running, brings your terminal forward for a question only after 20 seconds |
## Browsers
A Chromium browser builds its page tree only when asked. On the first read of such a window the server turns on the browser's accessibility mode, which takes about three seconds once, and puts it back when the server stops. Typing into a page needs the browser in front, so the server brings it forward for that and says so.
## Limits
- A page that labels its pay button "Next" is not caught by a word rule. The rules lower risk and are not a security boundary.
- The word lists are English first, with delete, send and pay words in ten other languages.
- The Accessibility permission belongs to the launching app, so other tools started from the same terminal share it.
- It has been tested on one Mac, against the project's own test window and throwaway Brave and Chrome instances. Safari, Electron apps and a second display are not yet exercised. [`evals/agent/SWEEP.md`](evals/agent/SWEEP.md) runs every action on every common form control in Chrome and checks the page against each reply.
- In a Chromium page, a list (`select`) cannot be set: it takes no written value and its open menu gets no keyboard focus, so the server says so and leaves it to the user. A date field's parts do not take typed digits.
- A model has not yet been run against a set of tasks with it, so there is no success rate to report.
- It is macOS only. The core has no system imports, so another system needs one new backend folder.
## Related work
[Hybrid Computer Use](https://github.com/microsoft/Hybrid-Computer-Use) from Microsoft Research was published on 30 October 2026, partway through this project. It reads the same tree on macOS, Windows and Linux and publishes benchmark results. Its README says to use a dedicated desktop or a disposable VM for untrusted tasks. [xa11y](https://github.com/xa11y/xa11y) is a cross-platform accessibility library. This server is meant for the Mac you are working on, so it asks before risky actions.
## Development
uv run pytest -q
uv run ruff check
uv run pyright
The Mac tests start a small window of their own and never touch another app. `AXTREE_FOCUS_TESTS=1` adds the tests that need that window in front. `AXTREE_BROWSER_TESTS=1` starts a separate Brave or Chrome instance with a throwaway profile. `CONTRIBUTING.md` has the details.
Released under the MIT license.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues