Skip to content

Commit ef625db

Browse files
committed
Merge branch 'main' of https://github.com/ClickHouse/clickhouse-docs into 4032-spacing-after-list-items-2
2 parents 6072ac2 + e0a4521 commit ef625db

File tree

14 files changed

+274
-77
lines changed

14 files changed

+274
-77
lines changed

.gitignore

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ docs/data-modeling/projections/index.md
6363
docs/cloud/manage/jan2025_faq/index.md
6464
docs/chdb/guides/index.md
6565
docs/use-cases/AI_ML/index.md
66+
docs/use-cases/AI_ML/MCP/index.md
67+
docs/integrations/data-ingestion/clickpipes/kafka/index.md
68+
6669

6770
.vscode
6871
.aspell.en.prepl
@@ -71,11 +74,3 @@ docs/use-cases/AI_ML/index.md
7174
**.translated
7275
**.translate
7376
/ClickHouse/
74-
75-
# Ignore table of contents files
76-
docs/cloud/reference/release-notes-index.md
77-
docs/whats-new/changelog/index.md
78-
docs/cloud/manage/api/api-reference-index.md
79-
docs/getting-started/index.md
80-
docs/data-modeling/projections/index.md
81-
docs/integrations/data-ingestion/clickpipes/kafka/index.md

docs/cloud/reference/supported-regions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Customers must sign a Business Associate Agreement (BAA) and request onboarding
8585
- AWS us-east-1 (N. Virginia)
8686
- AWS us-east-2 (Ohio)
8787
- AWS us-west-2 (Oregon)
88+
- GCP europe-west4 (Netherlands)
8889
- GCP us-central1 (Iowa)
8990
- GCP us-east1 (South Carolina)
9091

docs/cloud/security/cmek.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,24 @@ Once a service is encrypted with TDE, customers may update the key to enable CME
4444
5. [Create a KMS key for AWS](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html)
4545
6. Click the key
4646
7. Update the AWS key policy as follows:
47-
```json
48-
{
49-
"Sid": "Allow ClickHouse Access",
50-
"Effect": "Allow",
51-
"Principal": {
52-
"AWS": "{ Encryption role ID }"
53-
},
54-
"Action": [
55-
"kms:Encrypt",
56-
"kms:Decrypt",
57-
"kms:ReEncrypt*",
58-
"kms:DescribeKey"
59-
],
60-
"Resource": "*"
61-
}
62-
```
47+
48+
```json
49+
{
50+
"Sid": "Allow ClickHouse Access",
51+
"Effect": "Allow",
52+
"Principal": {
53+
"AWS": [ "Encryption role ID " ]
54+
},
55+
"Action": [
56+
"kms:Encrypt",
57+
"kms:Decrypt",
58+
"kms:ReEncrypt*",
59+
"kms:DescribeKey"
60+
],
61+
"Resource": "*"
62+
}
63+
```
64+
6365
10. Save the Key policy
6466
11. Copy the Key ARN
6567
12. Return to ClickHouse Cloud and paste the Key ARN in the Transparent Data Encryption section of the Service Settings

docs/integrations/data-ingestion/clickpipes/mysql/faq.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ We support both `GTID` & `FilePos` replication. Unlike Postgres there is no slot
1919

2020
It's also possible for an inactive database to rotate the log file without allowing ClickPipes to progress to a more recent offset. You may need to setup a heartbeat table with regularly scheduled updates.
2121

22+
At the start of an initial load we record the binlog offset to start at. This offset must still be valid when the initial load finishes in order for CDC to progress. If you are ingesting a large amount of data be sure to configure an appropriate binlog retention period. While setting up tables you can speed up initial load by configuring *Use a custom partitioning key for initial load* for large tables under advanced settings so that we can load a single table in parallel.
23+
2224
### Why am I getting a TLS certificate validation error when connecting to MySQL? {#tls-certificate-validation-error}
2325

2426
When connecting to MySQL, you may encounter certificate errors like `x509: certificate is not valid for any names` or `x509: certificate signed by unknown authority`. These occur because ClickPipes enables TLS encryption by default.

docs/use-cases/AI_ML/MCP/claude-desktop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
slug: /use-cases/AI/MCP/claude-desktop
3-
sidebar_label: 'Claude Desktop and ClickHouse MCP'
3+
sidebar_label: 'Integrate Claude Desktop'
44
title: 'Set Up ClickHouse MCP Server with Claude Desktop'
55
pagination_prev: null
66
pagination_next: null

