Jetbrains AI SQL Server MCP

Published
Length
3 min read

Luis Felipe Dias

All posts

A jetbrains ai sql server mcp setup links your coding tool to your database. It lets an AI agent read schemas and run queries through a shared protocol. Developers use this link to write code faster and check table shapes right away. The agent sends a request to a local server, which then queries the database. This setup helps teams fix bugs fast, but it also creates new security risks. How a jetbrains ai sql server mcp workflow operates in practice The Model Context Protocol acts as a bridg

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.

A jetbrains ai sql server mcp setup links your coding tool to your database. It lets an AI agent read schemas and run queries through a shared protocol.

Developers use this link to write code faster and check table shapes right away. The agent sends a request to a local server, which then queries the database. This setup helps teams fix bugs fast, but it also creates new security risks.

How a jetbrains ai sql server mcp workflow operates in practice

The Model Context Protocol acts as a bridge between your editor and external data. Your IDE runs an AI agent that needs context about your tables and views. The agent talks to an MCP server, and that server talks to the database.

When the server logs in, it uses a database user identity to run commands. In SQL Server, a database user represents the login identity for that specific database. If a person needs to reach many databases on one instance, admins use a login in master.

If the tool only needs one or a few databases, admins have another option. They can set up a contained database user with its own password instead. This user does not tie back to a login in the master database. An admin must first turn on contained databases on the server and the database. SQL Server supports thirteen different types of database users for these tasks.

Once the MCP server logs in, the agent can ask for schema details. It can also run queries to check sample rows or test new logic. The server sends the database output right back into the chat window.

Security tradeoffs of static roles and active sessions

Most teams start by putting a static database key into a local config file. They try to limit risk by giving the AI user a fixed database role. In SQL Server, you cannot change the permissions assigned to fixed database roles. Every role, including the public role, comes with basic permission to connect.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

For example, members of the data reader role can read all user tables and views. That sounds safe for an AI tool, but it exposes every single row. If a table holds emails, phone numbers, card numbers, or national IDs, the agent gets them. The AI model then sends those raw values to an external cloud provider.

Admins can also use a deny data reader role to block table and view reads. They can use a deny data writer role to block adding, changing, or deleting data. By contrast, a data writer role lets a user add, delete, or change table data. Even worse, an owner role can run all maintenance tasks and drop the whole database.

Static roles apply the same broad rules to every query during an active session. They cannot inspect a single query from an AI agent and pause it for review. They also cannot mask sensitive fields on the fly before results leave the database. When every developer stores a shared database key on a laptop, rotation becomes hard. Audits also fail because the database log only shows one shared technical user.

How to control AI database queries in real time

To keep production data safe, teams need controls that work at the query level. Instead of handing out raw database keys, teams should route traffic through a central proxy. This removes static secrets from developer laptops and local config files right away.

A central layer links every AI query to a real person through single sign-on. Security teams can then see who ran each query and when it ran. Data masking rules can also run on query results before they reach the IDE. Masking rewrites matched fields like emails, phone numbers, and card numbers in the output. This lets the AI agent understand table structure while keeping private records safe.

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

What does an MCP server do for JetBrains AI and SQL Server?

It acts as a translator between the IDE assistant and your SQL Server instance. The AI asks for schema facts or query results, and the server runs those requests.

Is a read-only database role enough to secure AI agents?

No, because the standard data reader role allows reading all user tables and views. An AI agent can still pull sensitive emails, phone numbers, or card numbers into prompts.

How can teams protect sensitive columns during AI queries?

Teams can place a proxy with dynamic data masking in front of the database. Masking rewrites matched fields in results so raw private values do not reach the model.

The query runs. The emails stay hidden.