Use Grok to Talk to Your Presto Data via CData Connect AI

Anusha M B
Anusha M B
Technical Marketing Engineer
Leverage the CData Connect AI Remote MCP Server to enable Grok AI to securely answer questions and take actions on your Presto data for you.

Grok AI is a large language model developed by xAI for real-time reasoning, tool invocation, and agentic workflows. It enables developers to build AI agents that can reason over live data, discover tools dynamically, and take intelligent actions.

CData Connect AI provides a secure cloud-to-cloud interface for integrating 350+ enterprise data sources with Grok AI. Using Connect AI, live Presto data is exposed through a remote MCP endpoint without replication, allowing Grok AI agents to securely query and analyze governed enterprise data in real time.

About Presto Data Integration

Accessing and integrating live data from Trino and Presto SQL engines has never been easier with CData. Customers rely on CData connectivity to:

  • Access data from Trino v345 and above (formerly PrestoSQL) and Presto v0.242 and above (formerly PrestoDB)
  • Read and write access all of the data underlying your Trino or Presto instances
  • Optimized query generation for maximum throughput.

Presto and Trino allow users to access a variety of underlying data sources through a single endpoint. When paired with CData connectivity, users get pure, SQL-92 access to their instances, allowing them to integrate business data with a data warehouse or easily access live data directly from their preferred tools, like Power BI and Tableau.

In many cases, CData's live connectivity surpasses the native import functionality available in tools. One customer was unable to effectively use Power BI due to the size of the datasets needed for reporting. When the company implemented the CData Power BI Connector for Presto they were able to generate reports in real-time using the DirectQuery connection mode.


Getting Started


Step 1: Configure Presto in CData Connect AI

To enable Grok to query live Presto data, first create a Presto connection in CData Connect AI. This connection is exposed through the CData Remote MCP Server.

  1. Log into Connect AI, click Sources, and then click Add Connection.
  2. Select "Presto" from the Add Connection panel.
  3. Enter the required authentication properties.

    Set the Server and Port connection properties to connect, in addition to any authentication properties that may be required.

    To enable TLS/SSL, set UseSSL to true.

    Authenticating with LDAP

    In order to authenticate with LDAP, set the following connection properties:

    • AuthScheme: Set this to LDAP.
    • User: The username being authenticated with in LDAP.
    • Password: The password associated with the User you are authenticating against LDAP with.

    Authenticating with Kerberos

    In order to authenticate with KERBEROS, set the following connection properties:

    • AuthScheme: Set this to KERBEROS.
    • KerberosKDC: The Kerberos Key Distribution Center (KDC) service used to authenticate the user.
    • KerberosRealm: The Kerberos Realm used to authenticate the user with.
    • KerberosSPN: The Service Principal Name for the Kerberos Domain Controller.
    • KerberosKeytabFile: The Keytab file containing your pairs of Kerberos principals and encrypted keys.
    • User: The user who is authenticating to Kerberos.
    • Password: The password used to authenticate to Kerberos.
    Click Create & Test.
  4. Open the Permissions tab and configure user access.

Add a Personal Access Token

A Personal Access Token (PAT) authenticates MCP requests from Agno to CData Connect AI.

  1. Open Settings and navigate to Access Tokens.
  2. Click Create PAT.
  3. Save the generated token securely.

Step 2: Install required dependencies

Remote MCP Tools allow Grok to connect to external MCP (Model Context Protocol) servers, extending its capabilities with custom tools from third parties or your own implementations. Simply specify a server URL and optional configuration xAI manages the MCP server connection and interaction on your behalf.

Open the terminal and install the required dependencies for the MCP integration using pip.

	pip install xai-sdk==1.4.0

The xai-sdk (v1.4.0) enables Remote MCP tools, and python-dotenv is used to securely load environment variables.

	pip install python-dotenv

Step 3: Generate an xAI API key

  1. Create or login to xAI account
  2. Open xAI API console
  3. Navigate to API Keys
  4. Click on create API key

After generating an API key, user need to save it somewhere safe. Recommended option is to export it as an environment variable in your terminal or save it to a .env file.

Step 4: Connect to CData Connect AI

Initialize the Grok client and configure the MCP connection to CData Connect AI. The code below establishes a secure connection and sends a natural language query to your data source.

import os

from xai_sdk import Client
from xai_sdk.chat import user
from xai_sdk.tools import mcp

client = Client(api_key="Your_xAI-API_KEY")
chat = client.chat.create(
	model="grok-4-1-fast-non-reasoning",
	tools=[
		mcp(
			server_url="https://mcp.cloud.cdata.com/mcp",
			extra_headers={"Authorization": "Basic Username:PAT"} #Base64 Encoded Username:PAT
		)
		],
	include=["verbose_streaming"],
)

chat.append(user("List the top two catalogs for me please"))

is_thinking = True
for response, chunk in chat.stream():
	# View the server-side tool calls as they are being made in real-time
	for tool_call in chunk.tool_calls:
		print(f"
Calling tool: {tool_call.function.name} with arguments: {tool_call.function.arguments}")
	if response.usage.reasoning_tokens and is_thinking:
		print(f"
Thinking... ({response.usage.reasoning_tokens} tokens)", end="", flush=True)
	if chunk.content and is_thinking:
		print("

Final Response:")
		is_thinking = False
	if chunk.content and not is_thinking:
		print(chunk.content, end="", flush=True)

print("

Usage:")
print(response.usage)
print(response.server_side_tool_usage)
print("

Server Side Tool Calls:")
print(response.tool_calls)

This code initializes the Grok AI client, connects to CData Connect AI via MCP using Basic Authentication, and streams the response in real-time. The agent automatically discovers available tools, invokes them to query your live data, and displays both the tool calls and final results.

Run the script to see Grok query your connected data source.

Query Results

The output shows Grok invoking MCP tools through CData Connect AI and returning live data from your connected source.

User can now query live data using natural language through Grok AI.

Build agentic workflows with Grok and CData Connect AI

Combining Grok AI with CData Connect AI delivers AI-powered data access without pipelines or custom integrations. Start your free trial today to see how CData can empower Grok with live, secure access to 350+ external systems.

Ready to get started?

Learn more about CData Connect AI or sign up for free trial access:

Free Trial