How to Configure Cursor SQL Server Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up cursor sql server approval, pair native database roles with AI agent tool checks. You create a restricted database user and require manual developer sign-off before the agent runs queries. Many teams start by giving the coding agent a shared database login. That approach creates high risk when roles have broad write permissions. A single bad prompt can change or delete production records before anyone notices. How cursor sql server approval works in native setups Setting up safe dat

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 cursor sql server approval, pair native database roles with AI agent tool checks. You create a restricted database user and require manual developer sign-off before the agent runs queries. Many teams start by giving the coding agent a shared database login. That approach creates high risk when roles have broad write permissions. A single bad prompt can change or delete production records before anyone notices.

How cursor sql server approval works in native setups

Setting up safe database access for an AI coding tool requires two separate layers. The first layer lives inside the database engine itself. Admins create a specific login or a contained database user for the agent. In SQL Server, a database user represents the identity of a login inside a database. Teams that need access across many databases often create a standard login in the master database. Teams that only need access to one database can use a contained database user instead. An admin must enable contained databases on the server and the database first.

Once the user exists, the admin assigns fixed database roles to limit what it can do. Adding the user to the read-only data reader role lets it read all user tables and views. Admins can also add a deny data writer role to block data additions, changes, or deletes. Fixed database role permissions cannot be changed in SQL Server. Every role, including the public role, includes basic connection rights. Admins should avoid the database owner role because it can perform all maintenance and drop the database.

The second layer lives inside the AI coding editor on the developer machine. Coding agents reach external databases through Model Context Protocol servers or local shell commands. When the agent wants to run a database tool or shell command, the editor pauses. It asks the developer to review and approve the action in the chat window. If the developer approves the request, the local tool sends the SQL statement using the saved database login.

What native database roles solve and what stays exposed

Native database roles and local editor prompts solve the first part of access control. Fixed read-only roles stop the agent from dropping tables or altering rows by mistake. Local tool prompts stop the agent from running background commands without the developer knowing. Together, they decide who can log in and when a tool can start.

Approval Chains & Escalation + Kubernetes API Server Access: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, this native setup leaves major operational gaps open during live work. First, local editor approval only relies on the person sitting at the keyboard. Developers get tired of reading pop-ups and often click approve without checking the full SQL text. Even worse, a developer might turn on auto-run settings to speed up their daily tasks. Second, the native read-only role grants read access to every user table and view in the database. If a table holds emails, phone numbers, card numbers, or national IDs, the query returns them in plain text. Data masking is needed to rewrite matched fields in results before they reach the local editor.

Third, teams often need the agent to run a safe write query or a schema update. If you grant the data writer role for one task, the agent can edit any user table. Native SQL Server roles cannot require a second human reviewer for a single update statement. The database only checks who logs in, not whether a peer approved that specific command in flight. Finally, local connection strings leave plain passwords sitting in config files on developer laptops.

Govern SQL Server queries and responses in flight

Table grants decide which SQL Server objects a caller may touch. They do not check query intent or rewrite sensitive values in results across every client and agent. By design, hoop.dev sits inline in the TDS wire protocol next to SQL Server as a sidecar for your SQL Server. On every production batch from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for approval.

With hoop.dev guardrails and hoop.dev data masking, banned statements are refused or held for review, matched sensitive fields in supported result columns are masked in memory, and each decision is logged. Check out the code on GitHub.

Frequently asked questions

Can a SQL Server read-only role block access to specific sensitive columns?

No, the standard fixed data reader role allows reading all data from all user tables and views. You cannot change the permissions assigned to fixed database roles to hide specific columns like card numbers.

Why is local prompt approval in the code editor not enough for production databases?

Local prompts only ask the developer who wrote the prompt to approve their own agent run. They do not enforce peer review from a team lead or block exposed credentials on the laptop.

Should I use a standard login or a contained user for AI agent database access?

Use a contained database user when the agent only needs access to one or a few databases. Use a login in the master database when the user needs access across many databases on the instance.

The query runs. The emails stay hidden.