Skip to content

Commit e9de87a

Browse files
authored
Merge pull request #4145 from mneedham/open-webui
Open WebUI example
2 parents 2643341 + cb3a3e0 commit e9de87a

13 files changed

+112
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
slug: /use-cases/AI/MCP/open-webui
3+
sidebar_label: 'Integrate Open WebUI'
4+
title: 'Set Up ClickHouse MCP Server with Open WebUI and ClickHouse Cloud'
5+
pagination_prev: null
6+
pagination_next: null
7+
description: 'This guide explains how to set up Open WebUI with a ClickHouse MCP server using Docker.'
8+
keywords: ['AI', 'Open WebUI', '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 Endpoints from '@site/static/images/use-cases/AI_ML/MCP/0_endpoints.png';
17+
import Settings from '@site/static/images/use-cases/AI_ML/MCP/1_settings.png';
18+
import ToolsPage from '@site/static/images/use-cases/AI_ML/MCP/2_tools_page.png';
19+
import AddTool from '@site/static/images/use-cases/AI_ML/MCP/3_add_tool.png';
20+
import ToolsAvailable from '@site/static/images/use-cases/AI_ML/MCP/4_tools_available.png';
21+
import ListOfTools from '@site/static/images/use-cases/AI_ML/MCP/5_list_of_tools.png';
22+
import Connections from '@site/static/images/use-cases/AI_ML/MCP/6_connections.png';
23+
import AddConnection from '@site/static/images/use-cases/AI_ML/MCP/7_add_connection.png';
24+
import OpenAIModels from '@site/static/images/use-cases/AI_ML/MCP/8_openai_models_more.png';
25+
import Conversation from '@site/static/images/use-cases/AI_ML/MCP/9_conversation.png';
26+
27+
# Using ClickHouse MCP server with Open WebUI
28+
29+
> This guide explains how to set up [Open WebUI](https://github.com/open-webui/open-webui) with a ClickHouse MCP server
30+
> and connect it to the ClickHouse example datasets.
31+
32+
<VerticalStepper headerLevel="h2">
33+
34+
## Install uv {#install-uv}
35+
36+
You will need to install [uv](https://docs.astral.sh/uv/) to follow the instructions in this guide.
37+
If you don't want to use uv, you will need to update the MCP Server config to use an alternative package manager.
38+
39+
40+
## Launch Open WebUI {#launch-open-webui}
41+
42+
To launch Open WebUI, you can run the following command:
43+
44+
```bash
45+
uv run --with open-webui open-webui serve
46+
```
47+
48+
Navigate to http://localhost:8080/ to see the UI.
49+
50+
## Configure ClickHouse MCP Server {#configure-clickhouse-mcp-server}
51+
52+
To setup the ClickHouse MCP Server, we'll need to convert the MCP Server to Open API endpoints.
53+
Let's first set environmental variables that will let us connect to the ClickHouse SQL Playground:
54+
55+
```bash
56+
export CLICKHOUSE_HOST="sql-clickhouse.clickhouse.com"
57+
export CLICKHOUSE_USER="demo"
58+
export CLICKHOUSE_PASSWORD=""
59+
```
60+
61+
And, then, we can run `mcpo` to create the Open API endpoints:
62+
63+
```bash
64+
uvx mcpo --port 8000 -- uv run --with mcp-clickhouse --python 3.10 mcp-clickhouse
65+
```
66+
67+
You can see a list of the endpoints created by navigating to http://localhost:8000/docs
68+
69+
<Image img={Endpoints} alt="Open API endpoints" size="md"/>
70+
71+
To use these endpoints with Open WebUI, we need to navigate to settings:
72+
73+
<Image img={Settings} alt="Open WebUI settings" size="md"/>
74+
75+
Click on `Tools`:
76+
77+
<Image img={ToolsPage} alt="Open WebUI tools" size="md"/>
78+
79+
Add http://localhost:8000 as the tool URL:
80+
81+
<Image img={AddTool} alt="Open WebUI tool" size="md"/>
82+
83+
Once we've done this, we should see a `1` next to the tool icon on the chat bar:
84+
85+
<Image img={ToolsAvailable} alt="Open WebUI tools available" size="md"/>
86+
87+
If we click on the tool icon, we can then list the available tools:
88+
89+
<Image img={ListOfTools} alt="Open WebUI tool listing" size="md"/>
90+
91+
## Configure OpenAI {#configure-openai}
92+
93+
By default, Open WebUI works with Ollama models, but we can add OpenAI compatible endpoints as well.
94+
These are configured via the settings menu, but this time we need to click on the `Connections` tab:
95+
96+
<Image img={Connections} alt="Open WebUI connections" size="md"/>
97+
98+
Let's add the endpoint and our OpenAI key:
99+
100+
<Image img={AddConnection} alt="Open WebUI - Add OpenAI as a connection" size="md"/>
101+
102+
The OpenAI models will then be available on the top menu:
103+
104+
<Image img={OpenAIModels} alt="Open WebUI - Models" size="md"/>
105+
106+
## Chat to ClickHouse MCP Server with Open WebUI {#chat-to-clickhouse-mcp-server}
107+
108+
We can then have a conversation and Open WebUI will call the MCP Server if necessary:
109+
110+
<Image img={Conversation} alt="Open WebUI - Chat with ClickHouse MCP Server" size="md"/>
111+
112+
</VerticalStepper>
File renamed without changes.
87.8 KB
Loading
40.5 KB
Loading
116 KB
Loading
143 KB
Loading
25.1 KB
Loading
110 KB
Loading
106 KB
Loading
139 KB
Loading

0 commit comments

Comments
 (0)