autodba-mcp

v0.1.0
autodba-mcp Checked 16 hours ago Published 1 month ago

Zero-database-connection static SQL analysis, query optimization, and execution plan diagnostics MCP server.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

analyze_query

Run static AST analysis on a SQL query using sqlglot. Identifies non-SARGable column functions, Cartesian joins, cursor loops, SELECT *, and query anti-patterns without connecting to a database. Args: sql: The SQL query text to inspect. dialect: SQL dialect ('tsql', 'postgres', or 'mysql'). Defaults to 'tsql'. Returns: Structured Markdown diagnostic report with complexity scores and rule IDs.

ParameterTypeDescription
sql *string
dialectstring

optimize_query

Rewrite SQL anti-patterns into optimized AST forms and synthesize index DDL. Transforms non-SARGable functions into range bounds, converts comma joins to explicit ANSI joins, replaces NOT IN with NOT EXISTS, and generates zero-downtime CREATE INDEX ... WITH (ONLINE = ON) statements. Args: sql: The SQL query text to optimize. dialect: SQL dialect ('tsql', 'postgres', or 'mysql'). Defaults to 'tsql'. plan_xml_or_json: Optional execution plan text (.sqlplan XML or EXPLAIN JSON). Returns: Structured Markdown report containing optimized SQ…

ParameterTypeDescription
sql *string
dialectstring
plan_xml_or_json

explain_execution_plan

Parse and explain database execution plans. Supports SQL Server ShowPlanXML (.sqlplan), PostgreSQL EXPLAIN JSON, and MySQL EXPLAIN JSON. Pinpoints bottleneck operators, sort spills, and missing index recommendations. Args: plan_content: Raw plan string (.sqlplan XML or EXPLAIN JSON). dialect: SQL dialect ('tsql', 'postgres', or 'mysql'). Defaults to 'tsql'. Returns: Structured Markdown diagnostic report highlighting plan bottlenecks.

ParameterTypeDescription
plan_content *string
dialectstring

list_supported_rules

Return the comprehensive catalog of built-in AST diagnostic rules. Lists all supported rules, severities, heuristic cost weights, and remediation recommendations. Returns: Structured Markdown table of all supported static and execution plan rules.