|
| 1 | +--- |
| 2 | +slug: /use-cases/AI/MCP/claude-desktop |
| 3 | +sidebar_label: 'Claude Desktop and ClickHouse MCP' |
| 4 | +title: 'Set Up ClickHouse MCP Server with Claude Desktop' |
| 5 | +pagination_prev: null |
| 6 | +pagination_next: null |
| 7 | +description: 'This guide explains how to set up Claude Desktop with a ClickHouse MCP server.' |
| 8 | +keywords: ['AI', 'Librechat', '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 | +import ClaudeDesktopConfig from '@site/static/images/use-cases/AI_ML/MCP/claude-desktop-config.png'; |
| 16 | +import FindMCPServers from '@site/static/images/use-cases/AI_ML/MCP/find-mcp-servers.gif'; |
| 17 | +import MCPPermission from '@site/static/images/use-cases/AI_ML/MCP/mcp-permission.png'; |
| 18 | +import ClaudeConversation from '@site/static/images/use-cases/AI_ML/MCP/claude-conversation.png'; |
| 19 | + |
| 20 | +# Using ClickHouse MCP server with Claude Desktop |
| 21 | + |
| 22 | +> This guide explains how to set up Claude Desktop with a ClickHouse MCP server using uv |
| 23 | +> and connect it to the ClickHouse example datasets. |
| 24 | +
|
| 25 | +<VerticalStepper headerLevel="h2" /> |
| 26 | + |
| 27 | +## Install uv {#install-uv} |
| 28 | + |
| 29 | +You will need to install [uv](https://docs.astral.sh/uv/) to follow the instructions in this guide. |
| 30 | +If you don't want to use uv, you will need to update the MCP Server config to use an alternative package manager. |
| 31 | + |
| 32 | + |
| 33 | +## Download Claude Desktop {#download-claude-desktop} |
| 34 | + |
| 35 | +You'll also need to install the Claude Desktop app, which you can download from the [Claude Desktop website](https://claude.ai/desktop). |
| 36 | + |
| 37 | +## Configuring ClickHouse MCP server {#configure-clickhouse-mcp-server} |
| 38 | + |
| 39 | +Once you've got Claude Desktop installed, it's time to configure the [ClickHouse MCP server](https://github.com/ClickHouse/mcp-clickhouse). |
| 40 | +We can do this via the [Claude Desktop configuration file](https://claude.ai/docs/configuration). |
| 41 | + |
| 42 | +To find this file, first go to the settings page (`Cmd+,` on a Mac) and then click on the `Developer` tab on the left menu |
| 43 | +You'll then see the following screen, on which you'll need to click on the `Edit config` button: |
| 44 | + |
| 45 | +<Image img={ClaudeDesktopConfig} alt="Claude Desktop configuration" size="md" /> |
| 46 | + |
| 47 | +This will take you to a directory containing the configuration file (`claude_desktop_config.json`). |
| 48 | +The first time you open that file, it will likely contain the following content: |
| 49 | + |
| 50 | +```json |
| 51 | +{ |
| 52 | + "mcpServers": {} |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +The `mcpServers` dictionary takes in the name of an MCP Server as a key, and a dictionary of configuration options as a value. |
| 57 | +For example, the ClickHouse MCP server configuration connecting to the ClickHouse Playground would look like this: |
| 58 | + |
| 59 | +```json |
| 60 | +{ |
| 61 | + "mcpServers": { |
| 62 | + "mcp-clickhouse": { |
| 63 | + "command": "uv", |
| 64 | + "args": [ |
| 65 | + "run", |
| 66 | + "--with", |
| 67 | + "mcp-clickhouse", |
| 68 | + "--python", |
| 69 | + "3.10", |
| 70 | + "mcp-clickhouse" |
| 71 | + ], |
| 72 | + "env": { |
| 73 | + "CLICKHOUSE_HOST": "sql-clickhouse.clickhouse.com", |
| 74 | + "CLICKHOUSE_PORT": "8443", |
| 75 | + "CLICKHOUSE_USER": "demo", |
| 76 | + "CLICKHOUSE_PASSWORD": "", |
| 77 | + "CLICKHOUSE_SECURE": "true", |
| 78 | + "CLICKHOUSE_VERIFY": "true", |
| 79 | + "CLICKHOUSE_CONNECT_TIMEOUT": "30", |
| 80 | + "CLICKHOUSE_SEND_RECEIVE_TIMEOUT": "30" |
| 81 | + } |
| 82 | + } |
| 83 | + } |
| 84 | +} |
| 85 | +``` |
| 86 | + |
| 87 | +Once you've updated the config, you'll need to restart Claude Desktop for the changes to take effect. |
| 88 | + |
| 89 | +:::warning |
| 90 | +Depending how you installed `uv`, you might receive the following error when restarting Claude Desktop: |
| 91 | + |
| 92 | +``` |
| 93 | +MCP mcp-clickhouse: spawn uv ENOENT |
| 94 | +``` |
| 95 | + |
| 96 | +If that happens, you'll need to update the `command` to have the full path to `uv`. e.g. if you've installed via Cargo, it will be `/Users/<username>/.cargo/bin/uv` |
| 97 | +::: |
| 98 | + |
| 99 | +## Using ClickHouse MCP server {#using-clickhouse-mcp-server} |
| 100 | + |
| 101 | +Once you've restarted Claude Desktop, you can find the ClickHouse MCP server by clicking on the `Search and tools` icon: |
| 102 | + |
| 103 | +<Image img={FindMCPServers} alt="Find MCP servers" size="md" /> |
| 104 | + |
| 105 | +You can then choose whether to disable all or some of the tools. |
| 106 | + |
| 107 | +Now we're ready to ask Claude some questions that will result in it using the ClickHouse MCP server. |
| 108 | +For example, we could ask it `What's the most interesting dataset in the SQL playground?`. |
| 109 | + |
| 110 | +Claude will ask us to confirm the use of each tool in the MCP Server the first time that it's called: |
| 111 | + |
| 112 | +<Image img={MCPPermission} alt="Give permission to use the list_databases tool" size="md" /> |
| 113 | + |
| 114 | +Below you can see part of a conversation that includes some tool calls to the ClickHouse MCP Server: |
| 115 | + |
| 116 | +<Image img={ClaudeConversation} alt="Claude conversation" size="md" /> |
0 commit comments