chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.5.0 Latest 5 packages
Sign-in asks for what HUD's views do, never transition:generic
MergedThis pull replaces transition:generic with a scope built from the bundled views. It asks for repo: for each collection a view writes plus themes, blob: for the composer's image types, rpc?lxm=*&aud=<service> for each service a view names, and the two aud=* methods. HUD now enforces that scope too. Writes of any other collection are refused before the PDS is asked, and queries to an unlisted service go as no one. Each session records what it asked for, so behind can send an MCP host the 401 challenge and show the page and iOS app a "Sign in again" bar.
I read every file in the diff. What I checked:
- Every path that calls the PDS as the account is covered by a permission:
pds_callandpds_sendcallers: createRecord, applyWrites, deleteRecord, uploadBlob, getPreferences, getFeedGenerators and getFeedGenerator throughAPPVIEW, sendInteractions,space.rs, procedures andcall_query.- Procedures name their
serviceexplicitly, sobundled_servicespicks them up.
- No
rpcpermission pairslxm=*withaud=*. - Sessions stored before this change fall back to their granted scope as
asked, and there is a test for it. ?handle=is validated as a handle or DID before it fills the form, and the test covers an injection attempt..notice:not(:empty)holds, because Svelte's comment anchors don't count against:empty.
At this review, lexicons, docs and check passed; web, test, e2e and e2e-spaces were still running.
One non-blocking note: on the workspace's methods, any Refusal::SignIn from a session that is behind now becomes the "sign in again" message, not a 401. That includes a refresh token that has really died. Right after deploy every session is behind, so expired sessions will show the bar instead of being signed out. Signing in from the bar recovers either way.
crates/hud-server/src/xrpc.rslines 764 to 766
Some(Err(Refusal::SignIn)) if hud.behind(&caller.account).await => { | |
Err(hud_core::oauth::SIGN_IN_AGAIN.to_string()) | |
} |
Not blocking: pds_send also returns Refusal::SignIn when the refresh token is dead or revoked. Once this deploys, every session is behind, so a session that has really expired gets this message, not the 401 that signs the page out. The bar recovers it, but you could match only the ScopeMissingError case, for example with a dedicated refusal from scope_refused, so a dead session still gets the 401.
HUD's sign-in stops asking for
transition:generic. It now asks each account's server only for what the bundled views do: their collections, their services, a composer's images. A sign-in made before shows a bar to sign in again, and an MCP host is asked to sign in again the first time its PDS refuses a call.Claude Opus 5.5 · high
What changes
The scope (
hud_core::scope, built when the server starts):repo:for each collection a bundled view writes (anAction'screate, aCompose'swrites), plusplace.hud.theme.blob:for the composer's image types.rpc?lxm=*&aud=<service>for each service a view names: Bluesky's AppView and chat, knotless's and Grain's AppViews.rpc:app.bsky.actor.getPreferences?aud=*. The PDS answers it itself, against whichever AppView it's configured with.rpc:app.bsky.feed.sendInteractions?aud=*.SPACE_SCOPEwithHUD_SPACES=on, unchanged.HUD_OAUTH_SCOPEis gone: the server refuses to start with it set. A view'sscopefield is gone too, with its gating: chat needs no setting now.Outside the grant: a query to any other service goes as no one, signed in or not (
xrpc::call_query). A write of any other collection is refused before the PDS is asked (create_record,apply_writes,delete_record).create_record's description lists the collections.Sign in again:
transition:genericones count as behind.ScopeMissingErrorfor a session that's behind, an MCP host gets the 401 challenge. The workspace's methods answer an error that says to sign in again, so the iOS app isn't signed out.getWorkspacegainssignInAgain. The page and the iOS app show a bar with "Sign in again"./workspace/signin?handle=fills in the handle.Docs:
sign-in.mdgains "What HUD asks for" and "Signing in again".tools.md,running.md,internals.md,overview.mdandworkspace-api.mdfollow.Why
transition:genericis the whole account, close to what an app password grants. HUD's reads and writes are known from its views, so the permissions follow from them: knotless builds its scope from its constants, and this builds HUD's from the views.Two other ways were considered.
repo:*with no per-service rpc would keepcreate_recordopen to any collection, which is the whole account again. Per-methodrpcwould cut thequerytool down to the bundled views' methods. Each service a view names takeslxm=*instead, since the spec forbids onlylxm=*withaud=*.How it was checked
just checkpasses on the merge with main: fmt, clippy, tests, svelte-check, lint and lex.behind;SignIn;?handle=.just e2eagainst the reference PDS signed in with the new scope. Two flows failed in the full run because a tile from an earlier spec was already on the canvas. Both passed run alone (11/11).just lookpictures of the bar (desktop light, phone dark) and of the page without it. An agent that didn't draw them critiqued them, and its padding and spacing fixes are in.just ios-testwasn't run.Shortcomings
invalid_scope. HUD doesn't retry with less.Review
Start at
crates/hud-core/src/scope.rs, thenHud::scope_refusedinoauth/mod.rsand its callers.