OAuth 2.1 & Device Flow for Automated Crypto Trading Agents
Static exchange API keys are the #1 security failure mode in AI trading bots: keys leak into chat logs, prompt histories, or `.env` files with overly broad permissions. Eterna replaces static API keys with standard OAuth 2.1 discovery and scoped tokens.
Eterna MCP uses OAuth 2.1 (`https://ai-auth.eterna.exchange`) with PKCE for interactive clients (Claude, Cursor, ChatGPT) and OAuth Device Authorization Flow for headless terminals and CLIs (`@eterna-hybrid-exchange/cli`). Every OAuth sign-in automatically provisions an isolated no-KYC trading sub-account with zero raw exchange API secrets exposed to the LLM.
https://mcp.eterna.exchange/mcp1. Automatic MCP OAuth Discovery Flow
Modern MCP clients discover Eterna's authorization server automatically without manual client IDs.
- 01Client requests protected resource metadata
When an MCP client connects to `https://mcp.eterna.exchange/mcp`, an unauthenticated request returns `401` pointing to `/.well-known/oauth-protected-resource`.
- 02Authorization server metadata & PKCE
The client reads `/.well-known/oauth-authorization-server` on `ai-auth.eterna.exchange`, performs dynamic registration if needed, and opens a browser login with PKCE.
- 03Sub-account auto-provisioning
On first sign-in, Eterna creates an isolated trading sub-account automatically (no KYC, no separate `register_agent` tool call required).
- 04Token refresh & revocation
Short-lived access tokens authenticate each `execute_code` call; revoking access immediately cuts off agent execution without rotating master account keys.
2. Common Auth Issues & Fixes
| Error / Failure Mode | Root Cause | Exact Fix |
|---|---|---|
| 401 Unauthorized on /mcp | Access token expired or missing Authorization Bearer header | Re-authenticate via your client's /mcp menu or run `npx @eterna-hybrid-exchange/cli auth login`. |
| OAuth callback failed in local IDE | Browser popup blocked or stale cached MCP session | Clear the cached MCP OAuth token in Cursor/Claude settings and reconnect to `https://mcp.eterna.exchange/mcp`. |
| Insufficient balance after login | Funds were deposited to Funding Wallet but not transferred to Trading Wallet | Call `eterna.getAllCoinsBalance()` and `eterna.transferToTrading({ coin: 'USDT', amount })`. |
Frequently asked questions
Does the LLM ever see my underlying exchange API key?
Is there a `register_agent` MCP tool I need to call first?
References & verification links
- Eterna Auth Markdown GuideMachine-readable authentication reference.
- OAuth Authorization Server DiscoveryLive RFC 8414 metadata endpoint.
Connect your AI agent in 30 seconds
One remote MCP URL. 800+ USDT perpetuals, 380+ spot pairs, 0.014% maker / 0.035% taker, no KYC.