> ## Documentation Index
> Fetch the complete documentation index at: https://docs.modusbrain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Perplexity

> Connect ModusBrain to Perplexity AI via MCP.

# Connect ModusBrain to Perplexity Computer

Perplexity Computer connects as a **remote** MCP client, so ModusBrain must be served
over HTTP and reachable at a public HTTPS URL. Perplexity does not run
`modusbrain serve` (stdio) the way Claude Code does — it needs a reachable endpoint:

```
Perplexity Computer
  → ngrok tunnel (https://YOUR-DOMAIN.ngrok.app/mcp)
  → modusbrain serve --http   (built-in OAuth 2.1 transport)
  → Postgres / PGLite
```

## 1. Serve ModusBrain over HTTP (host side)

```bash theme={null}
modusbrain serve --http --port 3131 --bind 0.0.0.0 \
  --public-url https://YOUR-DOMAIN.ngrok.app
```

* **`--bind 0.0.0.0` is required.** Since v0.34, `--http` defaults to
  `127.0.0.1`, so without it the tunnel reaches the server but the connection is
  refused (`ECONNREFUSED`).
* **`--public-url` must match the tunnel.** The OAuth issuer in the discovery
  metadata has to line up with the URL Perplexity actually hits (RFC 8414 §3.3),
  or OAuth client-credentials auth fails.

## 2. Expose it with a tunnel

```bash theme={null}
ngrok http 3131 --url YOUR-DOMAIN.ngrok.app
```

See the [ngrok-tunnel recipe](../../recipes/ngrok-tunnel.md) for a persistent
tunnel.

## 3. Create credentials

Two supported auth paths.

**OAuth 2.1 client credentials (recommended, v0.26.0+).** Perplexity is a cloud
service, so it holds whatever credential you give it. OAuth is the correct choice:
least-privilege scopes + short-lived rotating access tokens instead of a
long-lived full-access secret. Mint a client and print the connector fields in
one step (on the brain host):

```bash theme={null}
modusbrain connect https://YOUR-DOMAIN.ngrok.app/mcp --agent perplexity --oauth --register
```

Or register separately and pass the creds (works anywhere, no DB needed):

```bash theme={null}
modusbrain auth register-client perplexity --grant-types client_credentials --scopes "read write"
modusbrain connect https://YOUR-DOMAIN.ngrok.app/mcp --agent perplexity --oauth \
  --client-id modusbrain_cl_xxx --client-secret modusbrain_cs_xxx
```

`connect --oauth` prints the **Issuer URL + Client ID + Client Secret** to paste
in step 4.

**Legacy bearer token (simplest, best for local/personal):**

```bash theme={null}
modusbrain auth create "perplexity"
modusbrain connect https://YOUR-DOMAIN.ngrok.app/mcp --token modusbrain_xxx --agent perplexity
```

(Perplexity is a GUI connector, so there's no `--install` — `connect` prints the
exact values to paste in step 4.)

## 4. Add the connector in Perplexity

1. Open Perplexity (requires Pro subscription).
2. Go to **Settings → Connectors** (or **MCP Servers**).
3. Add a new remote connector:
   * **URL:** `https://YOUR-DOMAIN.ngrok.app/mcp`
   * **Authentication:** API Key / Bearer Token, or OAuth client credentials
   * Paste the token (bearer) or `client_id` + `client_secret` (OAuth).
4. Save.

## Verify

In a Perplexity conversation, ask it to use your brain:

```
Use my ModusBrain to search for [topic]
```

Have it call `get_brain_identity` (whose brain this is), then `list_skills`
(everything it can do).

## Notes

* Perplexity Computer is available to Pro subscribers; both the Mac app and web
  version support remote MCP connectors.
* The Mac app can also use a local MCP server (`modusbrain serve` stdio) if you'd
  rather not expose an HTTP endpoint.
* A `modusbrain auth create` token is a long-lived, full-access secret. Keep it
  private and prefer a scoped token where possible.
