docs: document the remote-HTTP serve mode, env vars, nginx and Mistral setup
- README + getting-started: a "Serve over HTTPS (remote MCP)" section with the `familiar serve` command, the FAMILIAR_HTTP_* env vars, the write-off-by- default note, an nginx location block (proxy_buffering off, long read timeout), the headless-login / copy-the-store options, and the steps to add it as a Mistral custom connector. - architecture: describe the stdio/HTTP transport split, the bearer-auth gate, and the HTTP write default. - CLAUDE.md: add the new commands and env vars to Commands + Architecture.
This commit is contained in:
4 files changed
+156
-4
No files matched your search
+66
-1
@@ -99,7 +99,72 @@ uv run familiar writes # show current state
|
||||
|
||||
Full details in [Write Safety](write-safety.md).
|
||||
|
||||
## 7. Verify everything works
|
||||
## 7. Serve over HTTPS (remote MCP)
|
||||
|
||||
Everything above uses **stdio** — the local transport an MCP client launches on your machine.
|
||||
To reach familiar from a **remote** MCP client (for example a [chat.mistral.ai](https://chat.mistral.ai)
|
||||
custom connector), run the opt-in **streamable-HTTP** transport instead. stdio stays the default;
|
||||
nothing here changes how `uv run familiar` behaves with no arguments.
|
||||
|
||||
```bash
|
||||
FAMILIAR_HTTP_TOKEN=$(openssl rand -hex 32) uv run familiar serve
|
||||
```
|
||||
|
||||
`familiar serve` binds `127.0.0.1:8080/mcp` behind a TLS-terminating reverse proxy. It **refuses to
|
||||
start without `FAMILIAR_HTTP_TOKEN`** — an internet-reachable account window must never run
|
||||
unauthenticated. A request without a valid `Authorization: Bearer <token>` gets `401` with a
|
||||
`WWW-Authenticate: Bearer` header; a valid token lets the MCP handshake through.
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| --- | --- | --- |
|
||||
| `FAMILIAR_HTTP_TOKEN` | *(required)* | Bearer token the client must send; serve refuses to start without it. |
|
||||
| `FAMILIAR_HTTP_HOST` | `127.0.0.1` | Bind address. Leave loopback; let the proxy face the internet. |
|
||||
| `FAMILIAR_HTTP_PORT` | `8080` | Bind port. |
|
||||
| `FAMILIAR_HTTP_PATH` | `/mcp` | MCP endpoint path. |
|
||||
| `FAMILIAR_ENABLE_WRITES` | *(unset)* | In HTTP mode writes default **off**; set to `1`/`true` to opt in. |
|
||||
|
||||
> **Writes default off over HTTP.** A network-reachable, LLM-driven endpoint should not send mail or
|
||||
> set waypoints unless you opt in explicitly with `FAMILIAR_ENABLE_WRITES=1`. (Over stdio they stay on
|
||||
> by default, as in section 6.)
|
||||
|
||||
### nginx location block
|
||||
|
||||
Streamable HTTP holds a long-lived response open, so turn off buffering and raise the read timeout:
|
||||
|
||||
```nginx
|
||||
location /mcp {
|
||||
proxy_pass http://127.0.0.1:8080/mcp;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_buffering off; # stream events straight through
|
||||
proxy_read_timeout 3600s; # don't cut long-lived MCP sessions
|
||||
}
|
||||
```
|
||||
|
||||
### Logging in on a headless server
|
||||
|
||||
`familiar login` needs a local browser and the `localhost:8765` callback. On a headless box:
|
||||
|
||||
- **Headless login** — print the SSO URL, authorize in any browser, paste the redirected URL back:
|
||||
|
||||
```bash
|
||||
uv run familiar login --no-browser
|
||||
```
|
||||
|
||||
The `localhost` page the browser lands on fails to load — that's expected; copy its address bar
|
||||
(it holds the `code`) and paste it at the prompt.
|
||||
- **Copy the store** — run `familiar login` on your desktop, then copy the encrypted store
|
||||
(`token.enc` + `key` from your `FAMILIAR_DATA_DIR`) to the server's data dir.
|
||||
|
||||
### Add it in Mistral
|
||||
|
||||
In [chat.mistral.ai](https://chat.mistral.ai): **Intelligence → Connectors → Add custom connector**,
|
||||
set the URL to `https://your-host/mcp`, choose **Bearer Token** auth, and paste your
|
||||
`FAMILIAR_HTTP_TOKEN`.
|
||||
|
||||
## 8. Verify everything works
|
||||
|
||||
```bash
|
||||
uv run pytest # full test suite (fails under 80% coverage)
|
||||
|
||||
Reference in new issue
Block a user