# How to connect ClickHouse to AI agents?

Connect a cloud-hosted ClickHouse database to Sequel and query it in natural language from the app or any MCP client.

Connect a cloud-hosted ClickHouse database to Sequel and ask analytical questions in plain English — from the Sequel app or any AI tool wired up to the [MCP server](/docs/install). This works with ClickHouse Cloud and self-managed ClickHouse running on a host Sequel can reach over the internet.

## What you'll need

- A **cloud-hosted ClickHouse** server reachable over the internet (ClickHouse Cloud or self-managed).
- The **host**, **port**, **database**, **username**, and **password** for the server.
- A user with **read access** to the databases you want to query.

<Callout type="tip" title="Use a read-only user">
Create a dedicated read-only user for Sequel. It's the simplest way to guarantee queries can't modify your data, and it scopes access to just the tables you intend to expose.
</Callout>

## Connect it

<Steps>
<Step title="Open a new connection">
In the Sequel dashboard, go to **Connections → New connection** and choose **ClickHouse**.
</Step>

<Step title="Enter your connection details">
Fill in each field:

<CodeBlock language="bash" label="Connection details">host: your-instance.clickhouse.cloud
port: 8443        # ClickHouse Cloud. Self-managed HTTP is usually 8123
username: default
password: ••••••••
database: default</CodeBlock>

For ClickHouse Cloud, use the secure HTTP port **8443**. Self-managed servers typically expose plain HTTP on **8123**.
</Step>

<Step title="Allow Sequel through your firewall">
Sequel connects to your server from a fixed set of IP addresses. If your server restricts inbound traffic, add Sequel's egress IPs to the allowlist so the connection test can reach it. In ClickHouse Cloud, add them under **Settings → IP Access List**.

The exact IPs to allowlist are shown on the connection screen — copy them from there.
</Step>

<Step title="Test and save">
Sequel pings the server, verifies the credentials, and reads your schema. A green check means it's live.
</Step>
</Steps>

## What you can query

Once connected, Sequel can list the databases on your server, read every table's columns and types, and run read-only SQL against them — so you can ask questions across any database you've granted access to.

## Try it

Once connected, ask things like:

- "How many events did we receive per hour yesterday?"
- "What's the funnel conversion rate from signup to first purchase?"
- "Show me the top 10 users by event count this week."
- "Which event types have increased most in the last 7 days?"

## Troubleshooting

| Symptom | Likely fix |
| --- | --- |
| Connection test times out | The server isn't reachable from the internet, or a firewall is blocking Sequel — add Sequel's egress IPs (shown on the connection screen) to your allowlist. In ClickHouse Cloud, that's **Settings → IP Access List**. |
| Authentication failed | Double-check the username and password, and confirm the user is allowed to connect from Sequel's network. |
| Empty schema or "unknown database" | Verify the **database** name and make sure the user has read access to the tables you want to query. |

## Related

- [Connecting your first data source](/docs/connecting-your-first-data-source)
- [Chatting with your data](/docs/chatting-with-your-data)
- [Browse all integrations](/docs/integrations)
