A SQL Server MCP server that answers like a DBA
DBA Brain MCP gives Claude and other AI agents the tools a DBA reaches for on a SQL Server: is it up and usable, what is it running now, who is blocking whom, what does this table look like, what would this query cost. A request names a server, never a password - the login comes from the encrypted store on your machine - and the tools that only read answer without a key.
Six questions a SQL Server DBA answers every day
Is it up and usable?
db-status answers with a verdict - OK, WARNING or CRITICAL - at instance, database and schema depth, instead of rows the agent has to judge. list-objects says what exists and the state the engine reports.
What is it running now?
db-activity lists the requests running now, the blocking, the waits, and the top queries since their plans were cached. trace-session finds every open transaction: its age, the log it has written, the locks it holds and who it blocks.
What does this table look like?
table-info gives the columns, the indexes - keys, included columns, filters - the row count and the space reserved; object-source the definition of a procedure, function, view or trigger. The agent reads them before it writes a query.
What would this query cost?
query-plan returns the estimated plan from SHOWPLAN_XML - compiled, never run - with its estimated cost, top operators and missing indexes. A batch that would switch the showplan off and run what follows is refused.
Run this SELECT
run-sql runs one SELECT and always rolls back; run-sql-write keeps a change only with commit. Both run with the rights of the login your machine stores, so they are marked destructive: give the machine a login that can only read.
Is it safe to patch?
sqlserver-cu-check reads every gate before a cumulative update: admin rights, disk, a pending reboot, the installer's signature and SHA-256, a standalone instance, databases online, a recent full backup, running jobs and sessions, and the maintenance window.
The agent names a server; your machine does the rest
No password in the context
A request names a server_id, and your machine fills the login from its encrypted store. A request carrying a password, a key or a token is refused, and every answer is redacted.
Changes ask first
A tool that changes something - run-sql-write, kill-spid, a backup or a restore - is marked destructive, needs a dbabrain key and asks for its own confirmation. The tools that only read answer without a key.
A record of every call
Your machine records each call - the tool, the server, who asked - in its own store, beside the metrics, backups and job runs the agent can read without collecting them again.
Install, name your servers, add it to your agent
The MCP server runs on your machine and talks to the agent over stdin and stdout - nothing from DBA Brain goes on the network. claude.ai on the web or a phone reaches it through the connector instead (every step).
pip install "dbabrain[mssql,mcp]" dbabrain init claude mcp add dbabrain --env DBABRAIN_HOME=D:/dbabrain -- dbabrain mcp serve
Between the second and the third line, your SQL Servers go into data/db_instances.json and their
logins into the encrypted store: the MCP setup, and
everything else DBA Brain does.
Questions asked first
Does it install anything on the SQL Server?
No agent, no extension, no stored procedure. DBA Brain runs on a machine of its own and reaches each server with the login you give it; the tools that read run plain queries against the system views.
Which AI clients does it work with?
Claude Code, Claude Desktop and any client that speaks MCP start dbabrain mcp serve on the same machine. claude.ai on the web or a phone uses the connector at mcp.dbabrain.dev, linked from your machine with dbabrain mcp connect.
Does it work beyond SQL Server?
The same tools answer for PostgreSQL, Oracle and MySQL, each with its own SQL; query-plan covers PostgreSQL and MySQL with EXPLAIN but not Oracle, and sqlserver-cu-check is SQL Server's own. All 94 tools.
Can someone set it up for us?
Yes - setting up DBA Brain on your servers, and SQL Server work in general, are among the DBA work we do: see what we do.