SQL Server DBA (read-only)
Read-only MCP server giving AI assistants DBA-style health checks for SQL Server
SQL Server DBA (read-only) is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, macOS, Windows
- Runs
- Locally
- What it can do
- Can change data (1 tool)
- Access
- Needs a secret key or token
- Version
- 0.1.2
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add mssql-dba-mcp --env DB_AUTH_TYPE='<DB_AUTH_TYPE>' --env DB_HOST='<DB_HOST>' --env DB_NAME='<DB_NAME>' --env DB_USER='<DB_USER>' --env DB_PASSWORD='<DB_PASSWORD>' -- npx -y @shadow-dba/mssql-dba-mcpAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"mssql-dba-mcp": {
"command": "npx",
"args": [
"-y",
"@shadow-dba/mssql-dba-mcp"
],
"env": {
"DB_AUTH_TYPE": "<DB_AUTH_TYPE>",
"DB_HOST": "<DB_HOST>",
"DB_NAME": "<DB_NAME>",
"DB_USER": "<DB_USER>",
"DB_PASSWORD": "<DB_PASSWORD>"
}
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"mssql-dba-mcp": {
"command": "npx",
"args": [
"-y",
"@shadow-dba/mssql-dba-mcp"
],
"env": {
"DB_AUTH_TYPE": "<DB_AUTH_TYPE>",
"DB_HOST": "<DB_HOST>",
"DB_NAME": "<DB_NAME>",
"DB_USER": "<DB_USER>",
"DB_PASSWORD": "<DB_PASSWORD>"
}
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"mssql-dba-mcp": {
"command": "npx",
"args": [
"-y",
"@shadow-dba/mssql-dba-mcp"
],
"env": {
"DB_AUTH_TYPE": "<DB_AUTH_TYPE>",
"DB_HOST": "<DB_HOST>",
"DB_NAME": "<DB_NAME>",
"DB_USER": "<DB_USER>",
"DB_PASSWORD": "<DB_PASSWORD>"
}
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"mssql-dba-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@shadow-dba/mssql-dba-mcp"
],
"env": {
"DB_AUTH_TYPE": "<DB_AUTH_TYPE>",
"DB_HOST": "<DB_HOST>",
"DB_NAME": "<DB_NAME>",
"DB_USER": "<DB_USER>",
"DB_PASSWORD": "<DB_PASSWORD>"
}
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add mssql-dba-mcp --env DB_AUTH_TYPE='<DB_AUTH_TYPE>' --env DB_HOST='<DB_HOST>' --env DB_NAME='<DB_NAME>' --env DB_USER='<DB_USER>' --env DB_PASSWORD='<DB_PASSWORD>' -- npx -y @shadow-dba/mssql-dba-mcpOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.mssql-dba-mcp]
command = "npx"
args = ["-y", "@shadow-dba/mssql-dba-mcp"]
env = { DB_AUTH_TYPE = "<DB_AUTH_TYPE>", DB_HOST = "<DB_HOST>", DB_NAME = "<DB_NAME>", DB_USER = "<DB_USER>", DB_PASSWORD = "<DB_PASSWORD>" }Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"mssql-dba-mcp": {
"command": "npx",
"args": [
"-y",
"@shadow-dba/mssql-dba-mcp"
],
"env": {
"DB_AUTH_TYPE": "<DB_AUTH_TYPE>",
"DB_HOST": "<DB_HOST>",
"DB_NAME": "<DB_NAME>",
"DB_USER": "<DB_USER>",
"DB_PASSWORD": "<DB_PASSWORD>"
}
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "mssql-dba-mcp": { "command": "npx", "args": [ "-y", "@shadow-dba/mssql-dba-mcp" ], "env": { "DB_AUTH_TYPE": "<DB_AUTH_TYPE>", "DB_HOST": "<DB_HOST>", "DB_NAME": "<DB_NAME>", "DB_USER": "<DB_USER>", "DB_PASSWORD": "<DB_PASSWORD>" } } } }Or run: gemini mcp add -s user -e DB_AUTH_TYPE='<DB_AUTH_TYPE>' -e DB_HOST='<DB_HOST>' -e DB_NAME='<DB_NAME>' -e DB_USER='<DB_USER>' -e DB_PASSWORD='<DB_PASSWORD>' mssql-dba-mcp npx -- -y @shadow-dba/mssql-dba-mcp
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "mssql-dba-mcp": { "command": "npx", "args": [ "-y", "@shadow-dba/mssql-dba-mcp" ], "env": { "DB_AUTH_TYPE": "<DB_AUTH_TYPE>", "DB_HOST": "<DB_HOST>", "DB_NAME": "<DB_NAME>", "DB_USER": "<DB_USER>", "DB_PASSWORD": "<DB_PASSWORD>" } } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "mssql-dba-mcp": { "command": "npx", "args": [ "-y", "@shadow-dba/mssql-dba-mcp" ], "env": { "DB_AUTH_TYPE": "<DB_AUTH_TYPE>", "DB_HOST": "<DB_HOST>", "DB_NAME": "<DB_NAME>", "DB_USER": "<DB_USER>", "DB_PASSWORD": "<DB_PASSWORD>" } } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "mssql-dba-mcp": { "command": "npx", "args": [ "-y", "@shadow-dba/mssql-dba-mcp" ], "env": { "DB_AUTH_TYPE": "<DB_AUTH_TYPE>", "DB_HOST": "<DB_HOST>", "DB_NAME": "<DB_NAME>", "DB_USER": "<DB_USER>", "DB_PASSWORD": "<DB_PASSWORD>" } } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "mssql-dba-mcp": { "command": "npx", "args": [ "-y", "@shadow-dba/mssql-dba-mcp" ], "env": { "DB_AUTH_TYPE": "<DB_AUTH_TYPE>", "DB_HOST": "<DB_HOST>", "DB_NAME": "<DB_NAME>", "DB_USER": "<DB_USER>", "DB_PASSWORD": "<DB_PASSWORD>" } } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "mssql-dba-mcp": { "command": "npx", "args": [ "-y", "@shadow-dba/mssql-dba-mcp" ], "env": { "DB_AUTH_TYPE": "<DB_AUTH_TYPE>", "DB_HOST": "<DB_HOST>", "DB_NAME": "<DB_NAME>", "DB_USER": "<DB_USER>", "DB_PASSWORD": "<DB_PASSWORD>" } } } }The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.
Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "mssql-dba-mcp": { "command": "npx", "args": [ "-y", "@shadow-dba/mssql-dba-mcp" ], "env": { "DB_AUTH_TYPE": "<DB_AUTH_TYPE>", "DB_HOST": "<DB_HOST>", "DB_NAME": "<DB_NAME>", "DB_USER": "<DB_USER>", "DB_PASSWORD": "<DB_PASSWORD>" } } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "mssql-dba-mcp": { "command": "npx", "args": [ "-y", "@shadow-dba/mssql-dba-mcp" ], "env": { "DB_AUTH_TYPE": "<DB_AUTH_TYPE>", "DB_HOST": "<DB_HOST>", "DB_NAME": "<DB_NAME>", "DB_USER": "<DB_USER>", "DB_PASSWORD": "<DB_PASSWORD>" } } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
Configuration
DB_AUTH_TYPEsql or windows (NTLM)RequiredDB_HOSTSQL Server host name or IPRequiredDB_NAMEDatabase to connect to, for example masterRequiredDB_USERRead-only login (see README, Permissions)RequiredDB_PASSWORDPassword of the loginRequiredDB_PORTServer portTRUST_SERVER_CERTIFICATEtrue accepts a self-signed certificate
About SQL Server DBA (read-only)
Connects AI coding assistants and chat clients to a SQL Server instance through 42 tools that inspect it the way a database administrator would. Covered areas include wait statistics, slow queries and their cached plans, blocking, index usage, backup status, CHECKDB history, SQL Agent jobs, the error log and instance configuration.
Every tool reads system views and DMVs, and the server refuses to start under a sysadmin or db_owner login. A lexer also vets the one free-form query tool so that only a single SELECT or WITH statement gets through. The AI can propose an index, a setting or a script, but a person decides whether to run it.
The server is aimed at DBAs and developers who want an assistant to triage performance problems or review server hygiene without giving it write access. Table row data stays out of reach by default; granting it is a separate, optional step described in the documentation.
Tools this server provides (12)
Taken from the project documentation; the running server may differ.
From the tool list in its README, going by the names, 1 of 12 tools changes data; 10 names don't say.
From the server's own tool labels and tool names; not verified by us.
- mssql_server_version
- Version, edition, patch level, collation, HADR, licensing.
- mssql_wait_stats
- Top wait types, optionally sampled over a window.
- mssql_top_queries
- Top queries by CPU, reads, memory grant, spills, duration or executions.
- mssql_run_selectName suggests: changes
- One read-only SELECT written by the AI, max 500 rows.
- mssql_execution_plan
- Cached plan XML for a plan handle.
- mssql_running_requests
- Active requests with CPU, reads, waits and blocking.
- mssql_blocking
- Blocked sessions and their blockers.
- mssql_recent_backups
- Latest Full, Diff and Log backup per database.
- mssql_checkdb_statusName suggests: reads
- Last good CHECKDB per database and suspect pages.
- mssql_agent_failed_jobs
- Agent jobs that failed in the last 7 days.
- mssql_db_index_health
- Index usage, fragmentation, fill factor and maintenance script per index.
- mssql_db_missing_indexes
- Ranked missing-index suggestions.
What it does
- Health check tools
- Version, wait stats, memory, I/O latency, TempDB and storage checks in one pass.
- Query performance analysis
- Ranks top queries by CPU, reads, spills and duration and returns cached plan XML.
- Live blocking view
- Shows active requests, blocked sessions and the sessions blocking them.
- Index and schema review
- Reports unused or fragmented indexes, missing index suggestions, untrusted keys and risky column types.
- Backup and CHECKDB status
- Lists latest backups per database, last good CHECKDB and suspect pages.
- Agent job monitoring
- Reviews SQL Agent jobs, schedules, recent failures and alert configuration.
- Enforced read-only access
- Startup check rejects admin logins and a SQL-level lexer blocks writes in the free-form query tool.
Good for
- Running a routine health check on a SQL Server instance from an AI assistant
- Diagnosing why a server is slow right now by reviewing waits and blocking
- Finding unused or missing indexes on a specific table before a tuning session
- Confirming that backups and CHECKDB runs are current across databases
- Reviewing SQL Agent jobs that failed in the past week
Pricing
Open source
Free and MIT licensed; self-hosted.
SQL Server DBA (read-only) FAQ
Can the AI change data or settings through SQL Server DBA (read-only)?
The setup script grants only view permissions and SELECT on a few msdb tables, and the server refuses to start under sysadmin, CONTROL SERVER or db_owner logins. Tools run fixed read-only SQL, and the free-form query tool rejects anything that writes or changes the session.
Can the AI read rows from my application tables?
Not by default. The setup script does not grant row access, so the query tool works against system views and DMVs. Row access can be granted separately, and the documentation explains the data-handling implications.
Which SQL Server versions are supported?
The README lists SQL Server 2016 and later, Azure SQL Managed Instance and Azure SQL Database. Azure SQL Database only exposes the database named in DB_NAME, and instance-level tools are unavailable there.
How do I connect SQL Server DBA (read-only) to my MCP client?
Add the server with npx using the @shadow-dba/mssql-dba-mcp package and set the database host, name, read-only login and password as environment variables. Claude Code, Claude Desktop, Cursor and VS Code are covered by the README examples.
Is SQL Server DBA (read-only) free?
Yes. SQL Server DBA (read-only) is open source, so you can use and self-host it for free.
How do I add SQL Server DBA (read-only) to Claude Code?
Run this command in your terminal: claude mcp add mssql-dba-mcp --env DB_AUTH_TYPE='<DB_AUTH_TYPE>' --env DB_HOST='<DB_HOST>' --env DB_NAME='<DB_NAME>' --env DB_USER='<DB_USER>' --env DB_PASSWORD='<DB_PASSWORD>' -- npx -y @shadow-dba/mssql-dba-mcp
What are the best alternatives to SQL Server DBA (read-only)?
The closest alternatives to SQL Server DBA (read-only) are SQL Server, MCP Sql Querystore, mssql-readonly-mcp, SqlServerMcp and SQL Server MCP (Windows).
Where this comes from
- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.