Docs · the phone

Your brain,
from your phone.

The brain does not live on your phone and it should not. The Claude app calls it where it lives, at an HTTPS address you publish. The sign-in the app insists on comes from the same binary that holds your memories. Nothing else to install and nothing to sign up for.

Why a connector #

You are away from the keyboard and something about the project comes to mind: a decision, a number, a thing to check tomorrow. Your phone is there and your brain is not. The web UI is no help here, since it answers only on the machine it runs on.

A custom connector fixes that. The brain's MCP server already works over HTTP, so all that is left is to put it somewhere the app can reach and to handle the sign-in the app asks for before it will talk to anything. After that every chat on your phone has the brain's tools: it can read what the project decided last month and save what you just decided, with no session open anywhere and nothing running on the phone.

What the app needs and why a token is not enough #

A remote connector cannot use a token pasted into a config file. That works for stdio and for clients you configure yourself (the MCP page covers it). The Claude app follows the MCP sign-in spec (OAuth): a 401 that says where to find out who can sign you in, discovery documents at well-known URLs, a way to register itself so there is no client id to paste and HTTPS on every address involved. Miss any of these and the app gives no clear error. It just will not connect.

So the sign-in server is built into the binary. One flag turns it on and it is off unless you give that flag:

$ OS_BRAIN_MCP_TOKEN="$TOKEN" os-brain mcp --http 127.0.0.1:7801 \
      --public-url https://laptop.your-tailnet.ts.net \
      --oauth-redirect-host claude.ai
[brain] MCP on http://127.0.0.1:7801/mcp 127.0.0.1:7801 (loopback only) · 58 tools · protocol 2025-06-18
[brain] OAuth for hosted clients at https://laptop.your-tailnet.ts.net: add https://laptop.your-tailnet.ts.net/mcp as a connector and type the token on the login page. /mcp takes only the tokens that login issues, not --token itself

The password on the login page is that token. It is the only secret in the whole setup, so treat it like one: it guards every memory the server can reach and the tools that can change them. With --public-url it works only as a password and /mcp will not accept it as a bearer, so the login page is the only place anyone can try it. Wrong guesses there and at /mcp share one counter per source address: after five, that address waits a minute, then two, doubling up to an hour, while you can still sign in from anywhere else. Every refusal and every success is logged on stderr and the password never appears in the log.

The login page names the site your access is about to be sent to. Any app can register under any name, so that line is the only thing on the page an attacker cannot choose: read it before you type. If it is not the app you are connecting, stop. Better still, do not rely on reading it late at night: --oauth-redirect-host claude.ai lets only redirects to that host register, so a link that would send your login anywhere else is refused before any page appears. Repeat the flag for each app you use.

What the app gets after you sign in is an access token that lasts a day and a refresh token that renews it, rotated each time it is used. Only hashes of them are kept, in mcp-oauth.json beside the shared store (mode 600), so restarting the server does not sign your phone out and a backup of that file holds nothing that works as a token.

The flag comes with refusals, better met here than at the app:

$ os-brain mcp --http 127.0.0.1:7801 --public-url http://laptop.example
--public-url must be an https URL (the authorization endpoints are only allowed over TLS): got "http://laptop.example"
$ os-brain mcp --http 127.0.0.1:7801 --public-url https://laptop.example
--public-url needs --token: it is the password on the login page

A sign-in server over plain HTTP hands your password to anyone on the network path. A login page with no password is a door anyone can open.

Giving it an address #

The server listens only on loopback. Something has to hold a certificate for a public name, terminate HTTPS and pass requests on to that local port. Any reverse proxy with a real certificate works. Tailscale Funnel is the shortest route, because Tailscale holds the certificate for your machine's name on your tailnet and there is no proxy to run and no certificate to renew:

$ tailscale funnel --bg --https=443 7801

You turn Funnel on once for the tailnet, with MagicDNS and HTTPS certificates, in the Tailscale admin console. The certificate for the name is fetched the first time it is used, so the first HTTPS request can hang for a while; wait before you decide something is wrong.

Behind a proxy on loopback every request arrives from 127.0.0.1, so the server takes the source address for its lockout from the last entry in X-Forwarded-For, the one the proxy appended. The public name is added to the allowed Host names automatically from --public-url.

Give the app a URL without a port in it: publish on 443.

Which brain the phone sees #

The server uses the brain of the folder it runs in, or the one OS_BRAIN_HOME names. Run it from a project on the shared store and it serves every project in that store: each call names one with _project. A call that names none is refused with the list of projects it has, so the model can ask again. A project with its own brain.db is not in that store and answers with no memories, which looks like an empty brain but is not.

Where a save goes is decided the same way, so get this right before you rely on it. Run the connector on the machine that holds the brain. Then what you dictate on the phone is in the brain your agent reads tomorrow.

Adding it in the app #

In the Claude app, add a custom connector. The URL is your public name with /mcp on the end, the same endpoint every other client uses; the root serves nothing. Leave client id and secret empty, since the app registers itself. Connecting opens the login page: check the site it names, type the token and allow access. The chat now has the brain's tools, the same list the server gives any other client.

Keeping it running #

Nothing to buy and no account with us. What it does need is a short list: a public HTTPS name in front of the port, something that restarts the process after a reboot (a systemd unit or a launchd job that passes the token in OS_BRAIN_MCP_TOKEN, so it never shows in ps) and a password you treat as a password.

The machine also has to be awake. No engineering gets around that: a phone calling a desktop that is asleep gets nothing. If the brain is on a laptop you close, the phone reaches it only while the laptop is open. A second machine has its own brain, so a connector to it reaches different memories, not a copy.

When it does not work #

What you seeWhat it is
The app says the connector failed and your log is emptyThe request never arrived. Check the URL has no port and ends in /mcp and that the public name resolves and serves HTTPS.
The first HTTPS request hangsThe certificate for the name is still being fetched.
404 on every requestThe endpoint is /mcp. The root serves nothing.
Refuses to start, naming --public-urlEither a plain http URL or no token. Both are refused on purpose.
"redirect_uri is not on this server's --oauth-redirect-host list"The app redirects to a host you did not allow. Add it with another --oauth-redirect-host.
"too many wrong passwords; try again in ..." on the login pageThis address is waiting after wrong guesses. Wait for the time it gives, or sign in from another address.
"this server fronts a shared brain"It is working. Name the project with _project, or set OS_BRAIN_PROJECT in the server's environment.
A project you know has memories answers with noneRight server, wrong store. A server on the shared store cannot see a project that has its own file.

More of these, including the CLI side.