mcp-server-sql-analyzer
MCP server for SQL static analysis.
Documentation
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
2. transpile_sql
3. get_all_table_references
4. get_all_column_references
Resources
SQL Dialect Discovery
dialects://allReturns 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-analyzerTo run unit tests:
uv run pytest .License
MIT
Frequently asked questions
What is mcp-server-sql-analyzer?
mcp-server-sql-analyzer is MCP server for SQL static analysis.
How do I install mcp-server-sql-analyzer?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mcp-server-sql-analyzer open source?
Yes — it is hosted on GitHub at https://github.com/j4c0bs/mcp-server-sql-analyzer and has 25 stars.
Related MCP tools
Damn Vulnerable MCP Server Python-based implementation. Trusted by 1200+ developers. Trusted by 1200+ developers. Trusted by 1200+ developers.
A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases Python-based implementation. Trusted by 900+ developers.
Query MCP enables end-to-end management of Supabase via chat interface: read & write query executions, management API support, automatic migration versioning...
Model Context Protocol with Neo4j Python-based implementation. Trusted by 700+ developers. Trusted by 700+ developers. Trusted by 700+ developers.
An MCP server that provides control over Android devices via adb Python-based implementation. Trusted by 500+ developers.
A Model Context Protocol (MCP) server for PostgreSQL databases with enhanced capabilities for AI agents. Python-based implementation.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP