LangChain & LangGraph MCP Crypto Trading Agent
LangGraph shines when a trading system needs deterministic state transitions, checkpointing, and mandatory human approval interrupts before live capital is committed. Eterna MCP supplies the execution and technical analysis layer without custom CCXT boilerplate.
Connect LangChain or LangGraph to Eterna AI using `langchain-mcp-adapters` (`MultiServerMCPClient`) with `transport: 'streamable_http'` pointed at `https://mcp.eterna.exchange/mcp`. LangGraph's state graph lets you separate market research nodes, deterministic risk-check nodes, and human-in-the-loop interrupts before `execute_code` places any order.
https://mcp.eterna.exchange/mcp1. Wire Eterna MCP into LangGraph (Python)
Load the 3 Eterna MCP tools dynamically via `MultiServerMCPClient` and bind them to a LangGraph ReAct or custom state graph.
import asyncio
import os
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
async def main():
client = MultiServerMCPClient(
{
"eterna": {
"transport": "streamable_http",
"url": "https://mcp.eterna.exchange/mcp",
"headers": {
"Authorization": f"Bearer {os.environ['ETERNA_ACCESS_TOKEN']}"
},
}
}
)
tools = await client.get_tools()
agent = create_react_agent("anthropic:claude-sonnet-4-5", tools)
res = await agent.ainvoke(
{
"messages": [
(
"user",
"Use execute_code to fetch SOLUSDT 15m RSI, Bollinger Bands, and current open positions. Propose a limit entry with stopLoss and takeProfit, but do not submit the order.",
)
]
}
)
print(res["messages"][-1].content)
asyncio.run(main())2. Recommended 3-Node Production Topology
Do not let a single unconstrained LLM loop hold unchecked order authority. Split execution across explicit graph nodes.
| Graph Node | Responsibility | Eterna SDK Calls Allowed |
|---|---|---|
| 1. Scanner Node | Pull tickers, orderbooks, RSI/MACD/EMA/VWAP across watchlist | getTickers, getOrderbook, getRsi, getMacd, getEma, getVwap |
| 2. Risk Gate Node (deterministic) | Verify equity, drawdown limit, max open positions, and max leverage | getBalance, getPositions, getOrders |
| 3. Execution Node (optional interrupt) | Set leverage and place bracket order with mandatory SL/TP | setLeverage, placeOrder, setTradingStop, closePosition |
Frequently asked questions
Can LangGraph run with Python even though Eterna's sandbox runs TypeScript?
How do I prevent runaway loops in LangGraph?
References & verification links
- Eterna SDK ReferenceAll 30+ typed SDK methods available inside execute_code.
- Risk Guardrails GuideDeterministic position sizing and kill-switch patterns.
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.