Repository navigation
feat(hub): MCP upstreams, configured once per user and logged in by the hub (ADR-0069) - #329
Merged
Merged
Conversation
…he hub (ADR-0069) The first part of ADR-0069 (card on #316, approved 2026-10-27, points 1, 4, 7): `upstreams.toml` per user in the hub's state directory, no secret in it; the hub's own OAuth login (RFC 9728 and RFC 8414 discovery, RFC 7591 registration where offered, PKCE S256, RFC 8707 resource, a one-time `state` for ten minutes, the browser back at `/oauth/upstream/callback` on the hub's port); a static token the user gives the hub; credentials in the keychain store of #325; refresh before expiry with rotation. The dashboard's page *MCP upstreams* (sidebar) adds, changes, logs in and out, and removes them. No route returns a secret. Their tools in `devstack mcp` follow. The OAuth flow is written against `ureq` rather than the `oauth2` crate (another HTTP client); `base64` added for PKCE, `sha2` was there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 27, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
First of the three pull requests of ADR-0069 (#316): where a user's MCP upstreams are configured and how the hub logs in to them. Their tools in
devstack mcp(the loopback API) and stdio upstreams follow.crates/devstack-hub/src/upstreams.rs:upstreams.tomlper user in the hub's state directory (name, URL, prefix, tool allowlist, auth kind; no secret).resource(RFC 8707). A callback is taken only by the one-timestateof a flow the hub started, within ten minutes.bearer()refreshes before expiry and once on request, keeping a rotated refresh token (used by the next PR).GET/POST /hub/upstreams,DELETE /hub/upstreams/{name},POST .../login|token|logout(session + Origin as every/hub/mutation),GET /oauth/upstream/callback(outside/hub/: the authorization server's redirect carries no session; thestateadmits it, Host is still checked). No route returns a secret.Review card
On #316, approved by the owner 2026-10-27, points 1–7. This PR builds points 1 (OAuth by the hub, one-time
state, keychain), 4 (upstreams.toml) and 7 (the dashboard's MCP upstreams, per user).Decided by the agent: the flow written against
ureqinstead of theoauth2crate listed on the card (it needs another HTTP client);base64added (sha2was a dependency already); the callback path/oauth/upstream/callbackand its plain HTML page; ten minutes for a flow; refresh 60 s before expiry; a new URL or auth kind forgets the stored credential; the dashboard as its own page beside Pool, since the hub has no settings page.Tests
upstreams.rs: the full OAuth flow against a fake upstream and authorization server (discovery, registration, PKCE,resource, one-timestate, refresh with rotation), the configuration keeping no secret, the checks, the PKCE challenge against an independently computed value.tests/hub.rs: the routes need a session and Origin, plain http beyond loopback is refused, a callback for no flow of this hub changes nothing and works without a session.cargo test -p devstack-hub(80) and the hub tests; dashboard typecheck, vitest,build:mock. Not tried against a real upstream's authorization server, and the page not clicked through in a browser.🤖 Generated with Claude Code