mssql-dba-mcp
This is a read-only SQL Server DBA MCP server exposing 42 tools for inspecting SQL Server health, performance, configuration, and schema design without modifying the database.
Check server version, timezone, configuration flags, storage capacity, error logs, and privileged logins.
Diagnose current and historical performance with wait stats, top queries, cached execution plans, running requests, blocking, memory pressure, buffer hit ratio, disk I/O latency, and TempDB health.
Review database inventory, database settings, backups, CHECKDB status, suspect pages, VLF counts, autogrowth issues, owners, and SQL Agent jobs, failures, and alerts.
Assess schema and index health: tables, keys, index usage/fragmentation, missing indexes, foreign keys, check constraints, identity headroom, collation mismatches, and risky column types.
Run a single read-only SELECT against system views/DMVs using mssql_run_select, capped at 500 rows; it cannot modify data, schema, or settings, and cannot read your tables by default.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mssql-dba-mcp Why is the server slow right now? Check wait stats and blocking."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mssql-dba-mcp is an MCP server. It gives Claude Code, Claude Desktop, Cursor, VS Code and other MCP clients 42 tools to look at a SQL Server the way a DBA does: health checks, wait stats, slow queries and their plans, blocking, indexes, backups, CHECKDB, Agent jobs, the error log, configuration, security and schema design.
It only looks. The AI can suggest a fix (an index, a setting, a script), but you decide whether to run it.
Quick start
You need Node.js 20.12 or later and a SQL Server 2016+, Azure SQL Managed Instance or Azure SQL Database.
1. Create a read-only login. Run the setup script as a sysadmin. The server refuses to start with sa or any other admin login.
2. Add the server to your MCP client. Claude Code:
claude mcp add mssql-dba \
-e DB_AUTH_TYPE=sql -e DB_HOST=localhost -e DB_NAME=master \
-e DB_USER=shadow-dba -e DB_PASSWORD='YourStrongPasswordHere' \
-- npx -y @shadow-dba/mssql-dba-mcpOther clients (Claude Desktop, Cursor, VS Code) use the same command in their JSON config:
{
"mcpServers": {
"mssql-dba": {
"command": "npx",
"args": ["-y", "@shadow-dba/mssql-dba-mcp"],
"env": {
"DB_AUTH_TYPE": "sql",
"DB_HOST": "localhost",
"DB_NAME": "master",
"DB_USER": "shadow-dba",
"DB_PASSWORD": "YourStrongPasswordHere"
}
}
}
}To keep the password out of the client config, leave out env and put the same values in a .env file in the folder the client starts the server from (see .env.example). The server reads ./.env itself.
3. Ask. For example: "Run a health check on this server", "Why is the server slow right now?" or "Which indexes on dbo.Posts in StackOverflow are never used?"
Want ready-made DBA skills (health check, plan analysis, index review) on top of these tools? Use the shadow-dba CLI: npx shadow-dba workspace init sets up a Claude Code workspace with this server and the skills.
Related MCP server: Microsoft SQL Server MCP Server
Safety: read-only in three layers
A read-only login, checked at startup. The setup script grants only
VIEWpermissions andSELECTon a few msdb tables; nothing that can write, and nothing that reads rows from your own tables. At startup the server checks the login and refuses to run if it is a member ofsysadmin, hasCONTROL SERVER, or isdb_ownerinDB_NAME. This is the real guarantee: SQL Server itself blocks every change, whatever the AI sends.Tools that only read. 41 of the 42 tools run fixed SQL written in this repo. They read system views and DMVs. They never run DBCC CHECKDB, never run the query behind a plan, and never change a setting.
A strict check on the AI's own SQL.
mssql_run_selectruns a query the AI writes. A lexer checks it first: exactly one statement, it must start withSELECTorWITH, and any word that writes, runs code or changes the session (INSERT,UPDATE,EXEC,SET,USE,SELECT INTO,DBCC,BACKUP, ...) rejects it. Strings, quoted names and comments cannot hide code. This matters because tool output contains text other people control (query text from the plan cache, error-log lines, object names), and a prompt injection in that text could ask the AI to send a crafted query.
Layer 3 is a second line of defense, not the guarantee. If you run with a privileged login (MSSQL_ALLOW_PRIVILEGED_LOGIN=true), a bypass of layer 3 could change your data. Found a bypass? See SECURITY.md.
What the AI can see: metadata (names of databases, tables, columns, indexes, logins, jobs), server settings, query text in the plan cache and running requests (it can contain literal values), error-log lines and Agent job messages. By default it cannot read rows from your own tables, and it cannot see job step commands in msdb, which can hold passwords. Giving it table data is a separate decision with real consequences: see Business data.
Tools
Every tool is read-only. Output is Markdown, capped at 200 rows per table and 40,000 characters per reply, with a "Showing N of M" note when something was cut. Database tools take an optional databaseName (default: DB_NAME).
Start here
Tool | What it returns |
| Version, edition, patch level, collation, HADR, licensing. First call in a health check. |
| Top wait types. |
| Top queries by CPU, reads, memory grant, spills, duration or executions, with plan handles. |
| One read-only |
Performance, now
Tool | What it returns |
| Cached plan XML for a plan handle (never runs the query). |
| Active requests: CPU, reads, waits, blocking, statement. |
| Blocked sessions and who blocks them. |
| Page Life Expectancy. |
| Buffer cache hit ratio. |
| Read/write latency per database file, rated. |
| TempDB files, space use, top sessions. |
Instance health
Tool | What it returns |
| Server time, UTC offset. |
| Drives with less than 10% free space. |
|
|
| SQL Server or Agent error log, filtered, newest first. |
| Every database: state, recovery model, compatibility, size. |
| Databases that are not ONLINE. |
| Risky database settings (auto shrink, page verify, Query Store, ...). |
| Databases not owned by |
| Latest Full, Diff and Log backup per database. |
| Last good CHECKDB per database, suspect pages. |
| Databases with too many virtual log files. |
| Files with percent, tiny or disabled autogrowth. |
| SQL Agent jobs, schedules, last run. |
| Agent jobs that failed in the last 7 days. |
| Alerts for errors 823/824/825 and severities 19-25, operators. |
| Members of |
One database
Tool | What it returns |
| State, recovery model, compatibility, size. |
| Default collation. |
| Columns with a different collation. |
| Every table: rows, size, keys, index health, workload. |
| Every index: usage, fragmentation, fill factor, maintenance script. |
| Missing-index suggestions, ranked. |
| Backups of the last 7 days. |
| Heaps, tables without a primary key. |
| Untrusted, disabled or unindexed foreign keys, likely missing ones. |
| Untrusted or disabled check constraints, with the fix. |
| Identity columns close to their type limit. |
| Deprecated and risky column types, too-wide rows. |
| Details for the given tables ( |
| Index health for the given tables. |
| Missing indexes for the given tables. |
Permissions
Run one of these scripts as a sysadmin. Each creates the login and grants what the tools need. Permissions are server-wide: database tools can look at any database, including ones created later. The scripts can run again: an existing login or user is kept (with its password) and only the grants are applied.
SQL Server login (DB_AUTH_TYPE=sql)
USE [master];
GO
IF SUSER_ID(N'shadow-dba') IS NULL
CREATE LOGIN [shadow-dba] WITH PASSWORD = 'YourStrongPasswordHere';
GO
GRANT VIEW SERVER STATE TO [shadow-dba];
GRANT VIEW ANY DEFINITION TO [shadow-dba];
GRANT CONNECT ANY DATABASE TO [shadow-dba];
-- Error log access. SQL Server 2022+ and Managed Instance have a permission for it;
-- 2016-2019 need EXECUTE on the procedure that reads the log (it only reads).
IF CAST(SERVERPROPERTY('ProductMajorVersion') AS INT) >= 16
OR SERVERPROPERTY('EngineEdition') = 8
EXEC (N'GRANT VIEW ANY ERROR LOG TO [shadow-dba];');
ELSE
BEGIN
IF USER_ID(N'shadow-dba') IS NULL
EXEC (N'CREATE USER [shadow-dba] FOR LOGIN [shadow-dba];');
EXEC (N'GRANT EXECUTE ON xp_readerrorlog TO [shadow-dba];');
END;
GO
-- msdb: SELECT on exactly the tables the tools read. No Agent roles: SQLAgentReaderRole
-- can create and change jobs.
USE [msdb];
GO
IF USER_ID(N'shadow-dba') IS NULL
CREATE USER [shadow-dba] FOR LOGIN [shadow-dba];
GO
GRANT SELECT ON dbo.backupset TO [shadow-dba];
GRANT SELECT ON dbo.backupmediafamily TO [shadow-dba];
GRANT SELECT ON dbo.suspect_pages TO [shadow-dba];
GRANT SELECT ON dbo.sysjobs TO [shadow-dba];
GRANT SELECT ON dbo.sysjobhistory TO [shadow-dba];
GRANT SELECT ON dbo.sysjobschedules TO [shadow-dba];
GRANT SELECT ON dbo.sysschedules TO [shadow-dba];
GRANT SELECT ON dbo.sysalerts TO [shadow-dba];
GRANT SELECT ON dbo.sysoperators TO [shadow-dba];
GRANT EXECUTE ON dbo.agent_datetime TO [shadow-dba];
-- Job step commands can hold passwords. Not granted; the DENY keeps them hidden even if
-- someone later adds a wider grant such as SELECT ALL USER SECURABLES.
DENY SELECT ON dbo.sysjobsteps TO [shadow-dba];
GOThen set DB_USER=shadow-dba and DB_PASSWORD=YourStrongPasswordHere.
Windows login (DB_AUTH_TYPE=windows)
Same script with CREATE LOGIN [DOMAIN\shadow-dba] FROM WINDOWS; instead of the CREATE LOGIN line, and [DOMAIN\shadow-dba] instead of [shadow-dba] everywhere (MACHINE\shadow-dba for a local account). Set DB_USER and DB_PASSWORD to that account's name and password (NTLM cannot reuse your logged-in session), and DB_DOMAIN for a domain account.
Azure SQL Database
There are no server permissions and no msdb. Run this in the database you set as DB_NAME (a contained user, so use DB_AUTH_TYPE=sql):
IF USER_ID(N'shadow-dba') IS NULL
CREATE USER [shadow-dba] WITH PASSWORD = 'YourStrongPasswordHere';
GRANT VIEW DATABASE STATE TO [shadow-dba];
GRANT VIEW DEFINITION TO [shadow-dba];What each permission is for
Permission | Used for |
| Instance DMVs: waits, requests, memory, blocking, I/O, plan cache, VLFs. |
| Schema and index metadata in every database; the full member list for |
| Enter every database (current and future) without a user in each one. |
|
|
|
|
msdb | Hides Agent job step commands, which can hold passwords, even if a wider grant is added later. |
msdb | Backups and suspect pages ( |
msdb | Converts Agent run dates and times. A plain function that reads nothing; the same login works for the shadow-dba agent. |
None of these can change data, schema or settings, and none of them reads rows from your own tables.
Limits (on purpose)
Lifting these would need permissions that are not read-only, or that expose your data, so the scripts do not grant them.
mssql_checkdb_statuson builds older than SQL Server 2016 SP2 / 2017 CU9 can only read the date from the database header (DBCC DBINFO, needssysadminordb_owner). Those databases showUNKNOWN.mssql_run_selectcannot read rows from your tables. System views and DMVs are enough for most DBA work, and this keeps business data away from the AI. To allow it for a specific task, read Business data first.Azure SQL Database sees only the database in
DB_NAME. Instance tools (Agent, backups, error log, CHECKDB, logins) say they are not available there.
Business data (optional, read before you grant)
The setup script does not let the AI read rows from your tables. mssql_run_select can query system views and DMVs, which is enough for most DBA work. Sometimes a DBA needs the data itself: the values behind a slow query, a skewed column, a count of rows that match a filter. You can grant that, but it is a decision about your data, not about this tool, and it is not reversible for data the AI has already seen.
What happens when you grant it
Every row the AI selects leaves SQL Server and goes to the model as tool output. Depending on your MCP client and AI provider, it may be sent to a third party, stored in chat history and logs, and kept under that provider's retention terms. Check those terms before you grant anything.
The AI chooses which tables to query. Tool output contains text other people control (query text, object names, error-log lines). A prompt injection in that text can ask the AI to read and repeat sensitive rows. The read-only guarantee stops changes; it does not stop reading.
Tables often hold more than you remember: personal data, health and payment data, credentials, API keys, salaries, legal documents. A server-wide grant covers all of them, in every database, including databases created later.
Privacy and legal. Personal data in your tables is regulated (GDPR, UK GDPR, CCPA/CPRA, HIPAA, PCI DSS, and local laws). Sending it to an AI provider is a disclosure to a processor: you may need a data processing agreement with that provider, a lawful basis, an updated record of processing, a data protection impact assessment, and the approval of your data protection officer or legal team. Customer and vendor contracts can forbid it outright. If you cannot say who can see the data after it leaves SQL Server, do not grant this. You are responsible for that check; this project cannot make it for you.
If you decide to grant it
Prefer the smallest grant: one table or schema, in one database, over a server-wide grant.
Prefer a masked or anonymised copy, a non-production environment, or a view that hides sensitive columns. Dynamic Data Masking and Row-Level Security still apply to this login (it has no
UNMASK), but only if you set them up.Grant it for one task and revoke it when the task is done. Do not leave it in place.
Turn on SQL Server Audit for the login so you know what was read.
Tell the people whose data it is, if your policies or the law require it.
Smallest grant (one table or schema, one database):
USE [YourDatabase];
IF USER_ID(N'shadow-dba') IS NULL
CREATE USER [shadow-dba] FOR LOGIN [shadow-dba];
GRANT SELECT ON dbo.Posts TO [shadow-dba]; -- one table
-- GRANT SELECT ON SCHEMA::dbo TO [shadow-dba]; -- or one schemaWidest grant (every user table and view, in every database, now and in the future; SQL Server 2014+ and Managed Instance):
USE [master];
GRANT SELECT ALL USER SECURABLES TO [shadow-dba];Azure SQL Database (one database, every table and view):
ALTER ROLE db_datareader ADD MEMBER [shadow-dba];Revoke with the same statement and REVOKE instead of GRANT (ALTER ROLE db_datareader DROP MEMBER on Azure SQL Database). The login is still read-only with any of these grants: it cannot change a row. Job step commands in msdb (sysjobsteps) stay hidden; the setup script denies them because they can hold passwords.
Other optional grants
Not part of the setup script. Each one is still read-only, but each one also exposes data, so the warnings above apply. Grant it for one task and revoke it after.
Grant | What it allows |
| Read SQL Server Audit files with |
In one database: | Read Change Data Capture tables in that database (who changed which rows, and when). These tables hold copies of the changed rows. |
Revoke with the same statement and REVOKE instead of GRANT.
Configuration
Variable | Default | Description |
| (required) |
|
| (required) | Server name or IP. |
| (required) | Database to connect to. Database tools default to it. |
| (required) | Login name. |
| (required) | Login password. |
|
| Server port. |
| Windows auth with a domain account only. | |
|
| Encrypt the connection. |
|
|
|
|
| Query timeout in ms. |
|
| Connection pool size and idle timeout (ms). |
|
|
|
Values come from the MCP client's env block, or from ./.env in the server's working directory. The client's values win.
Development
npm install
npm test # unit tests, no database needed
npm run build # compiles to build/
npm run smoke # calls every tool once against the server in .env (after build)
# and checks the bypass payloads are rejectedSee CONTRIBUTING.md. Report security problems privately, as described in SECURITY.md.
License
MIT © shadow-dba
Available Tools
42 toolsmssql_agent_alertsGet SQL Agent Alerts HealthARead-onlyIdempotent
SQL Agent alerts: checks alerts for corruption errors 823/824/825 and severities 19-25 and whether an enabled operator gets them, and lists all alerts and operators. Missing corruption alerts become CRITICAL when msdb.dbo.suspect_pages has rows. Not available on Azure SQL Database.
Inputs: no named parameters.
mssql_agent_failed_jobsGet Failed SQL Agent JobsARead-onlyIdempotent
SQL Agent failed jobs: jobs that failed in the last 7 days, with date, time and error message. Not available on Azure SQL Database.
Inputs: no named parameters.
mssql_agent_jobsGet SQL Agent Scheduled JobsARead-onlyIdempotent
SQL Agent jobs: every job with its schedule, frequency, interval and last run status. Not available on Azure SQL Database.
Inputs: no named parameters.
mssql_all_db_infoGet All Databases InfoBRead-onlyIdempotent
All databases on the instance: state, recovery model, compatibility level, data and log size, read-only, auto close, auto shrink, page verify, create date.
Inputs: no named parameters.
mssql_autogrowth_issuesGet File Autogrowth IssuesARead-onlyIdempotent
Autogrowth issues: data and log files with percent growth, tiny growth (1 MB or less) or autogrowth off, largest files first. Not available on Azure SQL Database.
Inputs: no named parameters.
mssql_blockingGet Current Blocking and LockingARead-onlyIdempotent
Blocking and locking now: blocked sessions with the blocking session, wait type, wait time and query text. An empty result means no blocking.
Inputs: no named parameters.
mssql_buffer_hit_ratioGet Buffer Cache Hit RatioBRead-onlyIdempotent
Buffer cache hit ratio (%). Below 95% suggests too little memory for the workload.
Inputs: no named parameters.
mssql_checkdb_statusGet DBCC CHECKDB StatusARead-onlyIdempotent
CHECKDB and corruption: the last known good DBCC CHECKDB date per online database (flags never, or more than 7 days ago) and the rows in msdb.dbo.suspect_pages (corruption already found). Never runs CHECKDB. Databases the login cannot read show UNKNOWN. Not available on Azure SQL Database.
Inputs: no named parameters.
mssql_db_backup_historyGet DB Backup HistoryARead-onlyIdempotent
Backup history of one database in the last 7 days: type, start and finish, duration, size, compressed size and file location. Not available on Azure SQL Database.
Inputs: databaseName.
mssql_db_check_constraintsGet DB Check Constraint HealthARead-onlyIdempotent
Check constraints that are untrusted or disabled, with the ALTER TABLE ... WITH CHECK CHECK CONSTRAINT fix. The optimizer ignores untrusted constraints, and they may hide invalid rows. For foreign keys use mssql_db_foreign_keys.
Inputs: databaseName.
mssql_db_collationGet Database CollationARead-onlyIdempotent
Database collation: the default collation of one database. Use with mssql_db_collation_mismatches for collation conflict errors.
Inputs: databaseName.
mssql_db_collation_mismatchesGet Collation MismatchesARead-onlyIdempotent
Collation mismatches: columns (dbo schema) whose collation differs from the database default. A common cause of collation conflict errors in joins with temp tables.
Inputs: databaseName.
mssql_db_column_design_issuesGet DB Column Design IssuesBRead-onlyIdempotent
Column design issues: deprecated types (text, ntext, image), risky types (datetime, float, real, sql_variant) with a suggested type, and tables whose maximum row width is over 6000 bytes (near the 8060-byte row limit).
Inputs: databaseName.
mssql_db_config_healthGet Databases Config HealthARead-onlyIdempotent
Database settings health for every online user database: compatibility level, recovery model, page verify, auto close, auto shrink, auto statistics, target recovery time and Query Store, with Flags for risky values. onlyFlagged=true (default) returns only flagged databases.
Inputs: onlyFlagged.
mssql_db_foreign_keysGet DB Foreign KeysARead-onlyIdempotent
Foreign keys review for one database: each foreign key with trusted, disabled, indexed (unindexed foreign keys slow joins and deletes) and column type or collation mismatches, plus the WITH CHECK CHECK CONSTRAINT fix; and likely missing foreign keys found by column name (for example Votes.PostId -> Posts.Id). Name matching is a guess, so confirm each one.
Inputs: onlyIssues, databaseName.
mssql_db_identity_headroomGet DB Identity HeadroomARead-onlyIdempotent
Identity headroom: identity columns with the % of their type range already used (tinyint to bigint, decimal), most used first. WARN at 50%, RISK at 80%: when an identity runs out, every insert fails.
Inputs: topN, databaseName, minPercentUsed.
mssql_db_index_healthGet Index HealthARead-onlyIdempotent
Index health for one database: every non-PK index with key and included columns, usage (never used, write-only), fragmentation, fill factor advice, size and a suggested DROP, REBUILD or REORGANIZE script to review. Reads index physical stats (LIMITED), which can be slow on very large databases; use mssql_table_index_health for a few tables.
Inputs: databaseName.
mssql_db_infoGet Database InfoARead-onlyIdempotent
Database info for one database: state, recovery model, compatibility level, data and log size, read-only, auto close, auto shrink, page verify, create date.
Inputs: databaseName.
mssql_db_missing_indexesGet Missing IndexesARead-onlyIdempotent
Missing indexes for one database, from the missing-index DMVs, ranked by improvement score: urgency, improvement %, uses, equality, inequality and included columns. Only tables with 1000+ rows and real query volume.
Inputs: databaseName.
mssql_db_ownersGet Database OwnersARead-onlyIdempotent
Database owners: user databases not owned by sa (SID 0x01, so a renamed sa still counts), including orphaned owners whose login no longer exists. Not available on Azure SQL Database.
Inputs: no named parameters.
mssql_db_table_keysGet DB Table KeysARead-onlyIdempotent
Table keys: every user table with row count, heap or clustered index, primary key and other unique indexes. Flags heaps, tables without a primary key, and tables where only the primary key is unique. onlyFlagged=true (default) returns only flagged tables.
Inputs: onlyFlagged, databaseName.
mssql_db_tablesGet All Tables InfoARead-onlyIdempotent
Tables overview for one database: every table with row count, size, primary key, index counts (unused, fragmented, missing), index health, read/write workload and access pattern, largest first. Reads index physical stats (LIMITED), which can be slow on very large databases; use mssql_table_info for a few tables.
Inputs: databaseName.
mssql_disk_io_latencyGet Disk I/O LatencyARead-onlyIdempotent
Disk I/O latency per database file: reads, writes, average read and write stall (ms) and a rating from Exceptional to Critical. Use to find slow storage.
Inputs: no named parameters.
mssql_error_logRead SQL Server Error LogARead-onlyIdempotent
Error log: read the SQL Server ERRORLOG (or SQL Server Agent log) via sp_readerrorlog. Optionally filter to lines containing one or two search strings (e.g. "Backup", "3013") and select an archived log file. Returns newest entries first. Needs VIEW ANY ERROR LOG (SQL Server 2022+ / Managed Instance) or securityadmin. Not available on Azure SQL Database.
Inputs: logType, maxRows, search1, search2, +1 more.
mssql_execution_planGet Execution PlanARead-onlyIdempotent
Execution plan (showplan XML) of a cached query, by plan handle. Reads the plan cache only; never runs the query. Get the Plan Handle from mssql_top_queries. Large plans are cut at 35,000 characters.
Inputs: queryPlanHandle (required).
mssql_memory_pressureGet Memory PressureARead-onlyIdempotent
Memory pressure: Page Life Expectancy (PLE) from the Buffer Manager. PLE below 300 signals memory pressure; below 1000 on modern servers is worth a look.
Inputs: no named parameters.
mssql_offline_dbGet Offline DatabasesARead-onlyIdempotent
Offline databases: databases that are not ONLINE (OFFLINE, RESTORING, RECOVERING, SUSPECT, EMERGENCY). Any row needs attention.
Inputs: no named parameters.
mssql_privileged_loginsGet Privileged LoginsARead-onlyIdempotent
Security: members of the sysadmin and securityadmin server roles, each marked Expected (in expectedAccounts), Built-in (sa, NT SERVICE*, NT AUTHORITY\SYSTEM, ##...##) or REVIEW. Needs VIEW ANY DEFINITION to see all members. Not available on Azure SQL Database.
Inputs: expectedAccounts.
mssql_recent_backupsGet Most Recent BackupsARead-onlyIdempotent
Backups: the most recent Full, Differential and Log backup per database in the last 30 days. Databases with no backup show NULL dates. For one database's history use mssql_db_backup_history. Not available on Azure SQL Database.
Inputs: no named parameters.
mssql_running_requestsGet Running RequestsARead-onlyIdempotent
Running requests now: active user sessions with status, command, CPU, reads, elapsed time, wait type, blocking session, open transactions and the current statement. includeSleeping=true also lists idle sessions that hold an open transaction. For blocked sessions only, use mssql_blocking.
Inputs: includeSleeping.
mssql_run_selectRun SELECT QueryARead-onlyIdempotent
Run one read-only SELECT (or WITH ... SELECT) query: ad-hoc analysis of system views and DMVs when no other tool fits. One statement only; INSERT, UPDATE, EXEC, SET, USE, SELECT INTO and anything else that writes or changes the session are rejected. Use databaseName instead of USE to run in another database. Returns at most 500 rows; add TOP, WHERE or GROUP BY to narrow.
Inputs: selectQuery (required), databaseName.
mssql_server_configGet Server ConfigurationARead-onlyIdempotent
Server configuration (sp_configure, sys.configurations) with a Flag for risky values: max server memory not capped, cost threshold for parallelism at 5, MAXDOP 0, priority boost, optimize for ad hoc workloads off, xp_cmdshell on, and more. onlyFlagged=true (default) returns only flagged settings.
Inputs: onlyFlagged.
mssql_server_timezoneGet Server TimezoneARead-onlyIdempotent
Server time and timezone: local time, UTC time and UTC offset. Use for time-related job, backup or replication problems.
Inputs: no named parameters.
mssql_server_versionGet Server VersionARead-onlyIdempotent
Server version, edition, patch level (CU), collation, clustering/HADR and licensing. Call first in any health check.
Inputs: no named parameters.
mssql_storage_capacityGet Storage CapacityARead-onlyIdempotent
Disk space: drives with less than 10% free space. Any row is a warning. Include in every health check. Not available on Azure SQL Database.
Inputs: no named parameters.
mssql_table_index_healthGet Tables Index HealthBRead-onlyIdempotent
Index health for the given tables: fragmentation, usage, fill factor advice and a suggested maintenance script.
Inputs: tableNames (required), databaseName.
mssql_table_infoGet Tables InfoBRead-onlyIdempotent
Table details for the given tables: row count, size, primary key type, index counts, read/write workload, access pattern and volatility.
Inputs: tableNames (required), databaseName.
mssql_table_missing_indexesGet Tables Missing IndexesBRead-onlyIdempotent
Missing indexes for the given tables, ranked by improvement score.
Inputs: tableNames (required), databaseName.
mssql_tempdb_healthGet TempDB HealthARead-onlyIdempotent
TempDB health: file layout (count, equal sizes, autogrowth), space use (user objects, internal objects, version store, free space) and the top 10 sessions using tempdb. Flags too few data files, unequal sizes and percent autogrowth.
Inputs: no named parameters.
mssql_top_queriesGet Top Resource QueriesARead-onlyIdempotent
Top queries by CPU, logical reads, memory grant, spills, duration or executions, from the plan cache (sys.dm_exec_query_stats), with statement text and the Plan Handle for mssql_execution_plan. topN default 25, max 100.
Inputs: topN, sortBy.
mssql_vlf_countsGet VLF CountsARead-onlyIdempotent
VLF count: databases whose transaction log has more virtual log files than minVlfCount (default 1000), worst first. Many VLFs slow recovery, restores and log backups. Needs SQL Server 2016 SP2 or later.
Inputs: minVlfCount.
mssql_wait_statsGet Wait StatisticsARead-onlyIdempotent
Wait statistics: the top wait types (what the server waits on: CPU, I/O, locks, memory), each as % of all waits, with average wait and signal (CPU) %. Idle waits are excluded. sampleSeconds=0 (default): since the last restart. sampleSeconds=5: only waits during a 5-second sample, the "what is slow right now" view.
Inputs: topN, minWaitMs, sampleSeconds.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 42 tools
Nearly all 42 tools target distinct diagnostic areas, and descriptions explicitly differentiate scope (e.g., database-wide vs table-specific). However, several scope-variant pairs (mssql_db_tables/mssql_table_info, mssql_db_index_health/mssql_table_index_health, mssql_db_missing_indexes/mssql_table_missing_indexes) could be confused if descriptions are skimmed.
All tools use the mssql_ prefix with snake_case and descriptive noun phrases, following a highly predictable domain_topic pattern. No mixing of conventions or vague names.
42 tools is well above the 25+ threshold for 'too many' in this rubric. While each tool addresses a distinct check, many are scope variants that could be consolidated into parameterized tools to reduce agent load.
Coverage of core DBA diagnostics—storage, memory, waits, queries, blocking, backups, CHECKDB, VLF, agent, security, database config, and index/table design—is extensive. Minor gaps remain for replication, availability group/mirroring health, and deadlock analysis.
Related MCP Connectors
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Read-only local AI advice, shared reports and website audits. No PC scan or local actions.
Read-only finance and operations controls for AI agents with evidence and safe next actions.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides read-only access to Microsoft SQL Server databases using Windows Authentication, enabling AI assistants to safely explore schemas and query data with built-in security controls.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to connect and query Microsoft SQL Server databases using natural language, executing read-only SQL queries for safe data inspection and analysis.MIT
- FlicenseCqualityDmaintenanceEnables AI assistants to analyze and query SQL Server databases, including schema discovery, health checks, and data retrieval.10-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to inspect schemas, analyze performance, check security, and troubleshoot SQL Server 2019+ databases through a safe, controlled interface.-