A Model Context Protocol (MCP) server that provides SQL analysis, linting, and dialect conversion capabilities using SQLGlot. The SQL Analyzer MCP server provides tools for analyzing and working with SQL queries. It helps with: - SQL syntax validation and linting - Converting queries between different SQL dialects (e.g., MySQL to PostgreSQL) - Extracting and analyzing table references and dependen
Add this skill
npx mdskills install j4c0bs/mcp-server-sql-analyzerProvides comprehensive SQL analysis tools with clear docs but overstates required permissions
1# mcp-server-sql-analyzer23A Model Context Protocol (MCP) server that provides SQL analysis, linting, and dialect conversion capabilities using [SQLGlot](https://sqlglot.com/sqlglot.html).45## Overview67The SQL Analyzer MCP server provides tools for analyzing and working with SQL queries. It helps with:89- SQL syntax validation and linting10- Converting queries between different SQL dialects (e.g., MySQL to PostgreSQL)11- Extracting and analyzing table references and dependencies12- Identifying column usage and relationships13- Discovering supported SQL dialects1415### How Claude Uses This Server1617As an AI assistant, this server enhances my ability to help users work with SQL efficiently by:18191. **Query Validation**: I can instantly validate SQL syntax before suggesting it to users, ensuring I provide correct and dialect-appropriate queries.20212. **Dialect Conversion**: When users need to migrate queries between different database systems, I can accurately convert the syntax while preserving the query's logic.22233. **Code Analysis**: The table and column reference analysis helps me understand complex queries, making it easier to explain query structure and suggest optimizations.24254. **Compatibility Checking**: By knowing the supported dialects and their specific features, I can guide users toward database-specific best practices.2627This toolset allows me to provide more accurate and helpful SQL-related assistance while reducing the risk of syntax errors or dialect-specific issues.2829### Tips3031Update your personal preferences in Claude Desktop settings to request that generated SQL is first validated using the `lint_sql` tool.3233## Tools34351. lint_sql36 - Validates SQL query syntax and returns any errors37 - Input:38 - sql (string): SQL query to analyze39 - dialect (string, optional): SQL dialect (e.g., 'mysql', 'postgres')40 - Returns: ParseResult containing:41 - is_valid (boolean): Whether the SQL is valid42 - message (string): Error message or "No syntax errors"43 - position (object, optional): Line and column of error if present44452. transpile_sql46 - Converts SQL between different dialects47 - Inputs:48 - sql (string): SQL statement to transpile49 - read_dialect (string): Source SQL dialect50 - write_dialect (string): Target SQL dialect51 - Returns: TranspileResult containing:52 - is_valid (boolean): Whether transpilation succeeded53 - message (string): Error message or success confirmation54 - sql (string): Transpiled SQL if successful55563. get_all_table_references57 - Extracts table and CTE references from SQL58 - Inputs:59 - sql (string): SQL statement to analyze60 - dialect (string, optional): SQL dialect61 - Returns: TableReferencesResult containing:62 - is_valid (boolean): Whether analysis succeeded63 - message (string): Status message64 - tables (array): List of table references with type, catalog, database, table name, alias, and fully qualified name65664. get_all_column_references67 - Extracts column references with table context68 - Inputs:69 - sql (string): SQL statement to analyze70 - dialect (string, optional): SQL dialect71 - Returns: ColumnReferencesResult containing:72 - is_valid (boolean): Whether analysis succeeded73 - message (string): Status message74 - columns (array): List of column references with column name, table name, and fully qualified name7576## Resources7778### SQL Dialect Discovery7980```81dialects://all82```8384Returns a list of all supported SQL dialects for use in all tools.8586## Configuration8788### Using uvx (recommended)8990Add this to your `claude_desktop_config.json`:9192```json93{94 "mcpServers": {95 "sql-analyzer": {96 "command": "uvx",97 "args": [98 "--from",99 "git+https://github.com/j4c0bs/mcp-server-sql-analyzer.git",100 "mcp-server-sql-analyzer"101 ]102 }103 }104}105```106107### Using uv108109After cloning this repo, add this to your `claude_desktop_config.json`:110111```json112{113 "mcpServers": {114 "sql-analyzer": {115 "command": "uv",116 "args": [117 "--directory",118 "/path/to/mcp-server-sql-analyzer",119 "run",120 "mcp-server-sql-analyzer"121 ]122 }123 }124}125```126127## Development128129To run the server in development mode:130131```bash132# Clone the repository133git clone git@github.com:j4c0bs/mcp-server-sql-analyzer.git134135# Run the server136npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-server-sql-analyzer run mcp-server-sql-analyzer137```138139To run unit tests:140141```bash142uv run pytest .143```144145## License146147MIT148
Full transparency — inspect the skill content before installing.