Skip to main content

sqlfluff-mcp-server

PyPI Python versions CI License: MIT

An MCP server that exposes SQLFluff's linting, fixing, and parsing over the Model Context Protocol, so any MCP-aware client (Claude, other agents, IDE integrations) can lint and fix SQL directly.

This project is independent of the SQLFluff maintainers — it's a thin wrapper around the public sqlfluff Python package.

Tools

Tool Input Config resolution
lint_file path on disk walks up from the file for .sqlfluff / pyproject.toml / etc.
fix_file path on disk (+ write flag) same directory walk
parse_file path on disk same directory walk
lint_sql raw SQL text + dialect none — dialect supplied explicitly
fix_sql raw SQL text + dialect none — dialect supplied explicitly
parse_sql raw SQL text + dialect none — dialect supplied explicitly
list_dialects — lists supported dialect names
clear_config_cache — clears SQLFluff's cached config-file contents

The *_file tools honor project config the same way the sqlfluff CLI does (via FluffConfig.from_path, which walks up the directory tree looking for .sqlfluff, pyproject.toml, setup.cfg, or tox.ini). The *_sql tools are for content that hasn't been written to disk (e.g. streamed from an editor buffer) and require you to pass dialect explicitly since there's no file location to resolve config from.

Config caching

SQLFluff caches the contents of config files it reads while walking a directory tree, for the lifetime of the process. Because this server is long-running (unlike the sqlfluff CLI, which is a fresh process per invocation), editing a .sqlfluff file after the server has started won't be picked up by lint_file / fix_file / parse_file until you call clear_config_cache. Call it whenever config on disk changes, or just proactively before a lint/fix/parse call if you're unsure.

Requirements

  • Python 3.10+
  • uv (recommended) or pipx/pip
  • mcp >=2.0.0,<3.0.0 and sqlfluff >=3.0.0 (installed automatically as dependencies — see Notes on dependencies)

Registering with an MCP client

This package is published on PyPI, so there's nothing to clone or install ahead of time. Point your MCP client's config (e.g. .claude.json / .mcp.json for Claude Code, or Claude Desktop's config file) at it via uvx, and it's fetched into an isolated cache and launched on demand:

{
  "mcpServers": {
    "sqlfluff": {
      "command": "uvx",
      "args": ["sqlfluff-mcp-server"]
    }
  }
}

No uv? pipx run sqlfluff-mcp-server as the command/args works the same way.

For stdio-based servers like this one, the client itself launches the process — automatically, when the client session starts, not when a prompt first needs it. Once it's registered, just ask the client to lint or fix a SQL file; the server is already running in the background and the tools are already available. If the server process crashes, the client restarts it for you.

Running it manually (for local testing/debugging)

uvx sqlfluff-mcp-server

This starts the server over stdio and blocks, waiting for an MCP client to speak the protocol to it on stdin/stdout — it's not something you'd run interactively day to day, just useful for sanity-checking the install or piping through the MCP Inspector.

Development

Clone the repo to work on the server itself (rather than just consuming it via uvx):

git clone <this-repo-url>
cd sqlfluff-mcp-server
uv sync --extra dev
uv run pytest
uv run ruff check .

To point an MCP client at your local checkout instead of the PyPI release (e.g. to test unreleased changes):

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

Notes on dependencies

  • mcp is pinned to >=2.0.0,<3.0.0. The SDK's 2.0 line renamed mcp.server.fastmcp.FastMCP to mcp.server.mcpserver.MCPServer and moved transport selection to run(transport=...); the @mcp.tool() decorator API is unchanged.
  • sqlfluff is left unpinned above 3.0.0 — SQLFluff releases fairly often and this server only depends on its stable Linter / FluffConfig API.

License

MIT — see LICENSE.

Metadata

Release files for sqlfluff-mcp-server 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlfluff-mcp-server 0.2.1
File Size Uploaded
sqlfluff_mcp_server-0.2.1.tar.gz 119.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sqlfluff-mcp-server 0.2.1
File Interpreter ABI Platform
sqlfluff_mcp_server-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 126.6 kB

Release files / sqlfluff_mcp_server-0.2.1.tar.gz

Download URL sqlfluff_mcp_server-0.2.1.tar.gz
Size 119.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6eea4eff37a0565512189136529679ee4f1011943e72317fe31d9b2609c5a0bd
BLAKE2b-256 checksum
How to use checksums
2cd0c504bde35dbbc611a041dae96d867ede59495f4a06bbe6d7cae47c294bba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Release files / sqlfluff_mcp_server-0.2.1-py3-none-any.whl

Download URL sqlfluff_mcp_server-0.2.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d893ba26eb81341fa51aae960cbc0fa5a22dba2654fd92c838a7d4ffc67f3ec8
BLAKE2b-256 checksum
How to use checksums
af8b025887a8325e62550f51a6ba5e765026a19008196794999476750588cc5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page