Files
magpie/internal/mcpauth
yetone 60fde6fb1a library: an MCP server holds several accounts, one in use, switched in place (Elorynth on X)
A remote server can hold several OAuth sign-ins or several sets of
headers (Authorization keys), one in use, which every agent given the
server follows.

- mcpauth: a server's sign-ins are kept with the one in use at m[name]
  and the others in Spare (Use, RemoveAccount, StartAccount); the gateway
  sends the one in use from its next request on.
- library: Server.Accounts and Server.Account; `live` lays the account's
  headers over the server's own in through, remoteHeaders and hubKey, so a
  switch rewrites each agent's file. A save from the editor keeps them,
  and a backup or sync carries no account's key (carry.go). Add, use and
  remove calls, POST /api/library/mcp-account, and mcp-signin takes add
  and label.
- GUI: a server with one set of headers or one sign-in looks as before,
  with a quiet "+ Add account"; with several, a list with the one in use
  marked, a click to switch, an x to remove. Four languages.
- mcp_rename tests compare mcpauth.Record with reflect.DeepEqual now, as
  Spare makes it not comparable (the windows one too).

Run (mote, at this tree): go test ./internal/library ./internal/mcpauth/...
./internal/gui; go vet darwin, linux nogui, windows; mcp-accounts.test.cjs
in chromium and webkit, five languages, plus the existing mcp-* and
library-mcp-* and i18n GUI files. Broken by hand: live() returning the
server unchanged turns TestServerAccountsSwitchEveryAgent red; the use
click removed turns mcp-accounts red.
Not tried: a real OAuth server with two real accounts; an agent's upstream
Mcp-Session-Id is not reset by a switch.
2026-11-12 00:57:23 +08:00
..