Skip to content

feat(login): auto-link legacy API key when ETERNA_MCP_KEY is set#1

Merged
matmilbury merged 1 commit intomainfrom
feature/legacy-key-migration
Apr 13, 2026
Merged

feat(login): auto-link legacy API key when ETERNA_MCP_KEY is set#1
matmilbury merged 1 commit intomainfrom
feature/legacy-key-migration

Conversation

@matmilbury
Copy link
Copy Markdown
Contributor

Summary

  • After a successful OAuth login, checks for ETERNA_MCP_KEY env var
  • If set, calls POST /migrate/link-legacy-key on mcp-gateway to link the legacy agent to the new OAuth identity — preserving the existing Bybit subaccount
  • Adds getMcpEndpoint() to config (defaults to https://mcp.eterna.exchange, overridable via ETERNA_MCP_URL for staging)
  • Works for both localhost and device code flows
  • Failure to link is non-fatal — prints a warning and continues

Transition flow for OpenClaw agents

ETERNA_MCP_KEY=eterna_mcp_04e7a9... eterna login --no-browser
  1. Device code flow → user opens URL, authenticates once
  2. Tokens saved to ~/.eterna/credentials.json
  3. Legacy key linked automatically → existing Bybit subaccount preserved
  4. All subsequent eterna execute calls use the new OAuth JWT

For staging: set ETERNA_MCP_URL=https://mcp.staging.eterna.exchange

Depends on

eterna2.0 #PR — the /migrate/link-legacy-key endpoint in mcp-gateway

No new secrets

If ETERNA_MCP_KEY is present in the environment, eterna login calls
POST /migrate/link-legacy-key on mcp-gateway after OAuth completes.
This preserves the user's existing Bybit subaccount — mcp-gateway
resolves the new JWT to the legacy agent row instead of creating a
fresh one with a null bybitSubMemberId.

For staging: set ETERNA_MCP_URL=https://mcp.staging.eterna.exchange.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@matmilbury matmilbury merged commit 908d97b into main Apr 13, 2026
1 check passed
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