How to Configure Claude Code CockroachDB Approval
You set up claude code cockroachdb approval by pairing manual tool checks with strict database roles. This setup asks a human to review commands before the agent touches your data. Many teams start by giving the agent a broad database login on a local machine. That shortcut lets an automated agent drop tables or read private user records by mistake. How claude code cockroachdb approval works in practice Claude Code reaches external databases in two main ways. First, it uses the Model Context
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 claude code cockroachdb approval by pairing manual tool checks with strict database roles. This setup asks a human to review commands before the agent touches your data. Many teams start by giving the agent a broad database login on a local machine. That shortcut lets an automated agent drop tables or read private user records by mistake.
How claude code cockroachdb approval works in practice
Claude Code reaches external databases in two main ways. First, it uses the Model Context Protocol, also known as MCP, to reach tools and databases. The official docs show a PostgreSQL setup using the DBHub MCP server and a connection string. Since CockroachDB speaks the PostgreSQL wire protocol, teams follow this exact pattern. The docs tell you to put a read-only database user in that connection string. Then the queries the agent runs cannot change or delete your data. You must also check that you trust each MCP server before you use it.
Second, the agent can run shell commands through its built-in Bash tool. In Manual mode, the Bash tool pauses and asks for your approval before it runs. Only a small built-in list of safe read commands runs without a prompt. When the agent tries to call a database client in the shell, Manual mode stops it. The developer must read the command on screen and approve it by hand.
What native controls solve and what they miss
Combining Manual mode with a read-only database role solves basic safety problems. The read-only role stops the agent from deleting rows or changing schemas through MCP. Manual mode stops the agent from running surprise shell scripts against your cluster. These two steps give solo developers a basic safety net during local coding sessions.
Still, native client checks leave big gaps for engineering teams. Manual mode relies on the person sitting at the keyboard to read every prompt with care. When a developer gets tired, they often click approve without checking the full query. Also, an MCP server uses one static login string for the whole session. The database only checks who logs in at the start, not what each query does next.
A read-only user can still pull thousands of customer emails, phone numbers, or card numbers. If those results return in plain text, they go straight into the model context. Native settings also do not give security teams a central log of every query. And if the agent needs to run one safe write query, a read-only role blocks it. Teams then switch back to a write role, which puts the whole cluster at risk again.
Claude Code Security + Approval Chains & Escalation: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
How to tighten your database workflow
To keep data safe, start by removing admin keys from local developer machines. Create a dedicated role in your cluster that only reads the tables the agent needs. Keep Manual mode turned on so the Bash tool never runs database commands on its own.
Next, think about how your team handles sensitive columns and rare write tasks. Local prompts on one laptop do not scale when ten engineers use coding agents at once. You need a way to check individual statements in flight and mask fields like national IDs.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev sits inline in the protocol beside each supported service as an open-source proxy, a sidecar for your database or API. For every query or command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human approval.
First, hoop.dev guardrails block banned queries before they run or hold risky ones for review, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
How does Claude Code talk to a CockroachDB cluster?
It connects through an MCP server using a database login string, or by running shell commands. Both paths let the agent send SQL queries and read the output in your coding session.
Does Manual mode stop all bad database queries?
Manual mode asks for approval before the Bash tool runs a command. Still, it depends on the user reading the query closely, and MCP tools may have separate rules.
Why does the vendor tell you to use a read-only database user?
The vendor docs advise using a read-only user in your MCP connection string for safety. This rule makes sure the queries the agent runs cannot change or delete your stored data.
Related guides
In this post