How to Configure Claude Code Redshift Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up claude code redshift read only access, connect an MCP server with a read-only database user. You can also let the agent run database tools through its local shell. Many teams start by sharing their own personal login keys with the AI agent. When those keys have broad write rights, one bad query can drop tables or change live rows. Setting up a dedicated read-only role stops the agent from changing data. How claude code redshift read only access works Claude Code reaches outside syst

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 claude code redshift read only access, connect an MCP server with a read-only database user. You can also let the agent run database tools through its local shell. Many teams start by sharing their own personal login keys with the AI agent. When those keys have broad write rights, one bad query can drop tables or change live rows. Setting up a dedicated read-only role stops the agent from changing data.

How claude code redshift read only access works

Claude Code reaches outside systems and databases in two main ways. The first way uses the Model Context Protocol, also called MCP. MCP servers let the agent reach your tools, APIs, and databases. Official docs list database querying as a core use case with the DBHub MCP server. You pass a database string to the MCP server on your machine. The vendor docs tell you to use a read-only database user in that string. That way, the queries the agent runs cannot change your stored data.

The second way uses the built-in Bash tool to run shell commands. In Manual mode, the agent asks for your approval before it runs most shell commands. Only a small built-in list of safe read-only file and git commands run without prompts. If the agent uses a command-line database client, you must check each command before it runs. The vendor docs also warn you to trust each MCP server before you use it.

Setting up the native database role

Your database admin needs to create a dedicated user role in the data warehouse. That role should only have select rights on the specific schemas the agent needs. Do not grant permission to insert, update, delete, or drop any objects. Next, create a new database user for the coding agent and assign the read-only role. You then place those login details into your local MCP server setup.

When the agent needs schema details or sample rows, it sends a request to the MCP server. The MCP server logs into the warehouse with the restricted user and runs the select query. If the agent tries to run a write statement, the database engine blocks it right away.

What native read-only roles miss in daily work

A read-only database role is a good first step for safety. It controls who can log in and blocks changes to your tables. Still, native database roles do not inspect what individual queries do in flight. A read-only user can still read every column inside an allowed table by default. Those columns often hold raw emails, phone numbers, card numbers, or national IDs. Once the query runs, those sensitive values flow straight back into the agent context.

Auditor Read-Only Access + Claude Code Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Static database strings also create key management chores for your team. Engineers have to store database passwords on their laptops to run the local MCP server. If a laptop gets lost or a config file leaks, that database password is exposed. Also, database logs only show that the shared read-only user ran a query. They do not link each query back to the specific engineer who prompted the agent.

Finally, read-only rights do not stop heavy queries from hurting warehouse performance. An agent can still run a huge join across billion-row tables by mistake. Manual shell prompts help, but engineers get tired of reading long queries and click approve. Teams need controls that mask sensitive fields in results and tie every query to a real user.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.

Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.

Frequently asked questions

How does Claude Code connect to a Redshift database?

It connects through a database MCP server like DBHub or by running CLI tools in its Bash tool. Both paths need a valid database login string to reach the cluster.

Why should I use a read-only database user for an AI agent?

A read-only user ensures the queries the agent runs cannot modify or delete your data. Even if the model writes a drop or update statement, the database rejects it.

Does a read-only role stop sensitive data from reaching the model?

No, a read-only role still returns full rows from any table it can read. You need data masking to rewrite emails, phone numbers, or card numbers in query results.

The query runs. The emails stay hidden.