feat(serve): opt-in HTTP transport with bearer auth + headless login

Add a `familiar serve` subcommand that runs the FastMCP streamable-HTTP
transport for use as a remote MCP server (e.g. a Mistral custom connector),
while stdio stays the default and is completely unchanged.

- config: FAMILIAR_HTTP_HOST/PORT/PATH (default 127.0.0.1:8080/mcp) and a
  live http_token() reader for FAMILIAR_HTTP_TOKEN.
- server: configure_http()/serve_http() attach a StaticTokenVerifier so a
  missing/wrong bearer token gets 401 + WWW-Authenticate: Bearer and a valid
  one passes the handshake. Refuses to start (SystemExit) without a token.
- writes: in HTTP mode the write default flips to disabled unless
  FAMILIAR_ENABLE_WRITES is explicitly truthy; guard() logic is untouched.
- auth: manual_login() + parse_callback() power `login --no-browser`, printing
  the SSO URL and reading the pasted callback from stdin (no local browser).
- bump fastmcp pin to >=3.0.0 for the streamable-HTTP + verifier API.
This commit is contained in:
Latte committed 2026-07-04 18:20:59 +02:00
1 parent d65e9be5ff
commit 458e31685f
7 files changed
+160 -7

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ readme = "README.md"
requires-python = ">=3.11"
license = { file = "LICENSE" }
dependencies = [
"fastmcp>=2.3.0",
"fastmcp>=3.0.0", # streamable-HTTP transport + StaticTokenVerifier bearer auth
"httpx>=0.27.0",
"cryptography>=42.0.0",
]