How to Configure Cursor ClickHouse Permissions

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up cursor clickhouse permissions by creating a restricted database user with SQL roles. Then you give that read-only login to your AI coding agent or Model Context Protocol server. Many teams start by handing the agent a default admin account to move fast. That broad role lets an automated prompt drop tables or read every private column. How cursor clickhouse permissions work in SQL ClickHouse manages users, roles, row policies, settings profiles, and quotas as SQL access items. To tu

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.

You set up cursor clickhouse permissions by creating a restricted database user with SQL roles. Then you give that read-only login to your AI coding agent or Model Context Protocol server. Many teams start by handing the agent a default admin account to move fast. That broad role lets an automated prompt drop tables or read every private column.

How cursor clickhouse permissions work in SQL

ClickHouse manages users, roles, row policies, settings profiles, and quotas as SQL access items. To turn on SQL access control, the server needs a storage path for these rules. At least one admin account must hold the user management flag enabled. An admin can only grant rights that they already hold themselves.

Creating a new user takes the user creation privilege on the server. When you create the account for Cursor, you define how it logs in. You can also lock down which host addresses the agent can connect from. In the same step, you attach default roles and specific user settings.

To keep the AI agent safe, you grant read rights on specific columns only. When you grant select rights on two columns, the agent can query only those fields. Any query that asks for another column fails right away. A full wildcard select query also fails unless the table has only those allowed columns. In ClickHouse 24.10 and newer, a trailing asterisk grants rights by table name prefix.

How AI coding agents reach your database

AI coding tools like Cursor reach external data through Model Context Protocol servers or shell commands. An MCP server acts as a bridge between the editor and your database tables. You place the ClickHouse user login string inside the local MCP setup. Vendor guides tell teams to use a read-only database user in that login string. That way, the queries the agent runs cannot change or delete stored data.

Agents can also run database client tools through a local shell tool. If a developer stores a high-level login in a local file, the shell tool uses it. You must verify that you trust each MCP server before you run it locally.

ClickHouse Access Management + AI Agent Permissions: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native database roles solve and what they miss

Native ClickHouse roles and column grants solve the first part of the security problem. They decide who can log in and which tables or columns that account can read. If an agent tries to write data or read a blocked column, ClickHouse stops it. Quotas and settings profiles also help limit how much server memory a bad query uses.

Still, static database roles leave a big gap during daily work. A login role checks who connects, not what each query returns in flight. Developers often share one static database password across multiple laptops to save setup time. That shared key sits in plain text inside local editor files.

Even a read-only column grant can expose sensitive text inside allowed fields. A valid select query can pull thousands of emails, phone numbers, card numbers, or national IDs. Once the database sends those rows back, the raw values enter the AI model context. Native ClickHouse grants cannot rewrite matched fields in results on the fly. They also cannot pause a risky query to ask a human for approval in Slack.

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, inline in ClickHouse's native TCP protocol. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Multi-statement queries and table mutations are split and checked by hoop.dev guardrails, which refuse banned actions with a native ClickHouse error or hold risky ones for approval. On returned rows, hoop.dev data masking rewrites String and FixedString columns in memory, and the audit trail logs each query and verdict. See the MIT-licensed source on GitHub.

Frequently asked questions

Can I restrict Cursor to read only specific ClickHouse columns?

Yes, ClickHouse lets you grant select rights on individual columns in a table. If the AI agent runs a wildcard select query on that table, ClickHouse refuses the request.

Why should I avoid using the default ClickHouse user with AI agents?

The default user often holds broad rights to read all tables and change data. A bad prompt could cause the agent to alter data or pull private customer records.

How do I grant access to a group of tables in ClickHouse?

Since version 24.10, you can add a trailing asterisk to a table name prefix. This lets you grant select rights across related tables in one statement.

The query runs. The emails stay hidden.