mcp-server-sql-analyzer logo

mcp-server-sql-analyzer

Community
j4c0bs

MCP server for SQL static analysis.

Publisherj4c0bs
Repositorymcp-server-sql-analyzer
LanguagePython
Forks
7
Stars
32
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    mcp-server-sql-analyzer exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    32 stars and 7 forks from the linked repository.

mcp-server-sql-analyzer

A Model Context Protocol (MCP) server that provides SQL analysis, linting, and dialect conversion capabilities using SQLGlot.

Overview

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 dependencies
  • Identifying column usage and relationships
  • Discovering supported SQL dialects

How Claude Uses This Server

As an AI assistant, this server enhances my ability to help users work with SQL efficiently by:

  1. Query Validation: I can instantly validate SQL syntax before suggesting it to users, ensuring I provide correct and dialect-appropriate queries.

  2. Dialect Conversion: When users need to migrate queries between different database systems, I can accurately convert the syntax while preserving the query's logic.

  3. Code Analysis: The table and column reference analysis helps me understand complex queries, making it easier to explain query structure and suggest optimizations.

  4. Compatibility Checking: By knowing the supported dialects and their specific features, I can guide users toward database-specific best practices.

This toolset allows me to provide more accurate and helpful SQL-related assistance while reducing the risk of syntax errors or dialect-specific issues.

Tips

Update your personal preferences in Claude Desktop settings to request that generated SQL is first validated using the lint_sql tool.

Tools

  1. lint_sql

    • Validates SQL query syntax and returns any errors
    • Input:
      • sql (string): SQL query to analyze
      • dialect (string, optional): SQL dialect (e.g., 'mysql', 'postgres')
    • Returns: ParseResult containing:
      • is_valid (boolean): Whether the SQL is valid
      • message (string): Error message or "No syntax errors"
      • position (object, optional): Line and column of error if present
  2. transpile_sql

    • Converts SQL between different dialects
    • Inputs:
      • sql (string): SQL statement to transpile
      • read_dialect (string): Source SQL dialect
      • write_dialect (string): Target SQL dialect
    • Returns: TranspileResult containing:
      • is_valid (boolean): Whether transpilation succeeded
      • message (string): Error message or success confirmation
      • sql (string): Transpiled SQL if successful
  3. get_all_table_references

    • Extracts table and CTE references from SQL
    • Inputs:
      • sql (string): SQL statement to analyze
      • dialect (string, optional): SQL dialect
    • Returns: TableReferencesResult containing:
      • is_valid (boolean): Whether analysis succeeded
      • message (string): Status message
      • tables (array): List of table references with type, catalog, database, table name, alias, and fully qualified name
  4. get_all_column_references

    • Extracts column references with table context
    • Inputs:
      • sql (string): SQL statement to analyze
      • dialect (string, optional): SQL dialect
    • Returns: ColumnReferencesResult containing:
      • is_valid (boolean): Whether analysis succeeded
      • message (string): Status message
      • columns (array): List of column references with column name, table name, and fully qualified name

Resources

SQL Dialect Discovery

dialects://all

Returns a list of all supported SQL dialects for use in all tools.

Configuration

Using uvx (recommended)

Add this to your claude_desktop_config.json:

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 this repo, add this to your claude_desktop_config.json:

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

Development

To run the server in development mode:

bash
# Clone the repository
git clone git@github.com:j4c0bs/mcp-server-sql-analyzer.git

# Run the server
npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-server-sql-analyzer run mcp-server-sql-analyzer

To run unit tests:

bash
uv run pytest .

License

MIT

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "j4c0bs-mcp-server-sql-analyzer": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-sql-analyzer"
      ]
    }
  }
}

Use mcp-server-sql-analyzer MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once mcp-server-sql-analyzer is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add mcp-server-sql-analyzer as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the mcp-server-sql-analyzer MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "j4c0bs-mcp-server-sql-analyzer": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-sql-analyzer"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the mcp-server-sql-analyzer MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the mcp-server-sql-analyzer MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use mcp-server-sql-analyzer to help me with this task?
mcp-server-sql-analyzer
Sure. I read it.
Here is what I found using mcp-server-sql-analyzer.

Frequently asked questions

What is the mcp-server-sql-analyzer MCP server used for?

mcp-server-sql-analyzer is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use mcp-server-sql-analyzer MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use mcp-server-sql-analyzer with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use mcp-server-sql-analyzer MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With mcp-server-sql-analyzer connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect mcp-server-sql-analyzer MCP to TypingMind?

mcp-server-sql-analyzer runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does mcp-server-sql-analyzer MCP provide in TypingMind?

mcp-server-sql-analyzer exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use mcp-server-sql-analyzer MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If mcp-server-sql-analyzer requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