Integrating LlamaIndex with NetSuite Data via CData Connect AI

Leverage the CData Connect AI Remote MCP Server to enable LlamaIndex ReAct agents to securely access and act on NetSuite data in real time.

LlamaIndex is a data framework for building LLM applications — agents, RAG pipelines, and structured workflows that reason over external data. By integrating LlamaIndex with CData Connect AI through the built-in MCP Server, your agents can discover and query live NetSuite data as native tools without writing custom connectors.

CData Connect AI offers a secure, low-code environment to connect NetSuite and other data sources, removing the need for complex ETL and enabling seamless automation across business applications with live data.

This article outlines how to configure NetSuite connectivity in CData Connect AI, register the MCP server with LlamaIndex, and build a ReAct agent that queries NetSuite data in real time.

Prerequisites

About NetSuite Data Integration

CData provides the easiest way to access and integrate live data from Oracle NetSuite. Customers use CData connectivity to:

  • Access all editions of NetSuite, including Standard, CRM, and OneWorld.
  • Connect with all versions of the SuiteTalk API (SOAP-based) and SuiteQL, which functions like SQL, enabling easier data querying and manipulation.
  • Access predefined and custom reports through support for Saved Searches.
  • Securely authenticate with Token-based and OAuth 2.0, ensuring compatibility and security for all use cases.
  • Use SQL stored procedures to perform functional actions like uploading or downloading files, attaching or detaching records or relationships, retrieving roles, getting extra table or column info, getting job results, and more.

Customers use CData solutions to access live NetSuite data from their preferred analytics tools, Power BI and Excel. They also use CData's solutions to integrate their NetSuite data into comprehensive databases and data warehouse using CData Sync directly or leveraging CData's compatibility with other applications like Azure Data Factory. CData also helps Oracle NetSuite customers easily write apps that can pull data from and push data to NetSuite, allowing organizations to integrate data from other sources with NetSuite.

For more information about our Oracle NetSuite solutions, read our blog: Drivers in Focus Part 2: Replicating and Consolidating ... NetSuite Accounting Data.


Getting Started


Step 1: Configure NetSuite Connectivity for LlamaIndex

Before LlamaIndex can access NetSuite, a NetSuite connection must be created in CData Connect AI. This connection is then exposed to LlamaIndex through the remote MCP server.

  1. Log in to Connect AI, click Sources, and then click + Add Connection
  2. From the available data sources, choose NetSuite
  3. Enter the necessary authentication properties to connect to NetSuite

    The User and Password properties, under the Authentication section, must be set to valid NetSuite user credentials. In addition, the AccountId must be set to the ID of a company account that can be used by the specified User. The RoleId can be optionally specified to log in the user with limited permissions.

    See the "Getting Started" chapter of the help documentation for more information on connecting to NetSuite.

  4. Click Save & Test
  5. Once authenticated, open the Permissions tab in the NetSuite connection and configure user-based permissions as required

Generate a Personal Access Token (PAT)

LlamaIndex authenticates to Connect AI using an account email and a Personal Access Token (PAT). Creating separate PATs for each integration is recommended to maintain access control granularity.

  1. In Connect AI, select the Gear icon in the top-right to open Settings
  2. Under Access Tokens, select Create PAT
  3. Provide a descriptive name for the token and select Create
  4. Copy the token and store it securely. The PAT will only be visible during creation

With the NetSuite connection configured and a PAT generated, LlamaIndex is prepared to connect to NetSuite data through the CData MCP server.

Step 2: Connect to the MCP server in LlamaIndex

To connect LlamaIndex with CData Connect AI Remote MCP Server and use OpenAI for reasoning, configure your MCP server endpoint and authentication in a

config.py
file. These values let LlamaIndex’s MCP tool spec call the MCP server tools, while OpenAI handles the natural language reasoning.

  1. Create a folder for the LlamaIndex MCP project
  2. Create two Python files within the folder:
    config.py
    and
    llamaindex_agent.py
  3. In
    config.py
    , define your MCP server URL and your Base64-encoded CData Connect AI email and PAT (obtained in the prerequisites):
    class Config:
    
          MCP_BASE_URL = "https://mcp.cloud.cdata.com/mcp"   # MCP Server URL
          MCP_AUTH     = "base64encoded(EMAIL:PAT)"          # Base64 encoded Connect AI Email:PAT
    

    Note: You can create the base64 encoded version of MCP_AUTH using any Base64 encoding tool.

  4. In
    llamaindex_agent.py
    , wire up the MCP tool spec and a ReAct agent:
    """
    Integrates a LlamaIndex ReAct agent with the CData Connect AI MCP server.
    The script discovers MCP tools, wraps them as LlamaIndex tools, and runs an
    agent loop driven by OpenAI for reasoning.
    """
    
    import asyncio
    from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
    from llama_index.core.agent.workflow import ReActAgent
    from llama_index.llms.openai import OpenAI
    from config import Config
    
    async def main():
    
        # Initialize the MCP client pointed at Connect AI
        mcp_client = BasicMCPClient(
            Config.MCP_BASE_URL,
            headers={"Authorization": f"Basic {Config.MCP_AUTH}"},
        )
    
        # Discover tools the MCP server exposes (getCatalogs, queryData, etc.)
        tool_spec = McpToolSpec(client=mcp_client)
        tools = await tool_spec.to_tool_list_async()
        print("Discovered MCP tools:", [t.metadata.name for t in tools])
    
        # Configure the LLM that drives the ReAct loop
        llm = OpenAI(
            model="gpt-4o",
            temperature=0.2,
            api_key="YOUR_OPENAI_API_KEY",  # https://platform.openai.com/
        )
    
        # Build the agent with the MCP-backed tools
        agent = ReActAgent(tools=tools, llm=llm)
    
        user_prompt = "How many tables are available in NetSuite1?"  # Change as needed
        print(f"
    User prompt: {user_prompt}")
    
        response = await agent.run(user_prompt)
    
        print("Agent final response:", response)
    
    if __name__ == "__main__":
        asyncio.run(main())
    

Step 3: Install the LlamaIndex packages

Since this workflow uses LlamaIndex together with the CData Connect AI MCP server and OpenAI for reasoning, install the required Python packages.

Run the following command in your project terminal:

pip install llama-index llama-index-tools-mcp llama-index-llms-openai

Step 4: Prompt NetSuite using LlamaIndex (via the MCP server)

  1. When the installation finishes, run
    python llamaindex_agent.py
    to execute the script
  2. The script connects to the MCP server and discovers the CData Connect AI MCP tools available for querying your connected data
  3. Supply a prompt (e.g., "How many tables are available in NetSuite?")
  4. The agent reasons over the available tools, calls
    queryData
    against NetSuite, and responds with the result

Get CData Connect AI

To get live data access to hundreds of SaaS, Big Data, and NoSQL sources directly from your cloud applications, try CData Connect AI today!

Ready to get started?

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

Free Trial