Files
chainbase-labs__agentkey/docs
lxcong 658dfda00b fix(install): always run auth-login, drop stale already_authed check (#50)
## Summary

The installer's "is AgentKey already configured?" heuristic went stale
after #47 / v1.7.0 switched `--auth-login` from 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_...\"` inside `headers` instead.

**Observed symptom**: a user with a residual stdio config from an
earlier release sees

> ✓ AgentKey is already configured in an MCP client config — skipping
auth.

…the installer exits successfully, but calling any AgentKey MCP tool
errors out because the stdio runtime `@agentkey/mcp` is 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-login` already 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**

- \`already_authed()\` in \`scripts/install.sh\`
- \`Test-AlreadyAuthed\` in \`scripts/install.ps1\`
- \`--force-mcp\` / \`-ForceMcp\` flags (no longer meaningful — auth
always runs unless \`--skip-mcp\`)
- \`--force-mcp\` documentation in README.md / docs/README_zh.md

Net: **-57 / +10 lines** across the four files.

## Test plan

- [ ] On a machine with a stale stdio-shaped \`~/.claude.json\` from a
pre-1.7 install: \`curl -fsSL https://agentkey.app/install.sh | bash\`
now actually re-runs auth-login and the MCP block becomes a working HTTP
entry
- [ ] On a fresh machine: install still completes auth in one
device-code flow (no behavior change)
- [ ] On a machine already on the new HTTP shape: re-running the
installer still works and the CLI either reuses the token or prompts
(CLI's call, not the installer's)
- [ ] \`--skip-mcp\` continues to skip the auth step
- [ ] \`bash -n scripts/install.sh\` passes (verified)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: lxcong <lxcong@chainbase.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 17:19:24 +08:00
..