This guide explains how to set up LibreChat with a ClickHouse MCP server using Docker and connect it to the ClickHouse example datasets.
1
Install docker
You will need Docker to run LibreChat and the MCP server. To get Docker:
For more information, see the Docker documentation.
- Visit docker.com
- Download Docker desktop for your operating system
- Install Docker by following the instructions for your operating system
- Open Docker Desktop and ensure it is running
For more information, see the Docker documentation.
2
Clone the LibreChat repository
Open a terminal (command prompt, terminal or PowerShell) and clone the
LibreChat repository using the following command:
3
Create and edit the .env file
Copy the example configuration file from Open the Replace
.env.example to .env:.env file in your favorite text editor. You will see sections for
many popular LLM providers, including OpenAI, Anthropic, AWS bedrock etc, for
example:.venv
user_provided with your API key for the LLM provider you want to use.Using a local LLMIf you don’t have an API key you can use a local LLM like Ollama. You’ll see how
to do this later in step “Install Ollama”. For now
don’t modify the .env file and continue with the next steps.
4
Create a librechat.yaml file
Run the following command to create a new This creates the main configuration file for LibreChat.
librechat.yaml file:5
Add ClickHouse MCP server to Docker compose
Next we’ll add the ClickHouse MCP server to the LibreChat Docker compose file
so that the LLM can interact with the
ClickHouse SQL playground.Create a file called If you want to explore your own data, you can do so by
using the host, username and password
of your own ClickHouse Cloud service.
docker-compose.override.yml and add the following configuration to it:docker-compose.override.yml
Get started with ClickHouse Cloud
If you don’t have a Cloud account yet, get started with ClickHouse Cloud today and receive $300 in credits. At the end of your 30-day free trial, continue with a pay-as-you-go plan, or contact us to learn more about our volume-based discounts. Visit our pricing page for details.
6
Configure MCP server in librechat.yaml
Open This configures LibreChat to connect to the MCP server running on Docker.Find the following line:For simplicity, we will remove the need to authenticate for now:
librechat.yaml and place the following configuration at the end of the file:librechat.yaml
librechat.yaml
7
Add a local LLM using Ollama (optional)
Install Ollama
Go to the Ollama website and install Ollama for your system.Once installed, you can run a model like this:Configure Ollama in librechat.yaml
Once the model has downloaded, configure it inlibrechat.yaml:librechat.yaml
8
Start all services
From the root of the LibreChat project folder, run the following command to start the services:Wait until all services are fully running.
9
Open LibreChat in your browser
Once all services are up and running, open your browser and go to
http://localhost:3080/Create a free LibreChat account if you don’t yet have one, and sign in. You should
now see the LibreChat interface connected to the ClickHouse MCP server, and optionally,
your local LLM.From the chat interface, select clickhouse-playground as your MCP server:You can now prompt the LLM to explore the ClickHouse example datasets. Give it a go:Prompt
If the MCP server option doesn’t appear in the LibreChat UI,
check that the proper permissions are set in your
librechat.yaml file.use is set to false in the mcpServers section under interface, the MCP selection dropdown won’t appear in chat:
librechat.yaml