mcp-server-sql-analyzer
MCP server for SQL analysis, linting, and dialect conversion.
Key Features
Use Cases
README
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:
-
Query Validation: I can instantly validate SQL syntax before suggesting it to users, ensuring I provide correct and dialect-appropriate queries.
-
Dialect Conversion: When users need to migrate queries between different database systems, I can accurately convert the syntax while preserving the query's logic.
-
Code Analysis: The table and column reference analysis helps me understand complex queries, making it easier to explain query structure and suggest optimizations.
-
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
-
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
-
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
-
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
-
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:
{
"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:
{
"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:
# 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:
uv run pytest .
License
MIT
Star History
Repository Owner
User
Repository Details
Programming Languages
Tags
Join Our Newsletter
Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.
Related MCPs
Discover similar Model Context Protocol servers
Zaturn
Your Co-Pilot For Data Analytics & Business Insights
Zaturn enables AI models to interact with multiple data sources and generate analytics without requiring users to write SQL or Python code. It supports SQL databases and file formats, providing visual and tabular summaries and offering an interactive web interface similar to Jupyter Notebook. Zaturn can function both as a standalone platform or as a Model Context Protocol (MCP) compliant tool, allowing seamless context management for AI-driven data analysis.
- ⭐ 66
- MCP
- kdqed/zaturn
GIS MCP Server
Empower AI with advanced geospatial operations via Model Context Protocol.
GIS MCP Server provides a Model Context Protocol (MCP) server implementation that enables Large Language Models to access and perform sophisticated GIS operations. It bridges AI assistants with Python geospatial libraries such as Shapely, GeoPandas, PyProj, Rasterio, and PySAL. The server supports a wide range of spatial analysis, coordinate transformations, raster and vector data processing, and geospatial intelligence tasks. By integrating with MCP-compatible clients, it enhances AI tools with precise and extensible spatial capabilities.
- ⭐ 70
- MCP
- mahdin75/gis-mcp
Pydantic Logfire MCP Server
Enables LLMs to access and analyze application telemetry data through standardized MCP tools.
Pydantic Logfire MCP Server provides an MCP-compatible interface to access, analyze, and query telemetry data sent to Pydantic Logfire. It allows LLMs to retrieve distributed traces, perform SQL queries on telemetry databases, and generate links for trace inspection. The server can be integrated with well-known MCP clients and supports configuration for secure access with read tokens.
- ⭐ 124
- MCP
- pydantic/logfire-mcp
Panther MCP Server
Natural language and IDE-powered server for detection, alert triage, and data lake querying in Panther.
Panther MCP Server enables interactive management of security alerts, data lake queries, and scheduled reporting using natural language and integrated tools. It allows users to write and tune detections from an IDE, triage and comment on alerts, and execute advanced queries against security logs. The system provides a wide range of operations including alert investigation, bulk updates, AI-powered triage insight generation, and data lake schema exploration. Integration with the Model Context Protocol ensures standardized and extensible interactions for security operations.
- ⭐ 32
- MCP
- panther-labs/mcp-panther
MCP 数据库工具 (MCP Database Utilities)
A secure bridge enabling AI systems safe, read-only access to multiple databases via unified configuration.
MCP Database Utilities provides a secure, standardized service for AI systems to access and analyze databases like SQLite, MySQL, and PostgreSQL using a unified YAML-based configuration. It enforces strict read-only operations, local processing, and credential protection to ensure data privacy and integrity. The tool is suitable for entities focused on data privacy and minimizes risks by isolating database connections and masking sensitive data. Designed for easy integration, it supports multiple installation options and advanced capabilities such as schema analysis and table browsing.
- ⭐ 85
- MCP
- donghao1393/mcp-dbutils
AI Distiller (aid)
Efficient codebase summarization and context extraction for AI code generation.
AI Distiller enables efficient distillation of large codebases by extracting essential context, such as public interfaces and data types, discarding method implementations and non-public details by default. It helps AI agents like Claude, Cursor, and other MCP-compatible tools understand project architecture more accurately, reducing hallucinations and code errors. With configurable CLI options, it generates condensed contexts that fit within AI model limitations, improving code generation accuracy and integration with the Model Context Protocol.
- ⭐ 106
- MCP
- janreges/ai-distiller
Didn't find tool you were looking for?