|
| 1 | +--- |
| 2 | +slug: /use-cases/AI/MCP/anythingllm |
| 3 | +sidebar_label: 'Integrate AnythingLLM' |
| 4 | +title: 'Set Up ClickHouse MCP Server with AnythingLLM and ClickHouse Cloud' |
| 5 | +pagination_prev: null |
| 6 | +pagination_next: null |
| 7 | +description: 'This guide explains how to set up AnythingLLM with a ClickHouse MCP server using Docker.' |
| 8 | +keywords: ['AI', 'AnythingLLM', 'MCP'] |
| 9 | +show_related_blogs: true |
| 10 | +--- |
| 11 | + |
| 12 | +import {CardHorizontal} from '@clickhouse/click-ui/bundled' |
| 13 | +import Link from '@docusaurus/Link'; |
| 14 | +import Image from '@theme/IdealImage'; |
| 15 | + |
| 16 | +import Conversation from '@site/static/images/use-cases/AI_ML/MCP/allm_conversation.png'; |
| 17 | +import MCPServers from '@site/static/images/use-cases/AI_ML/MCP/allm_mcp-servers.png'; |
| 18 | +import ToolIcon from '@site/static/images/use-cases/AI_ML/MCP/alm_tool-icon.png'; |
| 19 | + |
| 20 | +# Using ClickHouse MCP server with AnythingLLM |
| 21 | + |
| 22 | +> This guide explains how to set up [AnythingLLM](https://anythingllm.com/) with a ClickHouse MCP server using Docker |
| 23 | +> and connect it to the ClickHouse example datasets. |
| 24 | +
|
| 25 | +<VerticalStepper headerLevel="h2"> |
| 26 | + |
| 27 | +## Install Docker {#install-docker} |
| 28 | + |
| 29 | +You will need Docker to run LibreChat and the MCP server. To get Docker: |
| 30 | +1. Visit [docker.com](https://www.docker.com/products/docker-desktop) |
| 31 | +2. Download Docker desktop for your operating system |
| 32 | +3. Install Docker by following the instructions for your operating system |
| 33 | +4. Open Docker Desktop and ensure it is running |
| 34 | +<br/> |
| 35 | +For more information, see the [Docker documentation](https://docs.docker.com/get-docker/). |
| 36 | + |
| 37 | +## Pull AnythingLLM Docker image {#pull-anythingllm-docker-image} |
| 38 | + |
| 39 | +Run the following command to pull the AnythingLLM Docker image to your machine: |
| 40 | + |
| 41 | +```bash |
| 42 | +docker pull anythingllm/anythingllm |
| 43 | +``` |
| 44 | + |
| 45 | +## Setup storage location {#setup-storage-location} |
| 46 | + |
| 47 | +Create a directory for storage and initialize the environment file: |
| 48 | + |
| 49 | +```bash |
| 50 | +export STORAGE_LOCATION=$PWD/anythingllm && \ |
| 51 | +mkdir -p $STORAGE_LOCATION && \ |
| 52 | +touch "$STORAGE_LOCATION/.env" |
| 53 | +``` |
| 54 | + |
| 55 | +## Configure MCP Server config file {#configure-mcp-server-config-file} |
| 56 | + |
| 57 | +Create the `plugins` directory: |
| 58 | + |
| 59 | +```bash |
| 60 | +mkdir -p "$STORAGE_LOCATION/plugins" |
| 61 | +``` |
| 62 | + |
| 63 | +Create a file called `anythingllm_mcp_servers.json` in the `plugins` directory and add the following contents: |
| 64 | + |
| 65 | +```json |
| 66 | +{ |
| 67 | + "mcpServers": { |
| 68 | + "mcp-clickhouse": { |
| 69 | + "command": "uv", |
| 70 | + "args": [ |
| 71 | + "run", |
| 72 | + "--with", |
| 73 | + "mcp-clickhouse", |
| 74 | + "--python", |
| 75 | + "3.10", |
| 76 | + "mcp-clickhouse" |
| 77 | + ], |
| 78 | + "env": { |
| 79 | + "CLICKHOUSE_HOST": "sql-clickhouse.clickhouse.com", |
| 80 | + "CLICKHOUSE_USER": "demo", |
| 81 | + "CLICKHOUSE_PASSWORD": "" |
| 82 | + } |
| 83 | + } |
| 84 | + } |
| 85 | +} |
| 86 | +``` |
| 87 | + |
| 88 | +If you want to explore your own data, you can do so by |
| 89 | +using the [host, username and password](https://clickhouse.com/docs/getting-started/quick-start/cloud#connect-with-your-app) |
| 90 | +of your own ClickHouse Cloud service. |
| 91 | + |
| 92 | +## Start the AnythingLLM Docker container {#start-anythingllm-docker-container} |
| 93 | + |
| 94 | +Run the following command to start the AnythingLLM Docker container: |
| 95 | + |
| 96 | +```bash |
| 97 | +docker run -p 3001:3001 \ |
| 98 | +--cap-add SYS_ADMIN \ |
| 99 | +-v ${STORAGE_LOCATION}:/app/server/storage \ |
| 100 | +-v ${STORAGE_LOCATION}/.env:/app/server/.env \ |
| 101 | +-e STORAGE_DIR="/app/server/storage" \ |
| 102 | +mintplexlabs/anythingllm |
| 103 | +``` |
| 104 | + |
| 105 | +Once that's started, navigate to `http://localhost:3001` in your browser. |
| 106 | +Select the model that you want to use and provide your API key. |
| 107 | + |
| 108 | +## Wait for MCP Servers to start up {#wait-for-mcp-servers-to-start-up} |
| 109 | + |
| 110 | +Click on the tool icon in the bottom left-hand side of the UI: |
| 111 | + |
| 112 | +<Image img={ToolIcon} alt="Tool icon" size="md"/> |
| 113 | + |
| 114 | +Click on `Agent Skills` and look under the `MCP Servers` section. |
| 115 | +Wait until you see `Mcp ClickHouse` set to `On` |
| 116 | + |
| 117 | +<Image img={MCPServers} alt="MCP servers ready" size="md"/> |
| 118 | + |
| 119 | +## Chat with ClickHouse MCP Server with AnythingLLM {#chat-with-clickhouse-mcp-server-with-anythingllm} |
| 120 | + |
| 121 | +We're now ready to start a chat. |
| 122 | +To make MCP Servers available to a chat, you'll need to prefix the first message in the conversation with `@agent`. |
| 123 | + |
| 124 | +<Image img={Conversation} alt="Conversation" size="md"/> |
| 125 | + |
| 126 | +</VerticalStepper> |
0 commit comments