Blog
guide

How to Connect ClickHouse to Grok Bot Using Sequel

Musthaq Ahamad
Musthaq Ahamad
How to Connect ClickHouse to Grok Bot Using Sequel

ClickHouse answers aggregate questions over billions of rows in under a second, which makes it the backbone of a lot of product and event analytics. Grok Bot is xAI's bot builder, an agent that keeps context and reaches your tools through plugins. Point it at Sequel and the bot writes the ClickHouse SQL for you, including the GROUP BY you would have spent ten minutes getting right.

TL;DR

What you're connectingA ClickHouse Cloud or self-hosted cluster to Grok Bot
Setup timeAbout 5 minutes
Setup methodOne chat message. Grok Bot has no MCP config file
AuthOAuth to Sequel. No API key to paste anywhere
Access levelRead-only tools
Ports8443 for ClickHouse Cloud, 8123 for self-hosted HTTP
AvailabilityAccount-wide, including scheduled and background runs

What You'll Accomplish

Once this is wired up, you can ask your bot:

  • "What's the p95 page load time by country for the last 7 days?"
  • "Which event types grew fastest week over week across 2 billion rows?"
  • "Show hourly active sessions for yesterday, bucketed by device type."

Prerequisites

  • A Sequel account: sign up free at sequel.sh
  • A ClickHouse Cloud service or a reachable self-hosted cluster
  • A Grok account with a bot you can send messages to

Step 1: Connect ClickHouse to Sequel

Sign in to sequel.sh and open Data Sources.

Sequel Data Sources page

Click New Connection and choose ClickHouse.

Choose a connector

ClickHouse uses individual fields rather than a connection string:

FieldWhat to enter
Connection NameA memorable label, for example Events Cluster
HostYour hostname with no https:// prefix
Port8443 for ClickHouse Cloud, 8123 for self-hosted HTTP
UsernameOften default
PasswordThe password for that user
DatabaseThe database this connection should query

ClickHouse connection form

Click Connect. Sequel reads your table engines and column types so the bot knows what it is querying before it writes any SQL.

Add a connection instruction. ClickHouse bills you in scanned rows and wall-clock seconds, not just in money. In the connection settings, add an instruction like "always filter on event_date and never query without a time bound" and every generated query will honour it.

Step 2: Add Sequel to Grok Bot

Grok Bot has no MCP config file and no settings form to fill in. You add a server by asking the bot.

Open a chat with your bot and send this:

Add a custom MCP server called sequel at https://api.sequel.sh/mcp

Say custom server explicitly. Leave those words out and the bot searches the plugin marketplace instead of registering your endpoint.

Sequel's Grok Bot install card

The bot reads the name and URL back to you. Check both, confirm, and it posts a connect card in the chat. Click Authorize, sign in to Sequel, and approve access. The OAuth token stays on the connector side, so there is no API key to copy and nothing to keep in sync.

To confirm it registered, open Settings → Plugins → Yours. Every server on your account is listed there, including the ones you added by chat.

Grok's plugins panel

Then attach it to a task: type @ in the chat and pick sequel.

Using Grok chat rather than a bot? The steps do not carry over. On grok.com, open Plugins → New Connector → Custom, set the name to Sequel and the Server URL to https://api.sequel.sh/mcp, click Add Connector, and sign in.

Grok custom connector form

Step 3: Ask Grok Bot About Your ClickHouse Data

Attach @sequel and ask:

What are the top 10 event types by count in the last 24 hours?
Show p50, p95, and p99 request duration by endpoint for the last 7 days.
Compare daily unique users this week against the same week last month.

What You Can Do Now

  • Percentiles without the syntax: "What's the p99 latency by region?" instead of remembering quantile(0.99) argument order.
  • Scheduled anomaly checks: the bot can run the same aggregate every morning and only speak up when it moves.
  • Funnel and retention math: window functions over event tables, described in one sentence.
  • Schema discovery: "Which tables use ReplacingMergeTree, and what are their sorting keys?"
  • Cross-source joins: pair ClickHouse event volume with Stripe revenue or GA4 sessions in one answer.

Troubleshooting

SymptomLikely fix
The bot searched the marketplace instead of adding the serverResend the message with the words "custom server" in it.
The server is not listed under Settings → Plugins → YoursThe registration did not complete. Resend the message and confirm the name and URL when the bot reads them back.
The bot answers without touching your dataYou did not attach it. Type @ in the chat and pick sequel before asking.
Connection test failsDrop the https:// from the host field and confirm the port: 8443 for Cloud, 8123 for self-hosted HTTP.
Queries time outAdd a time filter. Tell Sequel in the connection instructions to always bound queries by the partition column.
Authentication errorConfirm the user exists on the service and that your IP is allowed in ClickHouse Cloud's IP access list.

Related Guides

Try Sequel

Build your company brain.

Sequel connects the systems your company runs on and learns how your team defines every metric, so any AI agent can answer from it. Free for up to 3 seats, no credit card required.

Get started free

Frequently asked questions

How do I add Sequel to Grok Bot?

Ask the bot. Send "add a custom MCP server called sequel at https://api.sequel.sh/mcp", confirm the name and URL it reads back, then click Authorize on the connect card and sign in to Sequel. Say "custom server" explicitly so the bot adds the endpoint instead of searching the plugin marketplace.

Do I need a Sequel API key for Grok Bot?

No. Sequel is a remote MCP server with OAuth. The bot posts a connect card, you authorize in the browser, and the token stays on the connector side. There is no key to paste into a chat.

Is this the same as Grok chat or Grok Build?

No, and the steps do not carry over. Grok chat on grok.com adds servers under Plugins, New Connector, Custom. Grok Build is the terminal coding agent and uses grok mcp add. Grok Bot is the bot builder, where you add servers by asking the bot.

Which port do I use for ClickHouse Cloud?

Use 8443, the HTTPS interface. Self-hosted ClickHouse over plain HTTP uses 8123. Enter the host without an https:// prefix.

Will the bot run queries that scan my whole table?

It can, which is why ClickHouse connections benefit from connection instructions. Tell Sequel to always filter on the partition or primary key column and the generated SQL will respect it.

Can Grok Bot insert or drop data in ClickHouse?

The connector ships read tools only. For a hard guarantee, connect with a ClickHouse user that has SELECT privileges and a readonly profile setting.

Can I query several ClickHouse databases?

Yes. A connection points at one database. Add a second connection for a second database and your bot can use both in a single question.

Written by

Musthaq Ahamad
Musthaq Ahamad

Co-founder and CEO of Sequel. Previously built developer tools and data infrastructure. Passionate about making data accessible for everyone.