Back to MCP Catalog

SQL Analyzer MCP Server

DatabasesPython
Analyze, validate, and convert SQL queries between different dialects
Available Tools

lint_sql

Validates SQL query syntax and returns any errors

sqldialect

transpile_sql

Converts SQL between different dialects

sqlread_dialectwrite_dialect

get_all_table_references

Extracts table and CTE references from SQL

sqldialect

get_all_column_references

Extracts column references with table context

sqldialect

SQL Analyzer provides powerful tools for working with SQL queries across different database dialects. It leverages SQLGlot to offer syntax validation, linting, dialect conversion, and comprehensive analysis of table and column references. This MCP server enhances Claude's ability to work with SQL by ensuring queries are valid before suggesting them to users, converting between dialects accurately, analyzing complex query structures, and maintaining compatibility with database-specific features. It's an essential tool for anyone working with SQL across multiple database systems.

Overview

SQL Analyzer is a Model Context Protocol (MCP) server that provides comprehensive SQL analysis capabilities powered by SQLGlot. It helps with validating SQL syntax, converting queries between different database dialects, and analyzing table and column relationships within queries.

This server enhances Claude's ability to work with SQL by:

  • Validating SQL syntax before suggesting it to users
  • Converting queries between different database systems while preserving logic
  • Analyzing complex query structures to better explain and optimize them
  • Checking compatibility with database-specific features

Installation

Using uvx (Recommended)

Add the following configuration to your claude_desktop_config.json:

{
  "mcpServers": {
    "sql-analyzer": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/j4c0bs/mcp-server-sql-analyzer.git",
        "mcp-server-sql-analyzer"
      ]
    }
  }
}

Using uv (After cloning the repository)

After cloning the repository, add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "sql-analyzer": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/mcp-server-sql-analyzer",
        "run",
        "mcp-server-sql-analyzer"
      ]
    }
  }
}

Usage

Once installed, Claude can use the SQL Analyzer tools to help with various SQL-related tasks. You can ask Claude to:

  1. Validate SQL syntax for a specific dialect
  2. Convert SQL queries between different dialects (e.g., MySQL to PostgreSQL)
  3. Analyze table references and dependencies in complex queries
  4. Identify column usage and relationships

SQL Dialect Discovery

To discover all supported SQL dialects, use the following resource:

dialects://all

This will return a list of all supported SQL dialects that can be used with the tools.

Configuration Tips

For the best experience, update your personal preferences in Claude Desktop settings to request that generated SQL is first validated using the lint_sql tool. This ensures that any SQL Claude provides is syntactically correct for your target database system.

Related MCPs

Milvus Vector Database
DatabasesPython

Connect to Milvus vector database for semantic search and vector operations

MotherDuck DuckDB
DatabasesPython

SQL analytics with DuckDB and MotherDuck for AI assistants

Alibaba Cloud Tablestore
DatabasesJava, Python

Connect to Alibaba Cloud Tablestore for vector search and RAG applications

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.