Repository navigation
feat(mcp): devstack mcp offers the MCP upstreams' tools, called through the hub (ADR-0069) - #332
Merged
Merged
Conversation
…gh the hub (ADR-0069) The second part of ADR-0069 (card on #316, approved 2026-10-27, points 2, 5, 6): - `mcpclient`: a Streamable HTTP client (initialize and session, JSON or event-stream answers, a forgotten session started again). - The hub lists the upstreams' tools as `<prefix>__<tool>` with their allowlist (`GET /hub/upstreams/tools`) and forwards calls with its credential, refreshed once when refused (`POST /hub/upstreams/call`), behind the user token; no route returns a token. An upstream that cannot be asked keeps the tools it listed last (`upstream-tools.json`); one never listed shows `<prefix>__login`. - `devstack mcp` adds them to its own tools and forwards their calls; it starts the hub when upstreams are configured and it does not run, and announces a change (`notifications/tools/list_changed`, looked at once a minute). With `DEVSTACK_NO_HUB` it asks the upstreams without a login or with a token from the environment itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 27, 2026
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
Second of the three pull requests of ADR-0069 (#316): the upstreams configured and logged in by the hub (#329) now reach every coding agent through
devstack mcp.crates/devstack-hub/src/mcpclient.rs: an MCP client over Streamable HTTP:initializeonce per session (Mcp-Session-Id,MCP-Protocol-Version), answers as JSON or as an event stream, a404for a forgotten session starts a new one once,401/403as refused.upstreams.rs:tools()lists every upstream's tools as<prefix>__<tool>with its allowlist, asked at most once a minute; one that cannot be asked keeps the tools it listed last (upstream-tools.json), its description says why; one never listed shows<prefix>__login.call()forwards with the hub's credential, refreshed once when refused, and answers aCallToolResult(withisErrorand the dashboard's page when logged out, not allowed or unreachable).GET /hub/upstreams/tools,POST /hub/upstreams/call(each call in the hub's log, tool name only).devstack mcp(crates/devstack/src/upstream.rs): its own tools plus the upstreams'; a name with__is an upstream's (none of its own has one, tested). It starts the hub when upstreams are configured and the hub does not run; with none configured it neither starts nor asks anything.tools.listChanged, and a look once a minute that sendsnotifications/tools/list_changedwhen the tools changed. WithDEVSTACK_NO_HUBit asks upstreams without a login or with a token from the environment itself (Secrets::nothing).devstackskill (what<prefix>__tools are, and that a login is the user's).Review card
On #316, approved by the owner 2026-10-27, points 1–7. This PR builds points 2 (loopback API behind the user token, no token returned), 5 (
<prefix>__<tool>, a logged-out upstream keeps its tools listed and answers with the dashboard) and 6 (devstack mcpstarts the hub;DEVSTACK_NO_HUB: environment tokens only). The owner chose one user token for every agent over a token per agent (2026-10-27).Decided by the agent: the MCP client written against the protocol (no framework crate;
rmcpis Apache-2.0 only); a tool list taken as current for a minute;upstream-tools.jsonfor the last tool lists;<prefix>__loginfor an upstream never listed; the hub started only whenupstreams.tomlhas an upstream; a look for changes once a minute; ten minutes for a tool call; the descriptions'[<name> via devstack].Tests
upstreams.rs: tools and calls against a fake MCP server wanting a bearer token (one session for all calls, an event-stream answer, the prefix and allowlist, never listed →login, a refused token → kept tools and "log in again");mcpclient.rs: the answer found among events.tests/hub.rs: a real hub, a fake upstream and the realdevstack mcpover stdio:initializeannounceslistChanged,tools/listhasstatusandfk__echobut not the disallowed tool,tools/callreturns the upstream's answer, the disallowed one an error.upstream.rs: devstack's own tool names never look like an upstream's.cargo test -p devstack -p devstack-hub. Not tried against a real MCP upstream, nor withnotifications/tools/list_changedin a real harness.🤖 Generated with Claude Code