Repository navigation
feat(hub): an MCP upstream can be a command the hub starts (stdio, ADR-0069) - #333
Merged
Merged
Conversation
…R-0069) The third part of ADR-0069 (card on #316, point 3): `command`, `env` and `token_var` in `upstreams.toml`. The hub starts the command as the user with a base environment to run at all and only the variables set for it, a token it keeps given in `token_var`; never a command from a repository or the pool. JSON-RPC over stdin and stdout, one process per upstream, started on first use and again after it ended, restarted on a change; its stderr in `upstreams/<name>.log`. The dashboard's form takes a URL or a command. ADR-0069 notes the paths as built. 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
Third and last pull request of ADR-0069 (#316): many MCP servers are a local command (
npx -y …), not a URL.upstreams.toml:command(program and arguments) instead ofurl,env(no secret),token_var(forauth.kind = "token": the variable the kept token is given in). Checked: a URL or a command, not both; no OAuth for a command; a kept token needstoken_var; variable names.crates/devstack-hub/src/stdio.rs: the hub starts the command as the user withenv_clear(), a base environment to run at all (PATH, the home and temp folders, SystemRoot …, listed inBASE) and the variables set for it; JSON-RPC over stdin/stdout, one line per message, answers matched by id, anything else on stdout passed by;initializefirst. One process per upstream, started on first use and again after it ended, stopped on a change or removal; its stderr inupstreams/<name>.log. On Windowsnpxresolves tonpx.cmdthrough PATHEXT (Rust spawns.cmdwith escaped arguments since 1.77.2).upstreams.rs:ask()goes to the command for such an upstream; listing, allowlist, prefix and the kept tool lists as for a URL.lib/commandLine.ts), variables, and the token's variable.Review card
On #316, approved by the owner 2026-10-27. This PR builds point 3: the command is the one the user entered in the dashboard, started as the user with only the environment set for it (secrets from the store), never from a stack file or the pool.
Decided by the agent: the base environment a command gets on top of its own variables (without one no program starts on Windows);
token_varfor a kept token; no OAuth for commands; one process per upstream, kept running; ten minutes for a call, a minute for anything else; stderr to a log per upstream.Tests
stdio.rs: the test binary itself as a stdio MCP server:tools/listandtools/callover its stdio; a variable set for it arrives, one of the hub's own environment does not, PATH does.upstreams.rs: a command upstream with a kept token intoken_var(no token →<name>__login, then the token arrives in the command), the checks (OAuth, missingtoken_var, URL and command), a removal stops the process.commandLine.test.ts; typecheck, vitest (77),build:mock. clippy;cargo test -p devstack-hub. Not tried with a realnpxserver, nor clicked through in a browser.🤖 Generated with Claude Code