> For the complete documentation index, see [llms.txt](https://docs.ilert.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ilert.com/ai-and-agents/mcp/hosted/clickhouse.md).

# Clickhouse

Give an agent read-only access to ClickHouse schemas and server metrics through the ilert MCP connector.

#### Required permissions

<table><thead><tr><th width="177.515625">Tool</th><th width="178.515625">Required Permission</th><th>Description</th></tr></thead><tbody><tr><td><code>list_databases</code></td><td><code>read</code></td><td>List all databases in the ClickHouse cluster. Useful for discovering available databases.</td></tr><tr><td><code>list_tables</code></td><td><code>read</code></td><td>List all tables in a specific database. Useful for discovering available tables and their structure.</td></tr><tr><td><code>describe_table</code></td><td><code>read</code></td><td>Get detailed schema information about a table including columns, data types, and table engine settings.</td></tr><tr><td><code>get_metrics</code></td><td><code>read</code></td><td>Get ClickHouse metrics including system metrics, events, replicas, processes, merges, and mutations. Useful for spotting replication lag, stuck mutations, and long-running queries.</td></tr></tbody></table>

{% hint style="info" %}
The ClickHouse integration is read-only and does not expose an arbitrary SQL query tool. The agent can inspect schemas and read server metrics, but it cannot access your data.
{% endhint %}

#### Deploy the ilert MCP connector

ilert does not connect to your ClickHouse cluster directly. The ClickHouse MCP server calls the **ilert MCP connector**, a service you deploy in your own network and expose over a public HTTPS URL. Deployment, the auth token and all configuration options are on its own page:

{% content-ref url="/pages/cKuRiKPs7NQX5toTeOJo" %}
[ilert MCP connector](/ai-and-agents/mcp/ilert-mcp-connector.md)
{% endcontent-ref %}

Enable ClickHouse on the connector with these variables:

```bash
CLICKHOUSE_ENABLED=true
CLICKHOUSE_HOST=clickhouse.internal
CLICKHOUSE_PORT=9000
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=your_password
CLICKHOUSE_DATABASE=default
```

`CLICKHOUSE_PORT` is the native protocol port, not the HTTP one.

#### Connect ClickHouse with agent

To connect ClickHouse with your AI SRE agent:

{% stepper %}
{% step %}
Navigate to **Agents** in the ilert navigation menu
{% endstep %}

{% step %}
Open the agent detail view for the agent you want to configure
{% endstep %}

{% step %}
Go to the **Tools** tab
{% endstep %}

{% step %}
Under the **ilert hosted MCP servers** section, locate the **ClickHouse** card
{% endstep %}

{% step %}
Click **Connect** on the ClickHouse card
{% endstep %}

{% step %}
In the connection dialog that appears:

* **Select connector:** Choose "Create new connector" (or select an existing connector if you have one)
* **Type:** Select **Bearer Token** from the dropdown
* **Secret name:** Enter a name for your connector (e.g., "ClickHouse Production" or "ClickHouse Main")
* **Secret value:** Enter the `AUTH_TOKEN` value from your connector deployment
* **Host URL:** Enter the public URL where your connector is reachable (e.g., `https://ilert-mcp-connector.example.com`)
  {% endstep %}

{% step %}
Click **Connect** to complete the connection
{% endstep %}

{% step %}
After connecting, you can enable or disable specific tools needed for alert investigation, such as:

* `list_databases` - List all databases in the ClickHouse cluster
* `list_tables` - List all tables in a specific database
* `describe_table` - Get detailed schema information about a table
* `get_metrics` - Get system metrics, events, replicas, processes, merges, and mutations
  {% endstep %}
  {% endstepper %}

The ClickHouse integration is now connected and ready to use for root cause analysis.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ilert.com/ai-and-agents/mcp/hosted/clickhouse.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
