How to Configure Devin SQL Server MCP Server

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up a devin sql server mcp server, create a restricted database user. Then point your agent tool to that database with those login keys. Many teams start by reusing an admin login to save time during testing. That broad role lets the agent change data or drop the whole database. AI coding agents run queries fast and make their own choices during tasks. If a prompt goes wrong, an open role turns a bug into an outage. Setting up strict database roles is your first step toward safe agent run

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 a devin sql server mcp server, create a restricted database user. Then point your agent tool to that database with those login keys. Many teams start by reusing an admin login to save time during testing. That broad role lets the agent change data or drop the whole database.

AI coding agents run queries fast and make their own choices during tasks. If a prompt goes wrong, an open role turns a bug into an outage. Setting up strict database roles is your first step toward safe agent runs.

How to set up a devin sql server mcp server

Start by choosing how the agent will log in to the database engine. In SQL Server, a database user represents the identity of a login inside a database. Across the engine, SQL Server supports thirteen different types of database users.

If your agent needs many databases on one server, use a standard login. You create this login in the master database and map it to user accounts. If the agent only needs one database, a contained database user works well. This user has a password and is not tied to a master login. An admin must enable contained databases on the server and database first.

Next, assign the user to a fixed database role that fits the task. Every database role, including the public role, includes basic permission to connect. Note that you cannot change the permissions built into fixed database roles.

For safe agent inspection, add the user to the read-only data role. Members of this role can read all data from all user tables and views. If you want to block writes for sure, add the deny data writer role. That role stops the user from adding, changing, or deleting any table data.

Never give an AI agent the database owner role in your setup. The owner role can run all maintenance tasks and even drop the database. Once the user and roles are ready, pass the connection details to your agent.

What native roles solve and what they leave open

Native SQL Server roles decide who can log in and which tables they touch. Putting your agent in a read-only role stops accidental table drops and bad writes. It also blocks the agent from changing database settings during a debugging run.

Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, fixed roles apply the same broad rules across the entire database. A read-only role still lets the agent read every user table and view. You cannot edit a fixed role to hide specific columns with sensitive data.

When the agent queries a customer table, the database returns every column as stored. Sensitive fields like emails, phone numbers, card numbers, and national IDs flow back directly. They land in the agent workspace and get sent to the model provider.

If you need to block one table, you can use the deny reader role. That role blocks reading all user tables and views, which breaks normal agent work. Native roles also cannot pause a single risky query for a human to check. Once a user has the write role, it can delete rows in any table. The database checks identity at login, not the intent of each statement in flight.

Managing sensitive data and write queries

Teams often let agents fix data bugs or test schema changes in staging. Giving the agent the data writer role allows adds, changes, and deletes everywhere. One bad loop in an agent task can wipe out test tables in seconds.

To keep data safe, teams need controls that work on individual SQL queries. Masking rules that rewrite emails and card numbers in query results protect private records. Statement checks can also hold destructive queries until a developer approves the run.

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. It reads plain batches and parameterized queries on the TDS wire while passing Windows login through untouched.

Before a batch hits the server, hoop.dev guardrails check the statement against your rules. Disallowed actions get a native TDS error with your message. On the way back, hoop.dev data masking rewrites sensitive values in supported result columns that match your rules. Every query and decision is logged. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Which SQL Server role is safest for an AI coding agent?

Assign the fixed read-only role along with the deny data writer role. This pair lets the agent read user tables while blocking all data changes. Avoid the database owner role because it can drop the entire database.

Should I use a standard login or a contained database user?

Use a standard login in the master database when the agent needs many databases. Use a contained user when the agent only needs one or a few databases. An admin must enable contained databases on the server and database first.

Does the read-only role hide emails or card numbers from the agent?

No, the fixed read-only role grants read access to all user tables and views. Every column in those tables returns raw values, including emails and card numbers. You need column permissions or result masking to rewrite those sensitive fields.

The query runs. The emails stay hidden.