# How to connect ClickHouse to Hermes Agent (paste one key, 6 tools)

> Connect ClickHouse to Hermes with ClawLink: paste your ClickHouse key once and 6 tools work from chat. No MCP server to run, nothing stored on your machine.

Web version: https://claw-link.dev/hermes/clickhouse

Most guides for giving Hermes Agent ClickHouse access start with registering your own OAuth app or pasting API keys into env files, then leave the token refresh and tool wiring to you. ClawLink gives Hermes a more practical ClickHouse setup: pair once in the browser and your always-on Hermes agent can act on ClickHouse for you, reading and doing real work on your behalf with no auth, token refresh, or tool wiring to build yourself.

**Start here — paste this into Hermes to set up ClawLink:**

> Set up ClawLink for Hermes and tell me when it's ready.
> 1. Install the plugin: `hermes plugins install ClawLink-HQ/hermes-plugin --enable`
> 2. Start pairing with `hermes clawlink begin`. It prints an approval link, so show me the link and stop, don't wait.
> 3. I'll approve it in my browser, then reply "approved".
> 4. When I say approved, finish setup: `hermes clawlink finish`
> 5. Then run `hermes clawlink test` and tell me whether ClawLink is ready.

## Setup

It takes three steps to connect Hermes to ClickHouse.

1. **Install ClawLink** — add the plugin to Hermes Agent once.
2. **Connect ClickHouse** — one-click OAuth in the ClawLink dashboard.
3. **Use it from chat** — ask Hermes Agent in plain English.

**Alternative for any agent (no plugin needed):** if the Hermes Agent plugin route isn't available or doesn't work, any AI agent with shell access can use the ClawLink CLI instead:

```bash
npx -y @useclawlink/cli login          # sign in via browser — no API key to paste
npx -y @useclawlink/cli connect clickhouse  # connect ClickHouse (browser OAuth)
npx -y @useclawlink/cli actions clickhouse  # list available actions
npx -y @useclawlink/cli run clickhouse <action> --input '<json>'  # execute (add --confirm for writes)
```

### Install by command

The prompt above walks Hermes through this. By hand, it is four commands and a browser approval:

```bash
hermes plugins install ClawLink-HQ/hermes-plugin --enable
hermes clawlink begin    # prints an approval link — open it and approve
hermes clawlink finish   # after approving in the browser
hermes clawlink test
```

Then connect ClickHouse in the [ClawLink dashboard](https://claw-link.dev/dashboard) — enter your ClickHouse account details once.

Verify the connection by asking Hermes:

> Use clickhouse_list_databases and clickhouse_list_tables to give me an inventory: every database, and for each, its tables and approximate row counts where cheap to get.

### Using a different agent?

The Hermes plugin is one client of ClawLink's MCP server. Claude Code, Cursor, Codex, or any agent that can run a shell command pairs with the same ClawLink account through the CLI:

```bash
npx -y @useclawlink/cli login
```

`login` opens the same browser approval and stores a credential locally. Once ClickHouse is connected in the dashboard, that agent calls the same 6 ClickHouse tools over MCP. Full setup for MCP clients and shell agents: [connect apps to any AI agent](https://claw-link.dev/learn/connect-apps-to-any-ai-agent).

## ClickHouse MCP for Hermes

Looking for a ClickHouse MCP server for Hermes Agent? ClawLink connects ClickHouse to Hermes Agent and exposes 6 ClickHouse tools your agent can call over [MCP](https://claw-link.dev/learn/what-is-an-mcp-server), with [hosted auth](https://claw-link.dev/learn/oauth-for-ai-agents) and nothing to run or maintain yourself. Using OpenClaw instead? The [OpenClaw ClickHouse integration](https://claw-link.dev/openclaw/clickhouse) works the same way.

The search-engine answer for connecting ClickHouse to Hermes is a small infrastructure project: install the Composio CLI or edit `~/.hermes/config.yaml` with an MCP block, then gather host, port, username, and password. This page removes the infrastructure half. ClawLink connects ClickHouse with a hosted credential pair: you paste your ClickHouse Cloud Key ID and Key Secret, or a username and password for a self-managed server, once on the setup page, and Hermes gets six ClickHouse tools from chat with no MCP server configured anywhere and no credential file on your machine. Note the honest wording: this is not "no key", it is no credential management. The secret is held server-side, the agent never sees it, and rotating it means re-pasting in one place.

## What the Hermes Agent ClickHouse integration can do

6 ClickHouse tools are ready for Hermes Agent once the account is connected.

### All 6 ClickHouse tools for Hermes

| Tool | What it does |
|---|---|
| **Execute query** `clickhouse_execute_query` | Run a read-only SQL query in ClickHouse |
| **Get database schema** `clickhouse_get_database_schema` | Get a full schema overview for a ClickHouse database |
| **Get play interface** `clickhouse_get_play_interface` | Open the ClickHouse Play interface for interactive querying |
| **Get table schema** `clickhouse_get_table_schema` | Get detailed schema information for a ClickHouse table |
| **List databases** `clickhouse_list_databases` | List available ClickHouse databases |
| **List tables** `clickhouse_list_tables` | List tables in ClickHouse databases |

## Example prompts

**Map the warehouse**

> Use clickhouse_list_databases and clickhouse_list_tables to give me an inventory: every database, and for each, its tables and approximate row counts where cheap to get.

**Understand a table**

> Call clickhouse_get_table_schema on \<database.table> and tell me the columns, types, and primary key, then show me a sample of 3 rows via clickhouse_execute_query with LIMIT 3.

**Answer with SQL**

> Write and run a query against \<table> that answers: how many rows per day over the last 14 days? Use clickhouse_execute_query and show the result as a table.

**Profile before aggregating**

> Check clickhouse_get_database_schema for \<database> first, then propose the two queries you would run to find the most active tables. Run them only after I approve.

## How the ClickHouse tools behave

Details that decide whether a ClickHouse prompt is a clean answer or a grants-shaped error.

- **The surface is exactly six tools.** `clickhouse_execute_query`, `clickhouse_get_database_schema`, `clickhouse_get_play_interface`, `clickhouse_get_table_schema`, `clickhouse_list_databases`, `clickhouse_list_tables`. Every one is in the live manifest.
- **`clickhouse_execute_query` runs what the credentials allow.** That is the whole permission story: SELECT-only credentials make the integration read-only, and pasting broader ones does not.
- **Schema before rows.** `clickhouse_get_database_schema` and `clickhouse_get_table_schema` are cheaper and safer than ad-hoc `SHOW` and introspection queries, and they are what stop an agent guessing column names.
- **SQL is unparsed.** The tool sends the query through, so a malformed statement surfaces as a ClickHouse error, not a friendly one. Prompts should ask the agent to compose carefully and quote errors.
- **`SELECT currentUser()` and `SHOW GRANTS` are the diagnostic pair.** They are the first two queries when anything looks like a permissions problem, and they run through the same tool.
- **The play interface tool exists.** `clickhouse_get_play_interface` covers the web SQL surface, matching ClickHouse's own Play UI, and it was verified present in the manifest this run.

## ClawLink vs. building it yourself

The alternative to ClawLink is usually manual credential setup plus your own token handling, permission troubleshooting, and tool plumbing for Hermes Agent. That is fine if you want to build and maintain the integration yourself. Most teams just want ClickHouse working from chat.

| | Manual | ClawLink |
|---|---|---|
| **Setup flow** | Collect and store the right ClickHouse credentials yourself, then keep the account mapping and request format correct. | ClawLink keeps the setup in one hosted flow so non-technical users can link ClickHouse without custom integration screens. |
| **Ongoing maintenance** | You own refresh logic, permission debugging, environment config, and every provider-specific edge case for ClickHouse. | ClawLink handles the repetitive integration plumbing so your team can focus on the workflow instead of the infrastructure. |
| **Agent usability** | You still need to expose the right ClickHouse actions to the runtime in a format your agent can reliably use. | 6 tools for ClickHouse are already exposed through ClawLink, so the agent can read and act from chat immediately. |

## ClawLink vs. Composio

Composio also exposes ClickHouse to AI agents. It is developer infrastructure: Python and TypeScript SDKs, an MCP server, and a catalog past 1,000 apps, aimed at teams shipping agent products. ClawLink is built for Hermes Agent users instead. You install the plugin once, connect ClickHouse in the browser, and the 6 tools above work from chat. There is no SDK and no config file, and the ClickHouse key you paste at setup is stored server-side rather than kept in your environment. Choosing between them? Read the full [Composio alternatives](https://claw-link.dev/hub/composio-alternatives) comparison.

### Hermes paired but still can't use ClickHouse
Pairing is a two-step handshake: run `hermes clawlink begin`, approve the link in your browser, then run `hermes clawlink finish`. If you ran finish before approving, or the approval link expired, run `hermes clawlink begin` again to get a fresh link. Confirm the plugin was installed with `--enable`, then verify with `hermes clawlink test`.

### Connection succeeds but no tools appear
Reconnect ClickHouse from the dashboard, then start a fresh chat if the runtime still has the old tool catalog loaded.

### "Tool schema not loaded yet" error when calling ClickHouse tools
ClickHouse tool schemas load on demand the first time a tool runs and are cached after that, so this error usually clears on its own: wait a few seconds and retry the same request. If every ClickHouse call keeps failing with it in a fresh chat, reconnect from the dashboard, and contact support if it still persists — that pattern points to a configuration problem on our side, not something you can fix by reconnecting again.

### ClickHouse returns 403 or "permission denied" on one action while others work
Two usual causes. The connected account may not have access to the specific workspace, inbox, store, or project in the request — check that first. If access looks right, the agent may have sent a placeholder value (like "YOUR_ID" or an example id from documentation) instead of a real one: ask it to run a list or search tool first, then retry the action with a real id from those results. Most failures at this stage are one of these two, not ClawLink bugs.

### ClickHouse returns 403 "insufficient permissions" on a query
The old "workspace or inbox access" explanation never applied to ClickHouse; the real causes are grants, roles, and policies, and Perplexity's answer to this query is the map. A missing `SELECT` grant on the table is the first thing to check, and the diagnostics are two SQL statements the agent can run: `SHOW GRANTS` to see exactly what the connected user holds, and `SELECT currentUser()` to confirm which user the connection actually is, because pasting a key for user A while assuming user B is a classic hosted mistake. Beyond grants: RBAC roles that are not enabled for the user, row policies that silently filter or reject rows, host and network restrictions on the credential, and a wrong database or role in use for the session. Each of those has a different fix, so the agent should quote the error and run the diagnostics before anything is reconnected.

Ask the agent to diagnose it:

```text
Run SELECT currentUser() and SHOW GRANTS through clickhouse_execute_query and tell me exactly which user and grants this connection carries. Then quote the failing query's error. Do not retry the failing query yet.
```

### ClickHouse starts returning 429 or connection errors under load
ClickHouse Cloud documents platform rate limits on its Management API (the key-and-secret administration surface) and can return HTTP 429 when traffic exceeds what the plan allows; a self-managed server instead hits whatever its own settings cap, like `max_concurrent_queries`. An agent running one query per table across a large inventory is the traffic shape to watch, and the fix is to batch: schema reads before row reads, `LIMIT` on exploratory queries, and `clickhouse_get_database_schema` instead of ad-hoc `SHOW` runs. The 429 tells the agent when to retry, so have it report the response rather than hammering.

Ask the agent to diagnose it:

```text
Tell me how many queries you ran in the last minute and what you were inventorying. Quote the exact 429 or connection error. Do not query ClickHouse again until I reply.
```

### ClickHouse tools are missing, or one tool name is not found
The engines' answer to this symptom is self-hosted MCP mechanics: `uv` not on PATH, missing environment variables, not restarting the client. None of that exists in this flow, because there is no local MCP server to hydrate. The hosted causes are the two real ones: the connection or pairing is incomplete (confirm the plugin installed with `--enable`, both pairing commands ran, and ClickHouse shows as connected), or schemas load on demand, so the first ClickHouse call in a fresh session can arrive before the catalog and needs one retry. If most tools work and one name fails, that name is wrong rather than missing, and the error lists the closest real ones.

Ask the agent to diagnose it:

```text
List the ClickHouse tools you actually have access to. If there are none, say so plainly. If there are, tell me which one lists databases and use that exact name.
```

### The connection succeeds but queries return empty or stale results
A connection that works but returns nothing is usually a scoping problem, not a network one. The credentials may belong to a user whose grants cover the catalog but not the data: `SHOW DATABASES` succeeds while `SELECT` on a table the user cannot read returns an empty or filtered set, often because a row policy is silently constraining it. The second cause is the classic one with ClickHouse: querying the wrong database or cluster, or a schema that changed since the agent's last `clickhouse_get_table_schema` call, so its column list is stale. Have the agent re-run the schema tool and `SELECT currentUser()` before reconnecting, because neither of these fixes on the connection side.

Ask the agent to diagnose it:

```text
Run clickhouse_list_databases and tell me what the connection can see, then SELECT count() from the table in question and quote the exact result or error. Do not reconnect yet.
```

### The setup form accepts credentials but calls still fail
Re-enter the credentials carefully and verify the account-level permissions for ClickHouse. Basic and token-based integrations tend to fail on formatting mistakes or limited account roles.

### Is there a Hermes Agent ClickHouse integration?
Yes. ClawLink is the fastest way to connect Hermes to ClickHouse: link your ClickHouse account once in the browser and Hermes Agent can call the ClickHouse API through 6 ready-made tools — no custom code or token handling.

### How do I connect ClickHouse to Hermes with ClawLink?
Install the plugin with `hermes plugins install ClawLink-HQ/hermes-plugin --enable`, then pair once: run `hermes clawlink begin`, approve the link in your browser, and run `hermes clawlink finish`. Connect ClickHouse in the dashboard and Hermes can use it from the next message — no config files, and the ClickHouse key you paste is stored server-side instead of in your environment.

### How long does it take to connect ClickHouse to Hermes Agent?
About two minutes. Sign in, click Connect next to ClickHouse in the dashboard, authenticate, and Hermes Agent can use it from the next chat message.

### Why use ClawLink instead of wiring ClickHouse up myself?
The alternative to ClawLink is usually manual credential setup plus your own token handling, permission troubleshooting, and tool plumbing for Hermes Agent. That is fine if you want to build and maintain the integration yourself. Most teams just want ClickHouse working from chat.

### What credentials does this actually need?
ClickHouse's auth is not a single key. ClickHouse Cloud uses Key ID + Key Secret, sent as HTTP Basic credentials, generated in the Cloud Console under Organization Settings; a self-managed server uses a username and password instead. Both work here: paste whichever pair fits your setup into the hosted connect form once. This is why the page says a credential pair rather than "one key": anyone telling you ClickHouse takes a single API key is describing a different product. The pair is stored server-side, never written to a local env file, and re-pasting is the entire rotation story.

### Which ClickHouse do I have, Cloud or self-managed?
The engines ask this question back at searchers, because the two answer differently. ClickHouse Cloud is a hosted service where you create Key ID and Key Secret pairs in the console and connect over port 8443. Self-managed ClickHouse is software you run, connected with a username and password over port 8123 (HTTP) or 9000 (native), and it uses users.xml or SQL-based RBAC for access. This integration works with both, and the tool surface is the same; what differs is where the credentials come from and which permission model you are governed by.

### What can the agent do with six tools?
The six tools are the industry-standard query surface, not a toy set: `clickhouse_list_databases` and `clickhouse_list_tables` for inventory, `clickhouse_get_database_schema` and `clickhouse_get_table_schema` for structure, `clickhouse_execute_query` for SQL, and `clickhouse_get_play_interface` for the web SQL surface. Everything is query-shaped, which keeps the integration honest: the agent reads schemas, lists objects, and runs SQL with the account's permissions. For a database the size ClickHouse is built for, that small, well-defined surface is usually the right scope.

### Is the agent's SQL read-only?
The connection carries the permissions of the credentials you pasted, so the honest answer is: the agent can do whatever those credentials can do. If you paste a key pair with write and DDL rights, the agent can run write and DDL statements, and a malformed prompt is all it takes. The least-privilege setup is a credential pair scoped to SELECT, which makes the integration read-only in practice, and on ClickHouse Cloud that scoping happens through SQL grants on the key's user rather than anything in the connect form. Decide which user the pair belongs to before you paste it.

### Hermes paired but still can't use ClickHouse
Pairing is a two-step handshake: run `hermes clawlink begin`, approve the link in your browser, then run `hermes clawlink finish`. If you ran finish before approving, or the approval link expired, run `hermes clawlink begin` again to get a fresh link. Confirm the plugin was installed with `--enable`, then verify with `hermes clawlink test`.

## Related

- [Neon](https://claw-link.dev/hermes/neon) — Serverless Postgres with branching and scale-to-zero
- [Connect Box](https://claw-link.dev/hermes/box) — Store, share, and manage files and folders
- [Connect Supabase](https://claw-link.dev/hermes/supabase) — Query and manage Postgres databases
