SQLFluff Analyzer
Analyze, lint, and fix SQL queries using the SQLFluff linter.
mcp-server-sql-analyzer
A Model Context Protocol (MCP) server that provides SQL analysis, linting, and fixing capabilities using SQLFluff.
Overview
The sqlfluff MCP server provides tools for analyzing and working with SQL queries. It helps with:
- Lint SQL query and return syntax errors
- Fix SQL query and return the fixed version.
- Parse SQL query and return the parsed tree.
Tools
- lint_sql
- Lint SQL query and return syntax errors. Some syntax errors are not detected by the parser like trailing commas.
- Inputs:
- sql (string): SQL query to analyze.
- dialect (string, optional): SQL dialect (e.g., 'mysql', 'postgresql').
- Returns:
- List of linting results, each containing:
- start_line_no: Line number where the issue starts
- start_line_pos: Position in the line where the issue starts
- code: Error code
- description: Description of the issue
- name: Name of the linting rule
- warning: Whether it's a warning or an error
- fixes: List of possible fixes
- start_file_pos: Start position in the file
- end_line_no: Line number where the issue ends
- end_line_pos: Position in the line where the issue ends
- end_file_pos: End position in the file
- List of linting results, each containing:
-
fix_sql
- Fix SQL query and return the fixed version.
- Inputs:
- sql (string): SQL query to fix.
- dialect (string, optional): SQL dialect (e.g., 'mysql', 'postgresql').
- Returns:
- Fixed SQL query string.
-
parse_sql
- Parse SQL query and return the parsed tree.
- Inputs:
- sql (string): SQL query to parse.
- dialect (string, optional): SQL dialect (e.g., 'mysql', 'postgresql').
- Returns:
- Parsed tree as a string.
Resources
SQL Dialect Discovery
dialects://all
Returns a list of all supported SQL dialects for use in all tools.
Configuration
Using uvx
Add this to your your MCP client config file:
{
"mcpServers": {
"mcp-server-sqlfluff": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/antoprince001/mcp-server-sqlfluff.git",
"mcp-server-sqlfluff"
]
}
}
}
Using uv
After cloning this repo, add this to your MCP client config file:
{
"mcpServers": {
"mcp-server-sqlfluff": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp-server-sqlfluff",
"run",
"mcp-server-sqlfluff"
]
}
}
}
Development
To run the server in development mode:
# Clone the repository
git clone git@github.com:antoprince001/mcp-server-sqlfluff.git
# Run the server
npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-server-sqlfluff run mcp-server-sqlfluff
To run unit tests:
uv run pytest .
License
Released under the MIT License. See the LICENSE file for details.
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Model Context Protocol servers
A collection of reference implementations for the Model Context Protocol (MCP), showcasing servers built with TypeScript and Python SDKs.
MCPHub
A hub server for managing and scaling multiple MCP servers via flexible Streamable HTTP (SSE) endpoints.
Code-Index-MCP
A local-first code indexer that enhances LLMs with deep code understanding. It integrates with AI assistants via the Model Context Protocol (MCP) and supports AI-powered semantic search.
FastAPI-MCP
A zero-configuration tool to automatically expose FastAPI endpoints as MCP tools.
MCP Documentation Server
Integrates LLM applications with documentation sources using the Model Context Protocol.
MCP Servers
A collection of MCP servers for browser automation and database interaction, supporting Puppeteer, Postgres, MySQL, and Parquet.
Shell Command MCP Server
Execute pre-configured and secure shell commands via a Go-based MCP server.
Jai MCP Server
Manage Jai platform resources through Claude Code.
Claude Memory MCP Server
A persistent memory server for Large Language Models, designed to integrate with the Claude desktop application. It supports tiered memory, semantic search, and automatic memory management.
Bevy BRP MCP
Control, inspect, and mutate Bevy applications with AI coding assistants via the Bevy Remote Protocol (BRP).