data-api-builder icon indicating copy to clipboard operation
data-api-builder copied to clipboard

[Enh]: 🚧 Add MCP DBA Tools for MSSQL

Open JerryNixon opened this issue 5 months ago • 0 comments

NOTE: This is a preliminary specification.

What?

MCP DBA tools

MCP Tools

  • sessions_list() — see who’s connected
  • sessions_kill(id) — shut down bad actors
  • query_plan(sql) — why is this query slow
  • wait_statistics() — what is the server waiting on
  • update_statistics(table) — refresh stale stats
  • db_size() — how big is my database
  • index_usage(table) — are my indexes helping or hurting
  • blocking_tree() — who’s blocking whom
  • deadlocks() — why processes are killing each other
  • dbcc_checkdb(name) — corruption and consistency checks

Why?

To provide DBA-level visibility and control.

How?

This will require DAB to execute mssql-specific diagnostic and admin queries.

Configuration

{
  "ai": {
    "mcp": {
      // Option A: single flag for all dba-tools
      "dba-tools": true // default false
      
      // Option B: fine-grained control
      "dba-tools": {
        "sessions_list": true,     // default false
        "sessions_kill": true,     // default false
        "query_plan": true,        // default false
        "wait_statistics": true,   // default false
        "update_statistics": true, // default false
        "db_size": true,           // default false
        "index_usage": true,       // default false
        "blocking_tree": true,     // default false
        "deadlocks": true,         // default false
        "dbcc_checkdb": true       // default false
      }
    }
  }
}

Command line

dab configure --ai.mcp.dba-tools.sessions_list.enabled true
dab configure --ai.mcp.dba-tools.sessions_kill.enabled true
dab configure --ai.mcp.dba-tools.query_plan.enabled true
dab configure --ai.mcp.dba-tools.wait_statistics.enabled true
dab configure --ai.mcp.dba-tools.update_statistics.enabled true
dab configure --ai.mcp.dba-tools.db_size.enabled true
dab configure --ai.mcp.dba-tools.index_usage.enabled true
dab configure --ai.mcp.dba-tools.blocking_tree.enabled true
dab configure --ai.mcp.dba-tools.deadlocks.enabled true
dab configure --ai.mcp.dba-tools.dbcc_checkdb.enabled true

Do you want me to expand the tool signatures with parameters like I did for sessions_kill(id) and query_plan(sql) for all of them, or leave most as parameterless?

JerryNixon avatar Aug 21 '25 04:08 JerryNixon