# xAI Grok & Grok CLI Crypto Trading via Eterna MCP

> Connect xAI Grok (via Grok CLI, Vercel AI SDK `@ai-sdk/xai`, or LangGraph) to `https://mcp.eterna.exchange/mcp`. Grok pairs real-time crypto/macro sentiment awareness with Eterna's deterministic `execute_code` technical analysis and <200ms perpetuals execution.

- Canonical URL: https://ai.eterna.exchange/integrations/grok
- Last updated: November 23, 2026
- Author: Eterna Engineering (MCP & Agent Infrastructure Team)
- MCP endpoint: https://mcp.eterna.exchange/mcp

Crypto and tokenized equities move fast on X (Twitter) headlines, earnings flashes, and macro narratives. Pairing Grok's catalyst speed with Eterna's orderbook liquidity and strict risk-sizing TypeScript prevents both slow entries and blind headline chasing.

## Key Facts

| Metric | Value | Notes |
|--------|-------|-------|
| Strength | Catalyst + Execution | Combine sentiment with live RSI/VWAP |
| Markets | 800+ perps + xStocks | BTC, SOL, memecoins, TSLA, NVDA |
| Perp Fees | 0.014% / 0.035% | $0/mo MCP access |
| Guardrail | Code-enforced stops | Mandatory stopLoss & leverage cap |

## 1. Connect xAI Grok with `@ai-sdk/xai` + `@ai-sdk/mcp`

### grok-eterna-agent.ts

```typescript
import { generateText, stepCountIs } from "ai";
import { xai } from "@ai-sdk/xai";
import { createMCPClient } from "@ai-sdk/mcp";

const mcp = await createMCPClient({
  transport: {
    type: "http",
    url: "https://mcp.eterna.exchange/mcp",
    headers: { Authorization: `Bearer ${process.env.ETERNA_ACCESS_TOKEN}` },
  },
});

const res = await generateText({
  model: xai("grok-4"),
  tools: await mcp.tools(),
  stopWhen: stepCountIs(4),
  prompt:
    "Check TSLAUSDT, NVDAUSDT, BTCUSDT, and DOGEUSDT 15m VWAP, 1h RSI, and orderbook spreads via execute_code. Summarize any clean risk-reward setups.",
});

console.log(res.text);
await mcp.close();
```

## Frequently Asked Questions

### How do I stop a sentiment-driven Grok bot from chasing spikes?

Always verify price distance from 15m VWAP (`eterna.getVwap`) and 1h RSI (`eterna.getRsi`) inside `execute_code` before placing any order, and cap leverage at 2x to 3x on news volatility.

## References & Primary Sources

- [Tokenized Stocks AI Trading](https://ai.eterna.exchange/strategies/tokenized-stocks-ai-trading): 24/7 catalyst trading on TSLA, NVDA, COIN, and MSTR.

## Related Guides

- [DeepSeek Crypto Trading Agent via Eterna MCP (2026 Guide)](https://ai.eterna.exchange/integrations/deepseek)
- [VWAP Intraday Pullback AI Trading Agent (MCP Script)](https://ai.eterna.exchange/strategies/vwap-intraday-agent)
- [24/7 Earnings & After-Hours Catalyst AI Agent for Stock Perps (NVDA, TSLA, META)](https://ai.eterna.exchange/strategies/earnings-event-stock-perp-agent)
- [AI Crypto Trading Risk Management: Position Sizing, TP/SL & Kill Switches](https://ai.eterna.exchange/guides/ai-trading-risk-management-guardrails)
