Integrations / Grok

Market data for Grok: remote MCP tools with the xAI API

Grok models can call remote MCP servers through the xAI Responses API. Pass the server URL and an API key, and the model gets all 30 tools.

Steps

  1. 1Create an API key in your TradingData dashboard.
  2. 2Pass the server URL and the key in the tools list of your request, as below.
  3. 3If the Grok app offers custom connectors in your account, add the URL there and choose OAuth.
Python
from xai_sdk import Client
from xai_sdk.chat import user
from xai_sdk.tools import mcp

client = Client()
chat = client.chat.create(
    model="grok-4",
    tools=[mcp(server_url="https://mcp.tradingdata.io", server_label="tradingdata",
               authorization="Bearer td_your_api_key")],
)
chat.append(user("Which S&P 500 sectors are the commodities rally helping?"))
print(chat.sample().content)

Replace td_your_api_key with a key from your dashboard (API keys). Each key can be revoked on its own.

What Grok can answer with it

  • How are markets doing today?
  • Compare Nvidia and AMD gross margins over six quarters.
  • What did Meta guide for next quarter?
  • Which SPY strikes carry the most open interest this week?
  • Are insiders selling Tesla?
  • Is the Bitcoin perp market crowded long?

All 48 tools are listed on the tools page.

Questions

What data does the agent get?
Quotes and history for stocks, ETFs, indices, futures, FX and crypto; option chains with greeks; SEC filings, financial statements, insider trades, short interest, analyst estimates, segment financials and earnings releases; dividends, institutional holders and the earnings calendar; macro series; crypto perpetuals, options, DeFi and on-chain metrics. 30 tools, each described so the model picks the right one.
Does it cost anything?
No. Every account is free, with a fair-use limit of tool calls per minute and no monthly cap. No card is asked for.

Other clients