Integrating LangChain with HCL Domino Data via CData Connect AI

Dibyendu Datta
Dibyendu Datta
Lead Technology Evangelist
Leverage the CData Connect AI Remote MCP Server to enable LangChain agents to securely access and act on HCL Domino data within automated workflows.

LangChain is a framework used by developers, data engineers, and AI practitioners for building AI-powered applications and workflows by combining reasoning models (LLMs), tools, APIs, and data connectors. By integrating LangChain with CData Connect AI through the built-in MCP Server, workflows can effortlessly access and interact with live HCL Domino data in real time.

CData Connect AI offers a secure, low-code environment to connect HCL Domino 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 HCL Domino connectivity in CData Connect AI, register the MCP server with LangChain, and build a workflow that queries HCL Domino data in real time.

Prerequisites

Step 1: Configure HCL Domino Connectivity for LangChain

Before LangChain can access HCL Domino, a HCL Domino connection must be created in CData Connect AI. This connection is then exposed to LangChain 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 HCL Domino
  3. Enter the necessary authentication properties to connect to HCL Domino

    Connecting to Domino

    To connect to Domino data, set the following properties:

    • URL: The host name or IP of the server hosting the Domino database. Include the port of the server hosting the Domino database. For example: http://sampleserver:1234/
    • DatabaseScope: The name of a scope in the Domino Web UI. The driver exposes forms and views for the schema governed by the specified scope. In the Domino Admin UI, select the Scopes menu in the sidebar. Set this property to the name of an existing scope.

    Authenticating with Domino

    Domino supports authenticating via login credentials or an Entra ID (formerly Azure AD) OAuth application:

    Login Credentials

    To authenticate with login credentials, set the following properties:

    • AuthScheme: Set this to "OAuthPassword"
    • User: The username of the authenticating Domino user
    • Password: The password associated with the authenticating Domino user

    The driver uses the login credentials to automatically perform an OAuth token exchange.

    EntraID (formerly AzureAD)

    This authentication method uses Entra ID (formerly Azure AD) as an IdP to obtain a JWT token. You need to create a custom OAuth application in Entra ID (formerly Azure AD) and configure it as an IdP. To do so, follow the instructions in the Help documentation. Then set the following properties:

    • AuthScheme: Set this to "EntraID (formerly AzureAD)"
    • InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
    • OAuthClientId: The Client ID obtained when setting up the custom OAuth application.
    • OAuthClientSecret: The Client secret obtained when setting up the custom OAuth application.
    • CallbackURL: The redirect URI defined when you registered your app. For example: https://localhost:33333
    • AzureTenant: The Microsoft Online tenant being used to access data. Supply either a value in the form companyname.microsoft.com or the tenant ID.

      The tenant ID is the same as the directory ID shown in the Azure Portal's Entra ID (formerly Azure AD) > Properties page.

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

Generate a Personal Access Token (PAT)

LangChain 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 HCL Domino connection configured and a PAT generated, LangChain is prepared to connect to HCL Domino data through the CData MCP server.

Note: You can also generate a PAT from LangChain in the Integrations section of Connect AI. Simply click Connect --> Create PAT to generate it.

Step 2: Connect to the MCP server in LangChain

To connect LangChain with CData Connect AI Remote MCP Server and use OpenAI (ChatGPT) for reasoning, you need to configure your MCP server endpoint and authentication values in a config.py file. These values allow LangChain to call the MCP server tools, while OpenAI handles the natural language reasoning.

  1. Create a folder for LangChain MCP
  2. Create two Python files within the folder: config.py and langchain.py
  3. In config.py, create a class Config to define your MCP server authentication and URL. You need to provide your Base64-encoded CData Connect AI username 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 langchain.py, set up your MCP server and MCP client to call the tools and prompts:
     
    """ 
    Integrates a LangChain ReAct agent with CData Connect AI MCP server. 
    The script demonstrates fetching, filtering, and using tools with an LLM for agent-based reasoning. 
    """ 
    
    import asyncio 
    from langchain_mcp_adapters.client import MultiServerMCPClient 
    from langchain_openai import ChatOpenAI 
    from langgraph.prebuilt import create_react_agent 
    from config import Config 
    
    async def main(): 
    
    # Initialize MCP client with one or more server URLs
    mcp_client = MultiServerMCPClient( 
      connections={ 
        "default": { # you can name this anything 
        "transport": "streamable_http", 
        "url": Config.MCP_BASE_URL, 
        "headers": {"Authorization": f"Basic {Config.MCP_AUTH}"}, 
        } 
      } 
    ) 
    
    # Load remote MCP tools exposed by the server 
    all_mcp_tools = await mcp_client.get_tools() 
    print("Discovered MCP tools:", [tool.name for tool in all_mcp_tools]) 
    
    # Create and run the ReAct style agent 
    llm = ChatOpenAI( 
      model="gpt-4o",  
      temperature=0.2, 
      api_key="YOUR_OPEN_API_KEY" #Use your OpenAI API Key here, this can be found here: https://platform.openai.com/ 
    ) 
    
    agent = create_react_agent(llm, all_mcp_tools) 
    
    user_prompt = "How many tables are available in Domino1?" #Change prompts as per need 
    print(f"
    User prompt: {user_prompt}") 
    
    # Send a prompt asking the agent to use the MCP tools 
    response = await agent.ainvoke( 
      { "messages": [{ "role": "user", "content": (user_prompt),}]} 
    ) 
    
    # Print out the agent's final response 
    final_msg = response["messages"][-1].content 
    print("Agent final response:", final_msg) 
    
    if __name__ == "__main__": 
    
    asyncio.run(main()) 
    

Step 3: Install the LangChain and LangGraph packages

Since this workflow uses LangChain together with CData Connect AI MCP and integrates OpenAI for reasoning, you need to install the required Python packages.

Run the following command in your project terminal:

 
pip install langchain-mcp-adapters langchain-openai langgraph 

Step 4: Prompt HCL Domino using LangChain (via the MCP server)

  1. When the installation finishes, run python langchain.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 HCL Domino?")
  4. Accordingly, the agent responds with the results

Get CData Connect AI

To get live data access to 300+ 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