How to Configure OpenHands ClickHouse MCP Server
To set up an openhands clickhouse mcp server, link your agent to a restricted database role. You pass the server details to the agent workspace and limit the database user to read-only queries. Many teams start by giving the AI agent a shared admin account to move fast. Broad permissions let an automated tool read sensitive columns or drop production tables by mistake. A safer setup uses strict database roles and tight column rules from day one. How to set up an openhands clickhouse mcp server
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 an openhands clickhouse mcp server, link your agent to a restricted database role. You pass the server details to the agent workspace and limit the database user to read-only queries. Many teams start by giving the AI agent a shared admin account to move fast. Broad permissions let an automated tool read sensitive columns or drop production tables by mistake. A safer setup uses strict database roles and tight column rules from day one.
How to set up an openhands clickhouse mcp server
Setting up the link between your coding agent and your analytics database takes two steps. First, you prepare a dedicated database user with strict limits inside ClickHouse. Second, you point the agent workspace to the local or remote tool server.
ClickHouse manages users, roles, row policies, settings profiles, and quotas through SQL commands. To turn on SQL access control, an admin sets a storage directory on the server. At least one admin account needs access management and named collection control turned on. From there, an admin with user creation rights can make a new profile for the agent. Remember that a database user can only grant rights that they already hold themselves.
When you create the agent account, you define how it logs in. You also set which hosts it can call from, its default roles, and its user settings. For an AI agent, you should only grant read permissions on the tables it needs.
ClickHouse lets you grant read access on single columns instead of whole tables. If you grant access to just two columns, the agent can only query those two fields. Queries that ask for other columns will fail right away. A wildcard query across all columns will also fail and return no data at all. That query only works if the table holds just the allowed columns. Since version 24.10, admins can also use a trailing asterisk to grant rights by table name prefix.
What native database roles solve and what they miss
Native database roles and column grants solve the first layer of risk. They decide who can log in and which tables or columns that account can read. If the agent tries to read a forbidden table, the database blocks the query. Setting host limits also stops someone from using that key from an unknown network.
ClickHouse Access Management + Kubernetes API Server Access: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Still, static database roles leave an operational gap during live agent runs. A role check happens when the agent logs in and starts a query. It does not inspect what happens inside the allowed columns while data flows back. For example, a text column or log table might hold emails, phone numbers, or card numbers. If the agent has read access to that column, every raw value goes into the model context.
Column grants can also break how an AI agent explores a schema. Agents often run broad discovery queries to see sample rows before writing a final report. Because ClickHouse blocks wildcard reads on partially restricted tables, the agent hits errors and gets stuck. Giving the agent full table access fixes the error, but it exposes sensitive fields like national IDs.
Finally, local tool setups require you to place database keys inside the agent runtime. If multiple developers run agents, you end up copying credentials across many machines. Static roles cannot ask a human for approval before a heavy query runs. They also cannot rewrite sensitive strings inside query results on the fly.
Add runtime guardrails and masking beside ClickHouse
Database grants and network rules control who can reach ClickHouse. Even so, an allowed client or agent can send an alter mutation that deletes rows or read raw personal data. In practice, hoop.dev runs beside the server as a sidecar for your ClickHouse and checks native TCP queries with no change to your drivers.
With hoop.dev ClickHouse support, guardrails refuse banned queries before they run, and data masking rewrites matched string columns in results. The audit trail logs which entity types were masked and how many without storing raw values. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
What permissions should an OpenHands agent have in ClickHouse?
Create a dedicated user with read-only access to specific tables or columns. Do not give the agent admin rights, write access, or broad user management permissions.
Why do wildcard queries fail when using ClickHouse column grants?
When you grant read rights on specific columns, ClickHouse blocks full wildcard queries on that table. The query returns no data unless the table contains only the granted columns.
How can teams protect sensitive data inside allowed ClickHouse columns?
Database roles only block whole columns, not specific values inside a text field. Using data masking rewrites matched fields like emails, phone numbers, and card numbers in query results.
Related guides
In this post