feat(install): auto-detect agents, route MCP auth to QR mode for remote installs#18
Merged
lxcong merged 1 commit intochainbase-labs:mainfrom Apr 27, 2026
Conversation
…te installs
Two end-to-end improvements to install.sh / install.ps1, mirrored across both:
1. Agent auto-detection
Probe well-known config dirs and binaries for ~18 of vercel-labs/skills'
45 supported agents (claude-code, cursor, codex, gemini-cli, opencode,
openclaw, qwen-code, iflow-cli, windsurf, warp, amp, crush, goose, droid,
kode, kilo, kimi-cli, kiro-cli). When detection finds anything, the
`skills add` step gets `-a id1,id2,...` instead of dumping the user into
the multi-select. New flags: --list-agents (preview), --all-agents
(skip our detection, let skills CLI scan everything), --only (manual
override) is unchanged.
2. Local-vs-remote MCP auth routing
The current --auth-login auto-opens a browser. On SSH sessions, Docker
containers, and OpenClaw remote channels (where the user is on a phone),
that silently launches a browser they can't see — leaving them stuck on
"Waiting for authorization...".
Detect the remote context (any signal fires):
- $HOME/.openclaw exists (OpenClaw runtime — confirmed by project owner)
- $SSH_CONNECTION / $SSH_TTY set
- Linux without $DISPLAY / $WAYLAND_DISPLAY
Then pass --no-browser to the MCP CLI, which prints URL + ANSI QR for the
user to scan with a phone (companion server PR adds these flags).
New flags: --remote / --local (force either mode), --force-mcp (re-auth
even if AGENTKEY_API_KEY is already in MCP configs).
Also adds an idempotency short-circuit: if any known MCP config already has
an agentkey block with a valid-looking API key, skip the auth step (with
--force-mcp to override).
Docs: README.md + docs/README_zh.md updated to document the new flags and
add a dedicated "Installing over SSH / Docker / OpenClaw" section.
Companion: chainbase-labs/AgentKey-Server#2 (adds --no-browser / --qr to
@agentkey/mcp). This installer change is forward-compatible — current
@agentkey/mcp will warn and ignore unknown flags; once 0.3.5 lands the QR
flow goes live.
Contributor
|
@claude review |
Contributor
|
🤖 Claude security review requested by @lxcong. Running against HEAD |
|
🤖 Claude security review — HEAD: f53a848 Scope: New agent-detection helpers + remote/QR auth routing in ✅ No security or convention issues found. What was checked:
💡 Suggestions (nice-to-have)
Review triggered by @lxcong |
lxcong
added a commit
that referenced
this pull request
Apr 27, 2026
🤖 I have created a release *beep* *boop* --- ## [1.2.0](v1.1.0...v1.2.0) (2026-04-27) ### Features * **install:** auto-detect agents, route MCP auth to QR mode for remote installs ([#18](#18)) ([29176d1](29176d1)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: lxcong <83766787@qq.com>
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.
Summary
Two end-to-end improvements to
install.sh/install.ps1, mirrored across both:1. Agent auto-detection
Probe well-known config dirs and binaries for ~18 of vercel-labs/skills' 45 supported agents (
claude-code,cursor,codex,gemini-cli,opencode,openclaw,qwen-code,iflow-cli,windsurf,warp,amp,crush,goose,droid,kode,kilo,kimi-cli,kiro-cli).When detection finds anything, the
skills addstep gets-a id1,id2,…instead of dumping the user into the multi-select. New flags:--list-agents— preview what we'd auto-select (and exit)--all-agents— skip our detection, letskillsCLI scan everything--only— manual override (unchanged)2. Local-vs-remote MCP auth routing
The current
--auth-loginalways auto-opens a browser. On SSH sessions, Docker containers, and OpenClaw remote channels (where the user is on a phone), that silently launches a browser they can't see — leaving them stuck on "Waiting for authorization…".Detection (any signal fires ⇒ remote):
$HOME/.openclawexists$SSH_CONNECTION/$SSH_TTY$DISPLAY/$WAYLAND_DISPLAYWhen remote, pass
--no-browserto the MCP CLI, which prints URL + ANSI QR for the user to scan with a phone.New flags:
--remote/--local— force either mode--force-mcp— re-auth even if AgentKey is already configuredAlso adds an idempotency short-circuit: if any known MCP config already has an
agentkeyblock with a valid-looking API key, skip the auth step entirely (--force-mcpto override).3. Docs
README.md+docs/README_zh.mdupdated to document the new flags and add a dedicated "Installing over SSH / Docker / OpenClaw" section.Companion PRs (server side)
The MCP-server changes that this installer routes to ship in a chain of three PRs against
chainbase-labs/AgentKey-Server:--no-browser/--qr/--no-qrflags +qrcode-terminaldep (v0.3.5 source bump)0.3.5had been published from a pre-merge commit and shipped staledist/--no-browser(CJS interop bug —qrcode-terminal'sgeneratelives on.defaultunder NodeNext); bump to 0.3.7This installer needs
@agentkey/mcp@0.3.7to be on npm for the QR flow to actually work. Sequence:cd mcp-server && npm publish(no npm-publish CI workflow) ✅npx -y @agentkey/mcpwill then pull 0.3.7+ and the--remotepath renders the QRThis installer change is forward-compatible: it can land anytime — older
@agentkey/mcpversions silently ignore the unknown--no-browserflag, so worst case a remote user gets the old browser-opens-on-the-wrong-host UX until the new mcp publishes.Test plan
Verified end-to-end on macOS against a local build of
@agentkey/mcp@0.3.7(server PR #4):bash -n install.sh)install.sh --helprenders all 5 new flag rowsinstall.sh --list-agentscorrectly prints detected agents on test host (10 agents incl.openclaw)install.sh --remote --localexits with code 1 (mutex)install.sh --skip-skillshort-circuits with "AgentKey is already configured…" when configs have agentkeyinstall.sh --remote --skip-skill --force-mcpend-to-end: printsDetected remote install context — printing QR + URL instead of opening a browser here, thenreason: $HOME/.openclaw exists (OpenClaw runtime), launches mcp CLI, renders 16-row ANSI QR, polls — noopenprocess spawned--no-browser/--no-browser --no-qr/--qr/ no-flags back-compat)install.ps1not lint-checked locally (no pwsh on test host); logic is a strict mirror of bash — needs Windows smoke before merge~/.openclawtriggers as expectedWhy now
Users running the installer via OpenClaw / Claude Code remote channels (on a phone) currently see a black-hole UX: the browser opens on the wrong machine and the install process appears to hang. The detection here removes the manual
--remoteflag for the common case.🤖 Generated with Claude Code