# MITM Proxy for Raycast

URL: https://www.raycast.com/triuzzi/mitm-cli

> Toggle a local mitmproxy intercept, browse captured HTTP/HTTPS flows, and install the mitmproxy root CA.

- Install: raycast://extensions/triuzzi/mitm-cli
- Author: [Emanuele Triuzzi](https://www.raycast.com/triuzzi)
- Installs: 1
- Platforms: macOS
- Categories: Developer Tools
- Updated: 2026-12-01
- Source: https://github.com/raycast/extensions/tree/6fcfe9a311f10e8da60dfc9356b707db4b5a4184/extensions/mitm-cli/

## Commands

- **Set up MITM Proxy**: Install mitmproxy and jq with Homebrew
- **Toggle Proxy**: Start or stop mitmproxy and the system proxy
- **Proxy Status**: Process, service, proxy and CA state
- **Recent Flows**: Browse the requests mitmproxy captured

## README

### MITM Proxy

Control a local [mitmproxy](https://mitmproxy.org) intercept from Raycast: turn the
system proxy on and off, inspect the captured HTTP/HTTPS flows, and install the
mitmproxy root certificate.

This is a developer tool for inspecting your own traffic on your own Mac. It runs
`mitmweb` locally and points the macOS system proxy at it; it does not send
anything anywhere else.

#### Requirements

- macOS on an administrator account (changing the system proxy needs admin
  privileges).
- [Homebrew](https://brew.sh), for `mitmproxy` and `jq`.

Run **Set up MITM Proxy** from Raycast and press **Install Dependencies**: it runs
`brew install --cask mitmproxy` and `brew install jq` and shows which piece is
missing. The extension bundles the small `mitm` control script it uses, so
mitmproxy and `jq` are the only things to install.

#### Commands

| Command | What it does |
| --- | --- |
| Set up MITM Proxy | Install mitmproxy and `jq` with Homebrew, and show which dependency is missing |
| Toggle Proxy | Start or stop mitmproxy, the system proxy and the background network follower |
| Proxy Status | Process, network service, proxy/HTTPS state, root CA, UI URL and password |
| Recent Flows | Browse the requests mitmproxy captured, newest first |

Starting the proxy:

1. Starts `mitmweb` detached on port `8080`, with its web UI on port `8081`.
2. Generates its root CA in `~/.mitmproxy` the first time; install that CA once so
   HTTPS can be decrypted (see below).
3. Points the active network service at `127.0.0.1:8080`.
4. Keeps the proxy on whichever network service is carrying traffic, even when you
   switch between Wi-Fi and Ethernet.

The proxy stays on until you toggle it off, even after Raycast or the terminal is
closed.

mitmweb refuses every request without a credential, so the first start generates
a UI password and reuses it on every start after that. It is kept readable only
by you and handed to mitmweb through its own `config.yaml`, so it never shows up
in the process list. Use **Proxy Status → Copy UI Password** to read it.

#### The root certificate

mitmproxy decrypts HTTPS with its own certificate authority, generated in
`~/.mitmproxy` on the first start. macOS only accepts that CA once it is trusted in
the login keychain, and a Raycast extension is not allowed to touch the keychain,
so trusting it is the one step you do yourself:

1. **Proxy Status → Install Root CA…** opens `mitmproxy-ca-cert.p12` in Keychain
   Access.
2. Add it to the **login** keychain.
3. Open the certificate, expand **Trust**, and set **When using this certificate**
   to **Always Trust**.

HTTPS interception works from then on. To remove it again, search for `mitmproxy`
in Keychain Access and delete the certificate.

#### Configuration

Settings are read from `~/.config/mitm/config` when it exists:

```sh
MITM_PORT=8080          # proxy port
MITM_WEB_PORT=8081      # mitmweb UI port
MITM_SERVICE="Wi-Fi"    # pin a network service instead of auto-detecting
MITM_BYPASS="127.0.0.1 localhost *.local"  # replace the bypass list
MITM_INSECURE=1         # skip upstream certificate verification
```

#### Troubleshooting

- **`mitmweb` not found** — run **Set up MITM Proxy → Install Dependencies**.
- **The proxy is on but pages do not load** — another process may hold port
  `8080`. **Proxy Status** shows the listener, or change `MITM_PORT`.
- **HTTPS pages fail while the proxy is on** — the root CA is not trusted yet; see
  [The root certificate](#the-root-certificate).
- **A network service still points at a dead proxy** — toggling the proxy off
  clears every service that points at `127.0.0.1:8080`.
- **HTTPS pages fail after stopping the proxy** — remove the mitmproxy certificate
  from the login keychain in Keychain Access if you no longer need it.
