How to Configure JetBrains AI SQL Server MCP Server

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a jetbrains ai sql server mcp server by linking your local IDE assistant to a database service. That service uses a dedicated SQL account with strict role permissions to run queries. Teams often start by reusing an admin account during initial testing. This shortcut gives the AI assistant the power to change tables or read private records. A safe setup uses a restricted database user and clear role limits from day one. How a jetbrains ai sql server mcp server works The Model Contex

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 a jetbrains ai sql server mcp server by linking your local IDE assistant to a database service. That service uses a dedicated SQL account with strict role permissions to run queries. Teams often start by reusing an admin account during initial testing. This shortcut gives the AI assistant the power to change tables or read private records. A safe setup uses a restricted database user and clear role limits from day one.

How a jetbrains ai sql server mcp server works

The Model Context Protocol lets your IDE assistant talk to external data tools. Your local MCP server takes prompts from the IDE and turns them into SQL queries. It then logs in to your database, runs the query, and sends results back.

In SQL Server, a database user represents the identity of a login inside a database. When a person or tool needs many databases on one instance, admins create a login in master. They then map a SQL user to that login.

If the MCP server needs only one database, a contained database user is another option. A contained user has its own password and does not tie to a login in master. An admin must first turn on contained databases on the server and the target database. SQL Server supports thirteen types of database users in total.

Once you create the user, you assign a fixed database role. All roles, including the public role, have the base permission to connect. You cannot change the permissions built into fixed database roles.

Native role limits and what they leave open

Most teams assign the db_datareader fixed role to their AI tool account. Members of db_datareader can read all data from all user tables and views. If you want to block writes for sure, you can also add the db_denydatawriter role. Members of db_denydatawriter cannot add, modify, or delete data in any table.

You should avoid the db_datawriter and db_owner roles for automated coding assistants. The db_datawriter role can add, delete, or change data across all user tables. The db_owner role can run all maintenance tasks and can even drop the database.

Kubernetes API Server Access + AI Agent Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Native SQL roles solve the basic login problem. They decide who can log in and which broad actions they can take. Still, fixed roles do not check what individual queries do while they run.

Because db_datareader reads every user table, the assistant can still fetch sensitive columns. A simple select query can pull emails, phone numbers, card numbers, or national IDs into your chat window. Native roles also do not stop a bad query from scanning millions of rows at once. To fix this, teams need controls that inspect statements and mask matched fields in results.

Steps to lock down your database setup

Start by creating a dedicated SQL user just for your IDE assistant. Do not share this account with web apps or human admins. Next, place the user in the db_datareader role and the db_denydatawriter role.

If a specific table holds secrets, remember that db_datareader reads all user tables by default. You can use the db_denydatareader role if an account must not read any user tables or views. For finer control, grant read rights only on the exact views the assistant needs.

Store your database password in your local system keychain instead of plain text files. Rotate that key on a regular schedule. Check your database logs often to see which queries the assistant runs.

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 is an open-source proxy that sits next to SQL Server as a sidecar for your SQL Server. It inspects TDS batches and parameterized queries in real time.

With hoop.dev guardrails and hoop.dev data masking, banned statements are refused with your message. Matched sensitive fields in supported result columns are masked in memory, and each decision is logged per listener. Check out the code on GitHub.

Frequently asked questions

Which SQL Server role is safest for an MCP server?

The db_datareader role paired with db_denydatawriter is the safest standard starting point. It lets the assistant read user tables and views while blocking all data changes.

Should I use a login in master or a contained user?

Use a contained database user if the assistant only needs one or a few databases. Use a login in master if the tool must query many databases across the instance.

Can db_datareader hide specific columns like emails or card numbers?

No, members of db_datareader can read all data in all user tables and views. To hide emails, phone numbers, card numbers, or national IDs, you need restricted views or result masking.

The query runs. The emails stay hidden.