Repository navigation
fix(app): offer Claude Code and Codex setup commands next to the CLI installer - #3708
jordan-simonovski wants to merge 3 commits into
Conversation
…installer The commands read the access key from a hidden prompt, so it stays out of shell history and agent chats. Codex also gets a note that it needs the variable set wherever it runs. Refs HDX-6080
🦋 Changeset detectedLatest commit: b8ae566 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
|
|
||
| function buildClaudeCommand(deployment: DeploymentShape): string { | ||
| return `${READ_KEY} && claude mcp add --scope user --transport http ${SERVER_NAME} ${buildUrl(deployment)} --header "Authorization: Bearer $${ACCESS_KEY_ENV_VAR}"`; | ||
| } |
There was a problem hiding this comment.
🔴 P1 — The Claude Code command fails when a clickstack entry already exists, such as after running the CLI installer or when changing the key
claude mcp add will not overwrite an existing server; the CLI removes the entry first for this reason (packages/cli/src/mcp/install.ts:341-347, and the comment at install.ts:8 says a reinstall should replace a hand-added entry). Remove the old entry inside the same && line, e.g. read -rs K && { claude mcp remove --scope user clickstack >/dev/null 2>&1; claude mcp add ...; }.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| label={SHELL_COMMAND_LABEL} | ||
| snippet={snippets.codexCli} | ||
| /> | ||
| <Text size="xs" c="dimmed"> |
There was a problem hiding this comment.
🟡 P2 — The Codex note tells users to set the variable in their shell profile but gives no way to do it
After the command runs, the key exists only in the current shell, so Codex breaks in every new terminal. Users get no snippet for the profile step and will likely paste the key as plain text into .zshrc. Either give a copyable profile line that reads the key from a secret store or file, or point Codex users to the CLI installer, which writes http_headers into a 0600 ~/.codex/config.toml (packages/cli/src/mcp/install.ts:254-276).
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
PR Review
5 finding(s): 🔴 0 P0/P1 · 🟡 4 P2 · 🔵 1 P3 4 posted as inline comment(s) on the changed lines. 1 P3 folded at the bottom. 🔵 1 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
Deep ReviewThe diff re-adds Claude Code and Codex CLI tabs to the MCP install panel. The snippet builders are pure and well-tested, the ✅ No critical issues found. 🟡 P2 — recommended
🔵 P3 nitpicks (2)
Reviewers (10): correctness, security, adversarial, kieran-typescript, testing, maintainability, project-standards, agent-native, learnings-researcher, previous-comments. Testing gaps:
Note (intentional tradeoff, not graded): once pasted and run, the Claude No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 474 passed • 1 skipped • 1008s
Tests ran across 4 shards in parallel. |
The PM is fine with the access key appearing in the command, so this drops the read -rs prompt and goes back to the pre-#3622 snippets.
| function buildClaudeOneLiner(deployment: DeploymentShape): string { | ||
| const url = buildUrl(deployment); | ||
| const headers = buildHeaders(deployment); | ||
| return `claude mcp add ${SERVER_NAME} --transport http ${url} ${headerArgs(headers)}`; |
There was a problem hiding this comment.
🟡 P2 — Claude Code command puts the raw access key in the command line, so it ends up in shell history
The copied command contains --header "Authorization: Bearer <real key>". Running it saves the key to shell history. That is the reason #3622 removed this tab, and it goes against the PR description, which says the commands begin with read -rs CLICKSTACK_ACCESS_KEY. Emit read -rs CLICKSTACK_ACCESS_KEY && claude mcp add ... --header "Authorization: Bearer $CLICKSTACK_ACCESS_KEY" as MCP.md:56-63 documents, and don't put the key in the snippet at all.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
This has come up in discussion and has been deemed ok
| function buildCodexOneLiner(deployment: DeploymentShape): string { | ||
| const url = buildUrl(deployment); | ||
| const token = deployment.accessKey || '<accessKey>'; | ||
| const exportLine = `export ${CODEX_TOKEN_ENV_VAR}=${shellQuoteValue(token)}`; |
There was a problem hiding this comment.
🟡 P2 — Codex snippet writes export CLICKSTACK_ACCESS_KEY="<real key>", which also lands in shell history
Using --bearer-token-env-var keeps the key out of codex mcp add. The export line on the line before it still puts the literal key into history, and its doc comment calls that line "self-contained". Use read -rs CLICKSTACK_ACCESS_KEY && export CLICKSTACK_ACCESS_KEY && codex mcp add ... on one && line, as in MCP.md:71 and the PR description. Pasting it as two lines lets read swallow the next line in shells without bracketed paste.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| function buildClaudeOneLiner(deployment: DeploymentShape): string { | ||
| const url = buildUrl(deployment); | ||
| const headers = buildHeaders(deployment); | ||
| return `claude mcp add ${SERVER_NAME} --transport http ${url} ${headerArgs(headers)}`; |
There was a problem hiding this comment.
🟡 P2 — Claude Code command omits --scope user, so the server is added only for the current directory
Without --scope, claude mcp add uses local scope, which applies only to the directory the user ran it in. MCP.md:61 and the CLI installer (packages/cli/src/mcp/install.ts:343-351) both use --scope user. Add --scope user so the UI, the docs and the CLI agree.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| * `\`, or backtick would otherwise turn a copy-paste install into a | ||
| * shell-injection vector. | ||
| */ | ||
| function shellEscape(value: string): string { |
There was a problem hiding this comment.
🟡 P2 — shellEscape and its quoting helpers exist only to inline the key into shell commands
Once the snippets read the key with read -rs and reference $CLICKSTACK_ACCESS_KEY, no secret is interpolated into shell text. At that point shellEscape, shellQuoteValue, shellQuoteHeader and headerArgs can be deleted, along with their escape tests.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Brings back the Claude Code and Codex CLI tabs in the MCP setup panel, next to
npx @hyperdx/cli mcp install, so connecting an agent doesn't require installing our CLI. #3622 removed them.CLICKSTACK_ACCESS_KEYeach time it starts, so it needs to be set in your shell profile, not only in the shell where you ran the command.Screenshots or video
How to reproduce
Starting point:
yarn dev(both sections need the API), register any account.On
main:On this branch:
claude mcp add clickstack ...with the key masked.exportandcodex mcp addlines plus the shell profile note.How to test on Vercel preview
N/A: local mode has no signed-in user, so the MCP panel and organisation keys section don't render.
References