4,500+ servers built on MCP Fusion
Vinkius
IBKR (Interactive Brokers) logo
Vinkius
Mastra AI logo

How to Use the IBKR (Interactive Brokers) MCP in Mastra AI

Build resilient trading workflows that automate IBKR order execution using Mastra AI and this MCP Server.

See Vinkius in Action

Works with every AI agent you already use

…and any MCP-compatible client

IBKR (Interactive Brokers) MCP on Cursor AI Code Editor MCP Client IBKR (Interactive Brokers) MCP on Claude Desktop App MCP Integration IBKR (Interactive Brokers) MCP on OpenAI Agents SDK MCP Compatible IBKR (Interactive Brokers) MCP on Visual Studio Code MCP Extension Client IBKR (Interactive Brokers) MCP on GitHub Copilot AI Agent MCP Integration IBKR (Interactive Brokers) MCP on Google Gemini AI MCP Integration IBKR (Interactive Brokers) MCP on Lovable AI Development MCP Client IBKR (Interactive Brokers) MCP on Mistral AI Agents MCP Compatible IBKR (Interactive Brokers) MCP on Amazon AWS Bedrock MCP Support
MCP Servers - Free for Subscribers
Mastra AI

Connect IBKR (Interactive Brokers) MCP to Mastra AI

Create your Vinkius account to connect IBKR (Interactive Brokers) to Mastra AI and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.

GDPR Free for Subscribers

Fault-Tolerant Order Routing

The `place_order` tool sends your trade execution payloads directly to the Interactive Brokers gateway. When configured inside a Mastra AI workflow, you can build conditional logic that automatically retries the trade if the initial attempt fails due to rate limits. If the market moves against your position, the agent uses `modify_order` or `cancel_order` to adjust the price or pull the ticket entirely. The built-in workflow engine handles these state changes step-by-step, ensuring your execution logic doesn't crash mid-trade.

Session Maintenance via Mastra AI MCP Server

The `tickle_session` tool maintains your active Client Portal API session by executing regular heartbeat pings. Mastra AI runs this tool as a background step in your agent workflows, preventing credential expiration during long-running trading operations. While the session remains active, the agent uses `get_account_summary` to monitor your buying power and margin cushion. If buying power falls below your specified threshold, the workflow triggers an alert step to notify your team before placing further trades.

Risk Management and Ledger Analysis

The `get_portfolio_ledger` tool retrieves your current cash balances and unrealized PnL directly from your account. Your Mastra AI agent analyzes this ledger data to calculate risk exposure before initiating new positions. To get a deeper look at historical performance, the agent triggers `send_flex_request` and retrieves the resulting file via `get_flex_statement`. You can pipe this data directly into your custom database or analytical pipelines to track your trading metrics over time.

Setup guide

Set up IBKR (Interactive Brokers) MCP in Mastra AI

Prerequisites

  • Node.js 18+ and a TypeScript project
  • @mastra/mcp + @mastra/core packages
  • Active Vinkius subscription with a valid endpoint token
  1. 1

    Install dependencies

    Run npm install @mastra/mcp @mastra/core plus your preferred model provider (e.g. @ai-sdk/openai).

  2. 2

    Configure the MCPClient

    Create an MCPClient with your Vinkius endpoint as a URL object. Replace [YOUR_TOKEN_HERE] with your token from cloud.vinkius.com.

  3. 3

    Discover and inject tools

    Call mcpClient.listTools() and spread the result into your agent's tools object. All IBKR (Interactive Brokers) tools become native Mastra tools.

  4. 4

    Run with any model

    Swap openai("gpt-4o") for any AI SDK-compatible provider. Call agent.generate() and the agent routes tool calls through MCP automatically.

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

const mcpClient = new MCPClient({
  id: "ibkr-interactive-brokers-mcp-client",
  servers: {
    "ibkr-interactive-brokers-mcp": {
      url: new URL(
        "https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
      ),
    },
  },
});

const agent = new Agent({
  name: "IBKR (Interactive Brokers) Agent",
  model: openai("gpt-4o"),
  instructions: "You have access to IBKR (Interactive Brokers) tools.",
  tools: {
    ...(await mcpClient.listTools()),
  },
});

const result = await agent.generate(
  "List recent IBKR (Interactive Brokers) transactions"
);
console.log(result.text);

Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by Interactive Brokers. All third-party trademarks, logos, and brand names are the property of their respective owners. Their use on this website is strictly for informational purposes to identify service compatibility and interoperability.

Why Choose Vinkius

Vinkius connects your tools to AI with real-time monitoring and automatic cost savings — all from one dashboard.

Real-time monitoring

Live

visibility into every interaction

Connect your favorite tools to your AI and see exactly what's happening — every request, every response, in real time.

Built-in savings

60%

lower AI costs

Vinkius compresses data between your apps and your AI automatically. Lower bills every month — no configuration required.

Single dashboard

One

place for every integration

Every tool your AI connects to, managed from a single screen. One account, complete control.

Common questions about IBKR (Interactive Brokers) MCP in Mastra AI

Initialize the client with your Vinkius MCP Server URL and register it within your Mastra configuration. You can then expose tools like `place_order` directly to your agent's toolset for automated execution.
Yes, you can use Mastra's tool approval features to pause workflows before executing `place_order` or `modify_order`. The agent waits for manual confirmation via your dashboard before sending the trade to the broker.
The workflow engine uses automated retries with exponential backoff to handle rate limits on tools like `get_market_data_snapshot`. This prevents your agent from failing when the Client Portal API throttles incoming requests.
Yes, the MCP Server runs in a hosted sandbox, and your Mastra AI agent can be deployed to any cloud provider. The agent communicates with the server via secure HTTP or SSE protocols.
Yes, the server processes your trade orders, account numbers, and ledger entries inside a zero-trust, ephemeral sandbox. No transaction details are stored permanently, and your API session is kept isolated from other users.

Start using the IBKR (Interactive Brokers) MCP today

We host it, we monitor it, we maintain it. You just paste one token.

Built & Managed by Vinkius 30s setup 9 tools

We've already built the connector for IBKR (Interactive Brokers). Just plug in your AI agents and start using Vinkius.

No hosting. No infrastructure. No complex setup.
All 9 tools are live and waiting. You're up and running in seconds.

Claude Claude
ChatGPT ChatGPT
Cursor Cursor
Gemini Gemini
Windsurf Windsurf
VS Code VS Code
JetBrains JetBrains
Vercel Vercel
+ other MCP clients

Vinkius gives your AI agents access to the full catalog of app connectors, all fully managed, secure, and enterprise-ready. One subscription, every tool you need.

Zero hosting required Full MCP catalog included Enterprise-grade security Auto-updated by Vinkius

Built, hosted, and secured by Vinkius. You just connect and go.