fix(install): always run auth-login, drop stale already_authed check#50
Merged
Conversation
The installer was sniffing config files for "agentkey" + an
"AGENTKEY_API_KEY": "ak_..." env-shaped pair to short-circuit MCP
auth. After --auth-login switched to writing a remote-HTTP MCP block
("Authorization": "Bearer ak_...") in #47 / 1.7.0, the check went
stale in both directions:
- users still holding a stdio-shaped config from older releases
matched the regex and were told "AgentKey is already configured
in an MCP client config — skipping auth", but their MCP block no
longer works because the stdio runtime is gone — calling the MCP
tools post-install errors out
- users who had successfully re-authed into the new HTTP shape no
longer matched and got asked to re-auth on every installer run
The simplest fix is to delete the heuristic. `@agentkey/cli
--auth-login` is the source of truth for whether a fresh device-code
round-trip is needed; the installer should hand control to the CLI
instead of guessing from on-disk shape.
Removes:
- already_authed() in install.sh, Test-AlreadyAuthed in install.ps1
- --force-mcp / -ForceMcp flags (no longer meaningful)
- "Re-authenticate even if AgentKey is already configured locally"
documentation in README.md / docs/README_zh.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lxcong
added a commit
that referenced
this pull request
May 15, 2026
🤖 I have created a release *beep* *boop* --- ## [1.7.1](v1.7.0...v1.7.1) (2026-05-15) ### Bug Fixes * **install:** always run auth-login, drop stale already_authed check ([#50](#50)) ([658dfda](658dfda)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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
The installer's "is AgentKey already configured?" heuristic went stale after #47 / v1.7.0 switched
--auth-loginfrom a stdio MCP block to a remote-HTTP one. The check still greps for\"AGENTKEY_API_KEY\": \"ak_...\"(the old env-shaped field) — but the new config writes\"Authorization\": \"Bearer ak_...\"insideheadersinstead.Observed symptom: a user with a residual stdio config from an earlier release sees
…the installer exits successfully, but calling any AgentKey MCP tool errors out because the stdio runtime
@agentkey/mcpis no longer used.The mirror failure also exists: users who have successfully re-authed into the new HTTP shape no longer match the regex and would get re-prompted on every installer run.
Fix
Delete the heuristic.
@agentkey/cli --auth-loginalready knows whether the local token can be reused or a fresh device-code round-trip is needed — let the CLI decide instead of having the installer second-guess from on-disk shape.Removed
Net: -57 / +10 lines across the four files.
Test plan
🤖 Generated with Claude Code