2.0.3npm · @piyapat/mssql-mcp-server · current release
Observed 2026-08-23T13:23:43.480Z using mcpSecurity-inventory. Status: succeeded. Negotiated protocol: 2025-06-18.
{
"tools": {}
}| Tool | Category | Annotations | Risk |
|---|---|---|---|
mssql_analyze_indexesAnalyze index usage (seeks/scans/lookups/updates per index) and list potentially missing indexes suggested by the query optimizer. Optionally filter usage stats by table name.Input schema{
"type": "object",
"properties": {
"tableName": {
"type": "string",
"description": "Optional: only show index usage for this table."
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": false,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_analyze_storageAnalyze storage: largest tables by size (row count, total/used MB) and database file sizes. Useful for capacity planning and finding space hogs.Input schema{
"type": "object",
"properties": {
"topTables": {
"type": "number",
"description": "Number of largest tables to return (default: 20)",
"default": 20
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": false,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_find_blockingFind current blocking chains: which sessions are blocked, by whom, on what resource, and for how long. Identifies lead blockers (including idle sessions holding open transactions) with their SQL text. Supported: SQL Server 2019 (15.x), 2022 (16.x), 2025 (17.x) — all editions including Express. Requires VIEW SERVER STATE.Input schema{
"type": "object",
"properties": {
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": false,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_get_deadlocksRetrieve recent deadlock events from the built-in system_health Extended Events session, including the full deadlock graph XML, victim sessions, and the queries involved. Source 'ring_buffer' (default, fast, recent events only) or 'file' (reads system_health .xel files, further back but slower). Supported: SQL Server 2019 (15.x), 2022 (16.x), 2025 (17.x) — all editions including Express. Requires VIEW SERVER STATE.Input schema{
"type": "object",
"properties": {
"maxEvents": {
"type": "number",
"description": "Maximum number of deadlock events to return (default: 5, max: 25)",
"default": 5
},
"source": {
"type": "string",
"enum": [
"ring_buffer",
"file"
],
"description": "'ring_buffer' = in-memory recent events (fast). 'file' = system_health event files (older history, slower).",
"default": "ring_buffer"
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": false,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_get_relationshipsGet foreign key relationships between tables: constraint name, from/to table and column, and delete/update actions. Optionally filter by table name (matches either side).Input schema{
"type": "object",
"properties": {
"tableName": {
"type": "string",
"description": "Optional: only show relationships involving this table."
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_get_schemaGet database schema information including tables, columns, data types, primary keys, and foreign keys. Optionally filter by table name.Input schema{
"type": "object",
"properties": {
"tableName": {
"type": "string",
"description": "Optional: specific table name to get schema for. If not provided, returns all tables."
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format: 'json' for machine-readable, 'markdown' for human-readable (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_get_stored_proceduresList stored procedures in the database with their definitions and parameters. Optionally filter by procedure name.Input schema{
"type": "object",
"properties": {
"procedureName": {
"type": "string",
"description": "Optional: specific procedure name to get details for. If not provided, returns all procedures."
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format: 'json' for machine-readable, 'markdown' for human-readable (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_get_viewsList views in the database with their full SQL definitions. Optionally filter by view name to get a single view's definition.Input schema{
"type": "object",
"properties": {
"viewName": {
"type": "string",
"description": "Optional: specific view name to get the definition for."
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_index_fragmentationAnalyze index fragmentation and recommend maintenance: REBUILD (fragmentation ≥ 30%), REORGANIZE (5–30%), or OK (< 5%). Generates ready-to-run ALTER INDEX statements (ONLINE=ON suggested automatically on editions that support it). Small indexes below minPageCount are excluded since fragmentation there is harmless.Input schema{
"type": "object",
"properties": {
"tableName": {
"type": "string",
"description": "Optional: analyze only this table."
},
"minPageCount": {
"type": "number",
"description": "Ignore indexes smaller than this many pages (default: 100 ≈ 800 KB).",
"default": 100
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": false,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_list_databasesList all databases on the SQL Server instance with state, recovery model, compatibility level, and creation date.Input schema{
"type": "object",
"properties": {
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_list_tablesList tables in the current database with schema, row count, and size in MB. Optionally filter by schema name.Input schema{
"type": "object",
"properties": {
"schemaName": {
"type": "string",
"description": "Optional: filter tables by schema (e.g. 'dbo'). Default: all schemas."
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_monitor_locksMonitor database locks, blocking sessions, and potential deadlocks. Shows lock types, resources, and wait times.Input schema{
"type": "object",
"properties": {
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format: 'json' for machine-readable, 'markdown' for human-readable (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": false,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_monitor_usageGet database resource usage statistics including CPU, memory, active sessions, and top resource-consuming queries.Input schema{
"type": "object",
"properties": {
"topQueries": {
"type": "number",
"description": "Number of top CPU-consuming queries to return (default: 10)",
"default": 10
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format: 'json' for machine-readable, 'markdown' for human-readable (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": false,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_performance_healthOverall performance health check: top wait statistics (with benign waits filtered out), memory counters (Page Life Expectancy, memory grants pending, total vs target memory), workload counters (batch requests, compilations), and rule-based optimization recommendations (e.g. high CXPACKET → review MAXDOP, PAGEIOLATCH → check I/O and indexes, LCK_M → run mssql_find_blocking).Input schema{
"type": "object",
"properties": {
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": false,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_queryExecute a read-only SQL query against the MS SQL Server database. Accepts: a single SELECT / WITH...SELECT; a multi-statement batch led by DECLARE, INSERT, or CREATE TABLE # that writes ONLY to session-local #temp tables or @table variables (global ##temp is never allowed); or EXEC of a whitelisted stored procedure whose definition does not write to a persistent table. Writes to real tables, DDL on persistent objects, dynamic SQL, EXEC inside batches, and DBCC are blocked (server runs with MSSQL_READ_ONLY=true). Returns results as JSON or Markdown.Input schema{
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The SQL to execute. Must be read-only: a SELECT/WITH query, a DECLARE batch using only #temp/@table targets, or EXEC of an allowed read-only stored procedure."
},
"maxRows": {
"type": "number",
"description": "Maximum number of rows to return per page (default: 100, max: 1000)",
"default": 100
},
"offset": {
"type": "number",
"description": "Row offset for pagination (default: 0)",
"default": 0
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format: 'json' for machine-readable, 'markdown' for human-readable (default: json)",
"default": "json"
}
},
"required": [
"query"
]
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_sample_dataRetrieve sample rows from a table (default 10, max 100). Safe way to preview data without writing SQL. Accepts 'table' or 'schema.table'.Input schema{
"type": "object",
"properties": {
"tableName": {
"type": "string",
"description": "Table name, optionally schema-qualified (e.g. 'Orders' or 'dbo.Orders')."
},
"rows": {
"type": "number",
"description": "Number of rows to sample (default: 10, max: 100)",
"default": 10
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
},
"required": [
"tableName"
]
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_search_definitionsSearch the SQL source code of all stored procedures, views, functions, and triggers for a text fragment (e.g. a table name or business term). Useful for impact analysis and legacy code exploration.Input schema{
"type": "object",
"properties": {
"searchText": {
"type": "string",
"description": "Text to search for inside object definitions (literal substring, case-insensitive)."
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
},
"required": [
"searchText"
]
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_test_connectionTest database connectivity and return server information: version, edition, current database, login, and server mode (read-only or write).Input schema{
"type": "object",
"properties": {
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
} | — | Read only · Non-destructive | — |
mssql_top_queriesFind the most expensive queries from the plan cache, ranked by a chosen metric: cpu, duration, reads (logical I/O), writes, memory (grant size), or executions. Returns per-query totals and averages with the SQL text — the starting point for performance tuning.Input schema{
"type": "object",
"properties": {
"metric": {
"type": "string",
"enum": [
"cpu",
"duration",
"reads",
"writes",
"memory",
"executions"
],
"description": "Ranking metric (default: cpu)",
"default": "cpu"
},
"top": {
"type": "number",
"description": "Number of queries to return (default: 10, max: 50)",
"default": 10
},
"response_format": {
"type": "string",
"enum": [
"json",
"markdown"
],
"description": "Response format (default: markdown)",
"default": "markdown"
}
}
}Annotations{
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": false,
"openWorldHint": false
} | — | Read only · Non-destructive | — |