How to Configure Windsurf SQL Server Read Only Access
You set up windsurf sql server read only access by creating a restricted database user. Then you connect that user to your AI coding agent through a local database tool. Many teams start by handing the agent their personal database login to save time. When roles are too broad, the agent can change or drop production tables by mistake. How windsurf sql server read only access works Cognition renamed Windsurf to Devin Desktop in June 2026, while keeping the same IDE features. Its agent runs ter
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 windsurf sql server read only access by creating a restricted database user. Then you connect that user to your AI coding agent through a local database tool. Many teams start by handing the agent their personal database login to save time. When roles are too broad, the agent can change or drop production tables by mistake.
How windsurf sql server read only access works
Cognition renamed Windsurf to Devin Desktop in June 2026, while keeping the same IDE features. Its agent runs terminal commands with user permission inside a dedicated shell. That shell loads the local user setup, including shell aliases and stored keys. The agent also connects to external Model Context Protocol servers to query databases. To limit what the agent can do, admins must restrict the SQL Server account itself.
SQL Server separates server logins from individual database users. A login in the master database lets a person or app reach the server instance. For access to many databases on one instance, admins map a login to database users. If the agent only needs one database, admins can create a contained database user instead. A contained user has its own password and is not tied to a master login. An admin must first enable contained databases on the server and the target database.
Once the user exists, you grant read access with fixed database roles. Adding the user to the datareader role lets it read all user tables and views. You cannot change the permissions built into fixed database roles. To block writes for sure, admins also add the user to the denydatawriter role. Members of that role cannot add, change, or delete data in any user table. Avoid the owner role, which can run maintenance tasks and drop the whole database.
What native roles solve and what they leave open
Fixed database roles do a good job of stopping accidental writes and table drops. Even if the AI agent invents a delete statement, the database engine blocks it. This setup decides who logs in and which broad actions that account can take. Still, native roles do not check what individual queries do while in flight.
A user in the datareader role can read every row in every user table by default. The agent can pull full customer tables, including emails, phone numbers, and card numbers. That raw data flows straight into the agent context and out to the model provider. Static database passwords also sit in local shell files on every developer machine. If an agent reads those local files during a task, the credentials can leak. Native roles also lack a clear way to tie each query to a specific developer.
Auditor Read-Only Access + Kubernetes API Server Access: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Steps to tighten database permissions for coding agents
Start by creating a dedicated SQL Server account just for your AI coding tools. Never let the agent share a login with a human engineer or an app service. If the agent only queries one database, use a contained database user to limit reach. Place the user in both the datareader role and the denydatawriter role right away.
If your tables hold sensitive columns, do not rely on the fixed datareader role alone. Instead, leave the user out of the datareader role and grant select on safe views. You can also add the user to denydatareader on sensitive schemas to block table reads. Review your local shell files to make sure admin passwords are not stored in plain text. Because the agent loads your shell setup, any exported secret is open to terminal commands.
Check SQL Server batches and results on the wire
SQL Server logins and roles decide who connects. They do not check what each TDS batch does or mask sensitive values in returned rows. With hoop.dev, you run an open-source proxy, a sidecar for your SQL Server, inline in the TDS wire protocol. On every batch an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
Before a batch hits the server, hoop.dev guardrails refuse disallowed actions with a native TDS error or hold risky statements for approval. On the way back, hoop.dev data masking rewrites sensitive values in supported result columns in memory, and every decision is logged. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Can Windsurf run database queries without an MCP server?
Yes, the agent can run terminal commands in a dedicated shell with user permission. Because the shell loads your local setup, it can run command-line database tools directly.
Does the SQL Server datareader role block all data changes?
The datareader role only grants read rights, so it does not include write access. To be certain the user cannot write through other permissions, add the denydatawriter role too.
Should I use a server login or a contained user for an AI agent?
Use a contained database user when the agent only needs one or a few databases. Use a SQL login in the master database when the user needs many databases.
Related guides
In this post