Skip to content

feat(hub): an MCP upstream can be a command the hub starts (stdio, ADR-0069) - #333

Merged
7schmiede merged 1 commit into
mainfrom
feat/mcp-upstream-stdio
Oct 27, 2026
Merged

7schmiede merged 1 commit into
mainfrom
feat/mcp-upstream-stdio

Conversation

@7schmiede

Copy link
Copy Markdown
Member

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 of url, env (no secret), token_var (for auth.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 needs token_var; variable names.
  • crates/devstack-hub/src/stdio.rs: the hub starts the command as the user with env_clear(), a base environment to run at all (PATH, the home and temp folders, SystemRoot …, listed in BASE) 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; initialize first. One process per upstream, started on first use and again after it ended, stopped on a change or removal; its stderr in upstreams/<name>.log. On Windows npx resolves to npx.cmd through PATHEXT (Rust spawns .cmd with 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.
  • Dashboard: the form takes "at a URL" or "as a command the hub starts", the command line (quoted words kept together, lib/commandLine.ts), variables, and the token's variable.
  • ADR-0069 notes the paths as built for all of it; CHANGELOG, dashboard-api.md.

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_var for 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/list and tools/call over 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 in token_var (no token → <name>__login, then the token arrives in the command), the checks (OAuth, missing token_var, URL and command), a removal stops the process.
  • Dashboard: commandLine.test.ts; typecheck, vitest (77), build:mock. clippy; cargo test -p devstack-hub. Not tried with a real npx server, nor clicked through in a browser.

🤖 Generated with Claude Code

…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>
@7schmiede
7schmiede merged commit 815b5fe into main Oct 27, 2026
13 checks passed
@7schmiede
7schmiede deleted the feat/mcp-upstream-stdio branch October 27, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant