How to Configure Goose ClickHouse MCP Server

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up a goose clickhouse mcp server, connect your local agent to a restricted database user. You pass your host details and user credentials to the tool so the agent can run queries. Most teams start this setup by sharing an admin account during early testing. That shortcut gives the AI agent wide rights to read sensitive tables or alter data. A safe setup needs strict database roles before the agent sends its first query. Setting up your goose clickhouse mcp server with SQL roles Your fi

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

To set up a goose clickhouse mcp server, connect your local agent to a restricted database user. You pass your host details and user credentials to the tool so the agent can run queries. Most teams start this setup by sharing an admin account during early testing. That shortcut gives the AI agent wide rights to read sensitive tables or alter data. A safe setup needs strict database roles before the agent sends its first query.

Setting up your goose clickhouse mcp server with SQL roles

Your first step is turning on SQL-driven access control in your database. This feature requires a storage directory on the server to save your rules. You also need at least one user with access management turned on. Once active, you manage users, roles, row policies, settings profiles, and quotas with SQL.

Creating a new user for the agent requires the create user privilege. Keep in mind that a user can only grant privileges that they hold themselves. When you create the agent account, you define how it logs in. You can also restrict which hosts the user may connect from. Assigning default roles and user settings at creation time keeps the account locked down.

Next, you limit what the goose clickhouse mcp server can read. ClickHouse lets you grant read rights on specific columns in a table. If you grant read access on two columns, the user can query only those two columns. Queries for other columns will fail right away. A select-all query is also refused and returns no data at all. It only works if the table contains just the granted columns. In newer database versions, a trailing asterisk grants rights by table name prefix.

Where native database roles fall short for AI agents

Database users and column grants solve the first part of the security puzzle. They control which account logs in and which columns remain off limits. Static grants work well when your team knows every safe column ahead of time.

Real analytics tables are rarely that clean. A table might hold order totals next to customer emails, phone numbers, and card numbers. If you block the column, the agent loses context or breaks its own select-all queries. If you grant the column, raw emails and national IDs flow straight into the model prompt.

ClickHouse Access Management + Kubernetes API Server Access: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Native roles also treat every allowed query the same way once the session starts. They decide who logs in, not what each query does in flight. Teams also hate storing plain database keys in local agent files on every laptop. When ten developers run local agents, rotating shared keys becomes a weekly chore.

Managing agent query risks in production

Running an AI agent against analytics data requires checks on every single statement. Agents often write wide queries to explore schemas before answering a user question. Without runtime checks, a valid read role can still pull millions of rows at once. Teams need a way to inspect queries and mask sensitive fields in results.

Check ClickHouse queries and result columns on the wire

ClickHouse users and row policies decide who connects. They do not check each statement on the wire or redact sensitive string columns in query results. With hoop.dev, you run an open-source proxy, a sidecar for your ClickHouse. It reads ClickHouse's native TCP protocol before queries run while ClickHouse stays in charge of login and grants.

Multi-statement queries and table mutations are split and checked by hoop.dev guardrails. Banned actions are refused with a native ClickHouse error. On returned rows, hoop.dev data masking rewrites String and FixedString columns that match your rules. The audit trail logs each query, table, and verdict. See the MIT-licensed source on GitHub.

Frequently asked questions

What happens when the agent runs a select-all query on restricted columns?

ClickHouse refuses a select-all query when the user only has grants for specific columns. The query returns no data unless the table contains only those granted columns.

How do I turn on SQL access control in ClickHouse?

You must configure a storage directory on the server to hold access entities. You also need at least one user with access management and named collection control enabled.

Can a database user grant permissions to the agent account?

Yes, if that user holds the create user privilege and the specific rights being shared. In ClickHouse, a user can only grant the privileges that they have themselves.

The query runs. The emails stay hidden.