Sqlfluff MCP Server

A Model Context Protocol (MCP) server that provides SQL analysis, linting, and fixing capabilities using [SQLFluff](https://sqlfluff.com/).

Local serverstdio

What is the Sqlfluff MCP server?

Sqlfluff MCP server exists for a simple reason — assistants are far more useful when they can act on Sqlfluff directly instead of describing what you should do. A Model Context Protocol (MCP) server that provides SQL analysis, linting, and fixing capabilities using SQLFluff.

What you get

The sqlfluff MCP server provides tools for analyzing and working with SQL queries. It helps with:

Setting it up

The server ships on npm as @modelcontextprotocol/inspector, so your MCP client can launch it on demand — there is no separate build step. Add the server block to your client's configuration, restart it, and the tools register themselves.

What the assistant can call

Once Sqlfluff is connected, these are the calls the assistant has available:

  • Inputs — - sql (string): SQL query to analyze
  • 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

Before you rely on it

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 13 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Sqlfluff.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the sqlfluff mcp server does with a few real requests.

Choosing this one

This sits in the database access group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. Sqlfluff's toolset — Inputs, Returns, start_line_no and 10 more — is a fair guide to whether it matches your workflow. It is maintained by antoprince001; worth a glance at recent repository activity before you build anything load-bearing on it.

This entry was verified against Sqlfluff's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Available tools

ToolWhat it does
Inputs- sql (string): SQL query to analyze.
Returns- List of linting results, each containing:
start_line_noLine number where the issue starts
start_line_posPosition in the line where the issue starts
codeError code
descriptionDescription of the issue
nameName of the linting rule
warningWhether it's a warning or an error
fixesList of possible fixes
start_file_posStart position in the file
end_line_noLine number where the issue ends
end_line_posPosition in the line where the issue ends
end_file_posEnd position in the file

How to install the Sqlfluff MCP server

{
  "mcpServers": {
    "server-sqlfluff": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/inspector"]
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Example prompts to try

  • Use Sqlfluff to Inputs.
  • Use Sqlfluff to Returns.
  • Use Sqlfluff to start line no.

Frequently asked questions

It connects Sqlfluff to MCP-compatible AI assistants such as Claude and Cursor, exposing 13 tools (Inputs, Returns, start_line_no, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Sqlfluff directly.