About sqlfmt-mcp
sqlfmt-mcp is an MCP server for producing consistent SQL formatting across 19 dialects. It is intended for coding agents and downstream tools that need stable SQL output for review and diffs.
Key features
- 01Format SQL for 19 dialects
- 02Choose keyword case and indentation
- 03List supported dialects
Use cases
- 01Standardize SQL in code reviews
- 02Format queries before generating diffs
MCP support
Exposes `format_sql` and `list_dialects` tools to MCP clients. The tools format SQL and report supported dialects.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
2Saved tool list · updated 2w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| sql | string | Yes | Raw SQL to format. |
| dialect | enum | No | Generic 'sql' covers most ANSI cases; pick specifically for dialect-only syntax.sql | bigquery | db2 | db2i | duckdb | hive | mariadb | mysql | n1ql | plsql | postgresql | redshift | singlestoredb | snowflake | spark | sqlite | tidb | transactsql | trino |
| use_tabs | boolean | No | |
| tab_width | integer | No | |
| keyword_case | enum | No | preserve | upper | lower |
Details
From the project README@mukundakatta/sqlfmt-mcp
MCP server for deterministic SQL formatting across 19 dialects.
Tools
format_sql(sql, dialect?, keyword_case?, tab_width?, use_tabs?)— format with the named dialect (defaultsqlfor ANSI). Returns formatted text + line count.list_dialects()— return the list of supported dialects so an LLM can confirm before formatting.
Why this exists
LLMs format SQL inconsistently across turns: same query, different indentation, different keyword casing. Code-review agents and downstream tooling that diffs SQL want one canonical form. Wrapping the well-tested sql-formatter library here gives you that.
Supported dialects
sql, bigquery, db2, db2i, duckdb, hive, mariadb, mysql, n1ql, plsql, postgresql, redshift, singlestoredb, snowflake, spark, sqlite, tidb, transactsql, trino.
Install — Claude Desktop
{
"mcpServers": {
"sqlfmt": { "command": "npx", "args": ["-y", "@mukundakatta/sqlfmt-mcp"] }
}
}
Same shape for Cursor / Cline / Windsurf / Zed.
License
MIT OR Apache-2.0.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.