mcp-server-sql-analyzer logo

mcp-server-sql-analyzer

by j4c0bs

The mcp-server-sql-analyzer is a Model Context Protocol (MCP) server that provides SQL analysis, linting, and dialect conversion capabilities using SQLGlot. It offers tools for validating SQL syntax, converting between dialects, and extracting table/column references.

View on GitHub

Last updated: N/A

What is mcp-server-sql-analyzer?

This server is a Model Context Protocol (MCP) server designed for SQL analysis. It leverages SQLGlot to provide functionalities such as SQL syntax validation, dialect conversion, and extraction of table and column references.

How to use mcp-server-sql-analyzer?

The server exposes tools like lint_sql, transpile_sql, get_all_table_references, and get_all_column_references via the MCP protocol. It can be integrated with applications like Claude by configuring the claude_desktop_config.json file to point to the server. The server can be run using uvx or uv, as described in the Configuration section of the README.

Key features of mcp-server-sql-analyzer

  • SQL syntax validation and linting

  • SQL dialect conversion (e.g., MySQL to PostgreSQL)

  • Table and CTE reference extraction

  • Column reference extraction with table context

Use cases of mcp-server-sql-analyzer

  • Validating SQL syntax before execution

  • Converting SQL queries between different database systems

  • Understanding complex query structures

  • Checking SQL compatibility across different databases

FAQ from mcp-server-sql-analyzer

How do I configure Claude to use this server?

You need to update your claude_desktop_config.json file to include the server configuration, specifying the command and arguments to run the server. Examples are provided in the Configuration section of the README.

What SQL dialects are supported?

The server supports a variety of SQL dialects. You can discover the full list by using the dialects://all resource.

How do I run the server in development mode?

Clone the repository and use the provided command npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-server-sql-analyzer run mcp-server-sql-analyzer.

How do I run the unit tests?

Use the command uv run pytest . in the repository directory.

What license is this server released under?

The server is released under the MIT license.