LibreChat
LibreChat is an open-source chat application for different LLM models. Using Anyquery, you can connect LibreChat to your local and online applications (such as Spotify, GitHub, Discord, etc.) and interact with them using natural language.
Prerequisites
Before you begin, ensure that you have the following:
- A working installation of Anyquery (
v0.4.0
). Follow the installation guide if you haven’t installed it yet. - A few integrations set up in Anyquery. Refer to each integration guide for more information.
- LibreChat hosted somewhere.
Connect LibreChat to Anyquery
To connect Anyquery to LibreChat, you can either use the HTTP api (recommended) or the model context protocol.
Ensuring agents are enabled
For both protocols, you need to enable Agents. By default, they should be enabled, and available in the Agents
section of the model selection screen. If not,
ensure your librechat.yaml
configuration file looks like this:
version: 1.2.1
interface: agents: true
endpoints: agents: recursionLimit: 25 # Can be increased if needed disableBuilder: false capabilities: ["actions", "tools"] # You can add other capabilities here ...
If you still cannot see the Agents
section, check your environment variables. The ENDPOINTS
variable should include agents
.
ENDPOINTS=azureOpenAI,gptPlugins,agents,openAI
HTTP API
-
Start Anyquery
In a terminal, run the following command to start Anyquery:
Terminal anyquery gptThis command will start a tunnel to Anyquery and provide you a bearer token. You must then use this token to authenticate your requests to Anyquery.
Terminal julien@MacBook-Air-Julien anyquery % anyquery gptYour Anyquery ID is ikabcjde. This is your bearer token that you must set in chatgpt.com2025-02-10 21:29:12.293 [I] [client/service.go:295] try to connect to server...2025-02-10 21:29:12.453 [I] [client/service.go:287] [cc07e04c16c1e59f] login to server success, get run id [cc07e04c16c1e59f]2025-02-10 21:29:12.454 [I] [proxy/proxy_manager.go:173] [cc07e04c16c1e59f] proxy added: [ikabcjde]2025-02-10 21:29:12.494 [I] [client/control.go:168] [cc07e04c16c1e59f] [ikabcjde] start proxy success -
Set up LibreChat
Select the
Agents
section in the model selection screen, and create a new one.In the right panel, fill in the fields for your new agent.
- Name and Description: Give your agent a name and a description.
- Instructions Go to this gist and copy the content to the instructions field.
- Model: Select the LLM model you want to use with LibreChat.
Click on
Create
to save your agent.Now that your agent is created, click on
Add actions
to connect it to Anyquery.
Under authentication, selectAPI Key
, selectBearer
as Auth Type, and paste the bearer token you received from Anyquery.Then, go to this gist and copy the content to the Schema field.
Finally, click on
Create
to save your action. Go back, and then click onSave
to save your agent.
Congratulations 🎉. LibreChat is connected to Anyquery.
Model Context Protocol
Anyquery can also connect to LibreChat using the Model Context Protocol (MCP).
-
Start Anyquery
In a terminal, run the following command to start Anyquery:
Terminal anyquery mcp --tunnelThis command will start a tunnel to Anyquery and provide you an HTTPS URL. You must then use this URL and pass it to LibreChat.
Terminal julien@MacBook-Air-Julien anyquery % anyquery mcp --tunnelModel context protocol server listening on https://mcp.anyquery.xyz/ikabcjde/sse2025-02-12 15:54:14.332 [I] [client/service.go:295] try to connect to server... -
Set up LibreChat
Open the
librechat.yaml
configuration file, and add the following configuration:version: 1.2.1mcpServers:anyquery: # Replace the URL with the one you received from Anyqueryurl: https://mcp.anyquery.xyz/ikabcjde/sse# Rest of your configurationNow, we will create a new agent in LibreChat. Select the
Agents
section in the model selection screen, and create a new one.In the right panel, fill in the fields for your new agent.
- Name and Description: Give your agent a name and a description.
- Instructions You can leave it empty.
- Model: Select the LLM model you want to use with LibreChat.
Now, click on
Add Tools
to add Anyquery as a tool. Go to the last page, and add:- listTables
- describeTable
- executeQuery
Finally, click on
Create
to save your agent. Go back, and then click onSave
to save your agent.
Selecting the agent
Now that you have set up your agent, go back to the Agents
section in LibreChat, and select the agent you just created in the right panel
You can now start interacting with LibreChat using natural language. Here are a few examples:
- What can you do?
- Recommend me a song according to my history.
- Take this PDF, and open the references in my browser.
- Here is a link to my schedule, when should I schedule a meeting?