docs: document the remote-HTTP serve mode, env vars, nginx and Mistral setup
CI / lint (pull_request) Successful in 51s
CI / test (pull_request) Successful in 58s
CI / publish (pull_request) Has been skipped

- 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:
Latte committed 2026-07-04 18:22:09 +02:00
1 parent 44b2dbac0c
commit ceb907b2fe
4 files changed
+156 -4

No files matched your search

+28 -1
View File
@@ -40,6 +40,31 @@ Adding tools is mechanical: **write a new module, import it in `server.py`, and
> text predates the write actions and is historical framing; the real behaviour is read **and**
> guarded write (see [Write Safety](write-safety.md)).
## Transport — stdio (default) and HTTP (opt-in)
The same `mcp` instance is served over one of two transports; the tools and every layer below are
identical either way.
- **stdio (default).** `familiar` with no arguments calls `mcp.run()` — the local transport Claude
Desktop / Claude Code / Cowork launch over the process's stdin/stdout. No network, no auth layer:
the transport is local to the machine and trusted.
- **streamable-HTTP (opt-in).** `familiar serve` calls `server.serve_http()`, which runs the FastMCP
streamable-HTTP transport bound to loopback (`FAMILIAR_HTTP_HOST`/`PORT`/`PATH`, default
`127.0.0.1:8080/mcp`) behind a TLS-terminating reverse proxy. `configure_http()` attaches a FastMCP
`StaticTokenVerifier` built from `FAMILIAR_HTTP_TOKEN`, so a request must present a matching
`Authorization: Bearer <token>` — anything else is a `401` with a `WWW-Authenticate: Bearer` header.
Serving **refuses to start without a token** (a `SystemExit` from `configure_http`), so the endpoint
is never open to the internet unauthenticated.
The EVE-SSO/ESI auth in `auth.py` is unrelated to this transport-level bearer token: the bearer token
gates the *MCP client* (e.g. Mistral) reaching familiar, while `auth.py` gates familiar reaching ESI.
**Write default depends on the transport.** `configure_http()` calls `writes.set_http_context(True)`,
which flips the *default* write policy: over HTTP writes are **disabled** unless `FAMILIAR_ENABLE_WRITES`
is explicitly truthy, because a network-reachable, LLM-driven endpoint should not send mail or set
waypoints by accident. Over stdio the default is unchanged (writes on). This only changes the default
resolution — the `writes.guard` choke point and the per-call `confirm=true` requirement are untouched.
## The tool-module pattern
Every tool module — market, universe, account, industry, trade, structures, killmails, profile, corp,
@@ -91,7 +116,9 @@ when to call it, so docstrings are written for that audience.
**multi-character** encrypted store. Full details in [Authentication](authentication.md). The
short version:
- `interactive_login()` runs the browser flow once per character and persists a bundle.
- `interactive_login()` runs the browser flow once per character and persists a bundle;
`manual_login()` is the headless variant (`familiar login --no-browser`) that prints the authorize
URL and reads the pasted callback URL from stdin — no local browser or callback listener needed.
- The store is a dict of characters keyed by id, in one Fernet-encrypted file; a legacy
single-character file is migrated on load.
- `get_auth(character_id)` returns a valid access token, transparently refreshing via the rotating