TypeScript Agent Framework

Mastra.ai TypeScript Trading Agent + Eterna MCP

Mastra.ai brings typed workflows, memory, evals, and observability to TypeScript agent teams - matching Eterna's TypeScript `execute_code` SDK seamlessly end-to-end.

Updated: By Eterna Engineering (MCP & Agent Infrastructure Team)Read as Markdown
Quick Answer

Configure Mastra's `MCPClient` with `url: new URL('https://mcp.eterna.exchange/mcp')` and Bearer OAuth headers to expose Eterna's `search_sdk`, `search_examples`, and `execute_code` tools inside Mastra Agents and durable Workflows.

Stack Alignment100% TypeScriptMastra + Eterna Deno SDK
MCP Client@mastra/mcpNative Streamable HTTP
ObservabilityTracing & EvalsLog every execute_code payload
Cost$0 Eterna MCP fee0.014%/0.035% perp fees
https://mcp.eterna.exchange/mcp

1. Connect `@mastra/mcp` to Eterna MCP

mastra-eterna-agent.ts
import { Agent } from "@mastra/core/agent";
import { MCPClient } from "@mastra/mcp";
import { anthropic } from "@ai-sdk/anthropic";

const mcp = new MCPClient({
  servers: {
    eterna: {
      url: new URL("https://mcp.eterna.exchange/mcp"),
      requestInit: {
        headers: {
          Authorization: `Bearer ${process.env.ETERNA_ACCESS_TOKEN}`,
        },
      },
    },
  },
});

export const eternaTrader = new Agent({
  name: "Eterna Systematic Trader",
  instructions:
    "Always inspect balance, positions, and orderbook spread before proposing any trade. Cap leverage at 3x and require stopLoss and takeProfit.",
  model: anthropic("claude-sonnet-4-5"),
  tools: await mcp.getTools(),
});
FAQ

Frequently asked questions

Why use Mastra Workflows alongside Eterna MCP?
Mastra Workflows let you wrap deterministic pre-trade risk checks, retry logic, and human suspend/resume approval gates around the LLM agent before live orders execute.
Primary Sources

References & verification links

Start Trading via MCP

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.

View on GitHub