mcp: OAuth for HTTP servers (discovery, DCR, PKCE, refresh, hx mcp login/logout)
This commit is contained in:
1 parent
aa72ab664d
commit
6ae6758836
10 files changed
+621
-23
No files matched your search
@@ -135,10 +135,16 @@ name), in the Claude Code `mcpServers` shape. `${VAR}` and `${VAR:-default}` are
|
||||
}}
|
||||
```
|
||||
|
||||
Transports: stdio and streamable HTTP (static headers; no OAuth). hx extras: `allow` (tool allowlist),
|
||||
Transports: stdio and streamable HTTP (static headers, or OAuth). hx extras: `allow` (tool allowlist),
|
||||
`eager`, `timeoutSecs` (per call, default 60), `disabled`. Output is capped at 30k chars; a crashed stdio
|
||||
server is restarted on the next call (at most 3 times).
|
||||
|
||||
OAuth (HTTP servers without an `Authorization` header): `hx mcp login <name>` discovers the auth server
|
||||
(RFC 9728/8414), registers dynamically (RFC 7591), runs PKCE in the browser (URL printed; redirect on a random
|
||||
localhost port, or paste the redirect URL) and stores tokens in `~/.hx/mcp-auth.json` (0600). Tokens refresh on
|
||||
401. `hx mcp logout <name>` forgets them. Servers without dynamic registration: `"oauth": {"clientId": "…",
|
||||
"clientSecret": "…", "scope": "…", "callbackPort": 8123}`. A server needing login shows `(run hx mcp login …)` in `/mcp`.
|
||||
|
||||
Lazy by default: the system prompt carries one line per tool (`server.tool: description`); the model gets the
|
||||
schema with `mcp_describe` and calls through `mcp_call` (arguments are checked against the cached schema).
|
||||
Servers whose full schemas cost at most ~400 tokens are registered as native tools instead (`server__tool`);
|
||||
|
||||
Reference in new issue
Block a user