docs/use-cases/AI_ML/MCP/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
slug: /use-cases/AI/MCP
3+
sidebar_label: 'MCP'
4+
title: 'MCP guides'
5+
pagination_prev: null
6+
pagination_next: null
7+
description: 'This page contains a landing page with table of contentsfor MCP guides.'
8+
keywords: ['ClickHouse', 'MCP']
9+
show_related_blogs: true
10+
---
11+
12+
<!--AUTOGENERATED_START-->
13+
<!--AUTOGENERATED_END-->

docs/use-cases/AI_ML/MCP/librechat.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
slug: /use-cases/AI/MCP/librechat
3-
sidebar_label: 'LibreChat and ClickHouse MCP'
3+
sidebar_label: 'Integrate LibreChat'
44
title: 'Set Up ClickHouse MCP Server with LibreChat and ClickHouse Cloud'
55
pagination_prev: null
66
pagination_next: null

docs/use-cases/AI_ML/MCP/ollama.md

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
---
2+
slug: /use-cases/AI/MCP/ollama
3+
sidebar_label: 'Integrate Ollama'
4+
title: 'Set Up ClickHouse MCP Server with Ollama'
5+
pagination_prev: null
6+
pagination_next: null
7+
description: 'This guide explains how to set up Ollama with a ClickHouse MCP server.'
8+
keywords: ['AI', 'Ollama', '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+
# Using ClickHouse MCP server with Ollama
17+
18+
> This guide explains how to use the ClickHouse MCP Server with Ollama.
19+
20+
<VerticalStepper headerLevel="h2">
21+
22+
## Install Ollama {#install-ollama}
23+
24+
Ollama is a library for running Large Language Models (LLMs) on your own machine.
25+
It has a [wide range of models available](https://ollama.com/library) and is easy to use.
26+
27+
You can download Ollama for Mac, Windows, or Linux from the [download page](https://ollama.com/download).
28+
29+
Once you run Ollama, it will start a local server in the background that you can use to run models.
30+
Alternatively, you can run the server manually by running `ollama serve`.
31+
32+
Once installed, you can pull a model down to your machine like this:
33+
34+
```bash
35+
ollama pull qwen3:8b
36+
```
37+
38+
This will pull the model to your local machine if it is not present.
39+
Once it's downloaded, you can run the model like this:
40+
41+
```bash
42+
ollama run qwen3:8b
43+
```
44+
45+
:::note
46+
Only [models that have tool support](https://ollama.com/search?c=tools) will work with MCP Servers.
47+
:::
48+
49+
We can list the models that we have downloaded like this:
50+
51+
```bash
52+
ollama ls
53+
```
54+
55+
```text
56+
NAME ID SIZE MODIFIED
57+
qwen3:latest 500a1f067a9f 5.2 GB 3 days ago
58+
```
59+
60+
We can use the following command to see more information about the model that we've downloaded:
61+
62+
```bash
63+
ollama show qwen3
64+
```
65+
66+
```text
67+
Model
68+
architecture qwen3
69+
parameters 8.2B
70+
context length 40960
71+
embedding length 4096
72+
quantization Q4_K_M
73+
74+
Capabilities
75+
completion
76+
tools
77+
78+
Parameters
79+
repeat_penalty 1
80+
stop "<|im_start|>"
81+
stop "<|im_end|>"
82+
temperature 0.6
83+
top_k 20
84+
top_p 0.95
85+
86+
License
87+
Apache License
88+
Version 2.0, January 2004
89+
```
90+
91+
We can see from this output that the default qwen3 model has just over 8 billion parameters.
92+
93+
## Install MCPHost {#install-mcphost}
94+
95+
At the time of writing (July 2025) there is no native functionality for using Ollama with MCP Servers.
96+
However, we can use [MCPHost](https://github.com/mark3labs/mcphost) to run Ollama models with MCP Servers.
97+
98+
MCPHost is a Go application, so you'll need to make sure that you have [Go installed](https://go.dev/doc/install) on your machine.
99+
You can then install MCPHost by running the following command:
100+
101+
```bash
102+
go install github.com/mark3labs/mcphost@latest
103+
```
104+
105+
The binary will be installed under `~/go/bin` so we need to make sure that directory is on our path.
106+
107+
## Configuring ClickHouse MCP Server {#configure-clickhouse-mcp-server}
108+
109+
We can configure MCP Servers with MCPHost in YAML or JSON files.
110+
MCPHost will look for config files in your home directory the following order:
111+
112+
1. `.mcphost.yml` or `.mcphost.json` (preferred)
113+
2. `.mcp.yml` or `.mcp.json` (backwards compatibility)
114+
115+
It uses a syntax that's similar to that used in the standard MCP configuration file.
116+
Here's an example of a ClickHouse MCP server configuration, which we'll save to the `~/.mcphost.json` file:
117+
118+
```json
119+
{
120+
"mcpServers": {
121+
"mcp-ch": {
122+
"type": "local",
123+
"command": ["uv",
124+
"run",
125+
"--with",
126+
"mcp-clickhouse",
127+
"--python",
128+
"3.10",
129+
"mcp-clickhouse"
130+
]
131+
}
132+
}
133+
}
134+
```
135+
136+
The main difference from the standard MCP configuration file is that we need to specify a `type`.
137+
The type is used to indicate the transport type used by the MCP Server.
138+
139+
* `local` → stdio transport
140+
* `remote` → streamable transport
141+
* `builtin` → inprocess transport
142+
143+
We'll also need to configure the following environment variables:
144+
145+
```bash
146+
export CLICKHOUSE_HOST=sql-clickhouse.clickhouse.com
147+
export CLICKHOUSE_USER=demo
148+
export CLICKHOUSE_PASSWORD=""
149+
```
150+
151+
:::note
152+
In theory, you should be able to provide these variables under the `environment` key in the MCP configuration file, but we've found that this doesn't work.
153+
:::
154+
155+
## Running MCPHost {#running-mcphost}
156+
157+
Once you've configured the ClickHouse MCP server, you can run MCPHost by running the following command:
158+
159+
```bash
160+
mcphost --model ollama:qwen3
161+
```
162+
163+
Or, if you want to have it use a specific config file:
164+
165+
```bash
166+
mcphost --model ollama:qwen3 --config ~/.mcphost.json
167+
```
168+
169+
:::warning
170+
If you don't provide `--model`, MCPHost will look in the environment variables for `ANTHROPIC_API_KEY` and will use the `anthropic:claude-sonnet-4-20250514` model.
171+
:::
172+
173+
We should see the following output:
174+
175+
```text
176+
┃ ┃
177+
┃ Model loaded: ollama (qwen3) ┃
178+
┃ MCPHost System (09:52) ┃
179+
┃ ┃
180+
181+
┃ ┃
182+
┃ Model loaded successfully on GPU ┃
183+
┃ MCPHost System (09:52) ┃
184+
┃ ┃
185+
186+
┃ ┃
187+
┃ Loaded 3 tools from MCP servers ┃
188+
┃ MCPHost System (09:52) ┃
189+
┃ ┃
190+
191+
Enter your prompt (Type /help for commands, Ctrl+C to quit, ESC to cancel generation)
192+
```
193+
194+
We can use the `/servers` command to list the MCP Servers:
195+
196+
```text
197+
┃ ┃
198+
┃ ## Configured MCP Servers ┃
199+
┃ ┃
200+
┃ 1. mcp-ch ┃
201+
┃ MCPHost System (10:00) ┃
202+
203+
```
204+
205+
And `/tools` to list the tools available:
206+
207+
```text
208+
┃ ## Available Tools ┃
209+
┃ ┃
210+
┃ 1. mcp-ch__list_databases ┃
211+
┃ 2. mcp-ch__list_tables ┃
212+
┃ 3. mcp-ch__run_select_query
213+
```
214+
215+
We can then ask the model questions about the databases/tables available in the ClickHouse SQL playground.
216+
217+
In our experience when using smaller models (the default qwen3 model has 8 billion parameters), you'll need to be more specific about what you'd like it to do.
218+
For example, you'll need to explicitly ask it to list the databases and tables rather than straight away asking it to query a certain table.
219+
You can partially eleviate this problem by using a large model (e.g. qwen3:14b), but that will run more slowly on consumer hardware.
220+
221+
</VerticalStepper>

docs/use-cases/AI_ML/MCP/remote_mcp.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pagination_next: null
77
description: 'This guide explains how to enable and use the ClickHouse Cloud Remote MCP'
88
keywords: ['AI', 'ClickHouse Cloud', 'MCP']
99
show_related_blogs: true
10+
sidebar_position: 1
1011
---
1112

1213
import {CardHorizontal} from '@clickhouse/click-ui/bundled'

docs/use-cases/AI_ML/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ keywords: ['machine learning', 'genAI', 'AI']
1111

1212
ClickHouse is ideally suited as a real-time database to power Machine Learning workloads.
1313
With ClickHouse, it's easier than ever to unleash GenAI on your analytics data.
14-
In this section you'll find some guides around how ClickHouse is used for
14+
In this section, you'll find some guides around how ClickHouse is used for
1515
Machine Learning and GenAI.
1616

17-
<!--AUTOGENERATED_START-->
18-
<!--AUTOGENERATED_END-->
17+
| Section | Description |
18+
|--------------------------|--------------------------------------------------------------------------------------------|
19+
| [MCP](/use-cases/AI/MCP) | A collection of guides to get you setup using Model Context Protocol (MCP) with ClickHouse |

0 commit comments

Comments
 (0)