Retrieved article excerpt
Open article Β· Retrieved 2026-10-12T15:26:24.795730+00:00
# mastroΒ Β·Β connect
**Turn your browser session into a CLI for any web app β so your agent can use it through the app's own API instead of clicking.**
[Side by side: a browser agent clicks, types and screenshots its way through a campsite search, while mastro runs one command and returns structured JSON in 0.26 seconds.](https://raw.githubusercontent.com/mastro-hq/mastro-connect/main/.github/assets/race.gif)
Same task, same clock. The browser agent is an illustration; the mastro command and output are real.
```
npx mastro-connect hackernews top --limit 5 # no install, no login
npx mastro-connect reservecalifornia parks "big sur" # campsite search
npx mastro-connect setup # pick connectors, extension, agent skills
```
[**trymastro.com**](https://trymastro.com) Β· [Give it to your agent](https://github.com/mastro-hq/mastro-connect#give-it-to-your-agent) Β· [Try it](https://github.com/mastro-hq/mastro-connect#try-it) Β· [How it works](https://github.com/mastro-hq/mastro-connect#how-it-works) Β· [Security](https://github.com/mastro-hq/mastro-connect#security--privacy) Β· [Build a connector](https://github.com/mastro-hq/mastro-connect#building-a-connector) Β· [Agent skills](https://github.com/mastro-hq/mastro-connect#agent-skills) Β· [Why a CLI](https://github.com/mastro-hq/mastro-connect#why-a-cli) Β· [Docs](https://github.com/mastro-hq/mastro-connect#documentation)
[License: MIT](https://github.com/mastro-hq/mastro-connect/blob/main/LICENSE)
[npm](https://www.npmjs.com/package/mastro-connect)
[OpenAPI 3.1](https://camo.githubusercontent.com/4957b83202dd76a98b421862b36ed8ec7ece25e27b172832703851c3975cae6b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f737065632d4f70656e415049253230332e312d626c61636b)
---
## The idea
Agents increasingly act on the web for their users, mostly by driving a
browser click by click: slow, brittle, and expensive. But the web app you're
logged into already talks to its own backend through a perfectly good API.
**mastro lets you describe that API once and turn your existing session into
clean, agent-ready commands** β JSON in, JSON out, from your own machine.
1. **Capture** β a small Chrome extension reads the session your browser
already holds. No passwords typed, no scraping.
2. **Store** β only the minimal credential, locally, bound to the sites you
logged in to.
3. **Replay** β each endpoint becomes a `mastro <app> <command>` with flags,
help, and `--json`, sent from your machine or through your own browser tab.
The key design choice: **a connector is data, not code.** It's a standard
**OpenAPI 3.1 document** (plus a few `x-mastro-*` extensions for what OpenAPI
can't express) and a capture manifest. The same rails handle login, flags,
filters, pagination and multi-step flows β and because it's data, **an agent
can write one**: the `mastro-author` skill walks it from "watch me do this in
the browser" to a validated connector.
---
## Give it to your agent
Paste this into Claude Code, Codex, Gemini CLI, Cursor β any agent that runs
shell commands on your machine:
```
Set up mastro for me (https://github.com/mastro-hq/mastro-connect). It turns
web apps I use into CLI commands you can call, using my own browser session.
1. Run `npx -y mastro-connect --version` to check it works (it only needs Node).
2. Install its skills where you load skills from:
`npx -y mastro-connect skills add mastro mastro-author --global` for Claude Code,
or add `--dir <your skills folder>` instead of `--global`. Read them.
3. Run `npx -y mastro-connect hackernews top --limit 5 --json` and summarize it,
so we know it works.
4. Run `npx -y mastro-connect providers available` and ask me which of those
apps I use. Install their skills too (`skills add <id>`).
5. For any that need a login, run `npx -y mastro-connect extension install` and
walk me through loading it in Chrome, then I'll run `mastro login <id>`.
Never type my passwords.
6. Ask me which other apps I wish you could use. For those, offer to build a
connector with the mastro-author skill.
Always use --json, and run --dry-run and ask me before anything that changes
state (posting, buying, booking).
```
And to build a connector for an app that isn't in the catalog yet:
```
Use mastro's mastro-author skill to build a connector for <app> so you can
<what you want to do>. Install it with
`npx -y mastro-connect skills add mastro-author --global` if you don't have it.
Start read-only. I'll do the task once in my browser so you can capture the
requests (or I'll export a HAR for you), and dry-run anything that changes
state before asking me.
```
---
## Try it
All you need is Node 18+. mastro runs on [Bun](https://bun.sh), which npm
installs for you alongside it.
```
npm install -g mastro-connect # or prefix every command with: npx -y mastro-connect
```
Connectors live in the community catalog,
[mastro-hq/connectors](https://github.com/mastro-hq/connectors), and **install
themselves the first time you call one**:
```
mastro hackernews top --limit 5 --json
mastro reservecalifornia parks "pfeiffer" --json
mastro reservecalifornia availability --facility 518 --start 2026-11-06 --end 2026-11-09 --json
mastro hackernews item --id 8863 --dry-run # any command: print the request, send nothing
```
| Connector | What it does | Login |
| --- | --- | --- |
| [`hackernews`](https://github.com/mastro-hq/connectors/tree/main/providers/hackernews) | Front page, items, users (the example, over HN's official API) | β |
| [`reservecalifornia`](https://github.com/mastro-hq/connectors/tree/main/providers/reservecalifornia) | California State Parks campsite search and night-by-night availability; your reservations | optional |
| [`depop`](https://github.com/mastro-hq/connectors/tree/main/providers/depop) | Search listings, your profile, list your own items for sale | yes |
`mastro providers available` shows the current catalog. Prefer a guided start?
**`mastro setup`** lists it, installs what you pick, and offers the browser
extension and agent skills if you need them.
### Connectors that need a login
Load the capture extension once:
```
mastro extension install # copies it to ~/.mastro/extension, opens chrome://extensions
```
Toggle **Developer mode**, click **Load unpacked**, and paste (the path is on
your clipboard). Then, signed in to the app in Chrome:
```
mastro login depop # a localhost tab opens, then the app's; mastro verifies the session
mastro depop search "carhartt jacket" --json
mastro status # what's logged in, and whether it verified
```
### Use it from your agent
Give your agent the skills, then just ask:
```
mastro skills add reservecalifornia --global # into ~/.claude/skills (or --dir for other agents)
```
> *"Is anything open at Julia Pfeiffer Burns next weekend?"*
Any agent that can run shell commands works β Claude Code, Codex, Gemini CLI,
Cursor β as long as it runs on your machine (that's where your session lives).
---
## How it works
```
ββββββββββββ login ββββββββββββββββ manifest ββββββββββββββββββ
β mastro ββββββββββββΆ β Auth Broker ββββββββββββββΆ β Chrome ext β
β CLI β β + Receiver β βββcaptureββ β (MV3, generic)β
ββββββ¬ββββββ ββββββββ¬ββββββββ bundle βββββββββ¬βββββββββ
β β β observes
β <provider> <command> βΌ βΌ
β ββββββββββββββββ ββββββββββββββββββ
ββββββββββββββββββΆ β Mastro SDK β β the web app β
β β’ auth load β β (your session)β
β β’ replay βββββββββββββββββ€ β
β β’ workflows β browser-proxy ββββββββββββββββββ
ββββββββ¬ββββββββ (your own tab)
β reads
ββββββββΌβββββββββ
β providers/<p> β openapi.yaml + auth.manifest.json
βββββββββββββββββ
```
- **The extension** ([`extension/`](https://github.com/mastro-hq/mastro-connect/blob/main/extension)) is generic β no per-app code.
During `mastro login` it follows the connector's manifest to see when you're
signed in, captures only what the manifest names (cookies, headers, storage
keys), and posts it to a loopback receiver. Outside a login, it only runs
proxied requests for sites you've logged in to.
- **The core** ([`@mastro/core`](https://github.com/mastro-hq/mastro-connect/blob/main/packages/core)) runs captures, validates
credentials, and stores them in `~/.mastro/` (mode `0600`).
- **The SDK** ([`@mastro/sdk`](https://github.com/mastro-hq/mastro-connect/blob/main/packages/sdk)) turns an OpenAPI operation plus
your flags into a request, applies the auth binding, resolves human-friendly
filter values, and runs multi-step workflows.
- **The CLI** ([`@mastro/cli`](https://github.com/mastro-hq/mastro-connect/blob/main/packages/cli)) generates each connector's
commands, flags and help straight from its spec.
**Some apps only answer a real browser session.** For those, mastro runs the
request *inside your logged-in tab* β the same way the app's own frontend
calls its API β and relays the response. No headless browser, no challenge
solving. β [`docs/BROWSER-PROXY.md`](https://github.com/mastro-hq/mastro-connect/blob/main/docs/BROWSER-PROXY.md)
**Multi-step flows** (upload each photo β poll β create the listing; fill a
cart β hand it to your browser to pay) are declared in the spec, and
`--dry-run` prints every planned request first. β [`docs/WORKFLOWS.md`](https://github.com/mastro-hq/mastro-connect/blob/main/docs/WORKFLOWS.md)
---
## Security & privacy
mastro holds your sessions, so it's built to keep them yours:
- **Local only.** Credentials are stored on your machine and sent only to the
app itself. There is no mastro server, account, or telemetry.
- **Bound to where you logged in.** A credential records the sites you
consented to at login. mastro refuses to send it β or run anything in your
browser β anywhere else, even if a connector update asks it to.
- **Minimal capture.** The extension captures only what a connector's manifest
names, only during a login you started, and the stored credential is the
minimum needed to replay. Auth headers are redacted in logs and dry runs.
- **A locked-down local bridge.** The loopback proxy only accepts the
extension (web pages and DNS rebinding are refused), and the extension only
acts on sites you logged in to.
- **Connectors are data, validated.** `mastro validate` checks every catalog
connector in CI β including that it never sends your session to a host its
manifest doesn't name, and that it contains no captured secrets.
Details: [`docs/BROWSER-PROXY.md#security-model`](https://github.com/mastro-hq/mastro-connect/blob/main/docs/BROWSER-PROXY.md#security-model).
---
## Building a connector
A connector is a folder β **no code**:
```
providers/<name>/
auth.manifest.json # what the extension captures in the browser
openapi.yaml # the API surface β OpenAPI 3.1 + x-mastro-* extensions
README.md # how it works, endpoints, drift symptoms
skills/<skill>/ # agent playbooks (SKILL.md)
```
**With an agent:** `mastro skills add mastro-author`, then ask it to *"make a
mastro connector for <app>"*. It watches you do the task once in the
browser, finds the minimal auth, writes the manifest and spec, validates, and
tests β read-only first, with anything that changes state behind `--dry-run`
and your confirmation.
**By hand:** watch the app's requests in DevTools β Network, then describe
them. Check your work as you go:
```
mastro validate providers/<name> # sche