Skip to main content

Prerequisites

Before you can configure and use LangChain with Connect AI Embed, you must first do the following:
  • OAuth JWT bearer token を生成します。PAT をコピーし、認証時にパスワードとして使用します。
  • Obtain an OpenAI API key: https://platform.openai.com/.
  • Make sure you have Python >= 3.10 in order to install the LangChain and LangGraph packages.

Create the Python Files

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. Set MCP_AUTH to the OAuth JWT bearer token from the prerequisites:
4
In langchain.py, set up your MCP server and MCP client to call the tools and prompts:

Install the LangChain and LangGraph Packages

Run the following command in your project terminal:

Run the Python Script

1
When the installation finishes, run the following command to execute the script:
2
The script discovers the Connect AI MCP tools needed for the LLM to query the connected data.
3
Supply a prompt for the agent. The agent provides a response.
LangChain Client Terminal