sqlsure — Claude Code MCP server: SQL checks and setup
sqlsure checks SQL against a semantic model before execution, flagging risky joins, invalid aggregations, and exposed sensitive fields. Use it to inspect agent-written queries.
claude mcp add sqlsure -- uvx sqlsureWhat sqlsure does
The server compares a query with declared facts about the data model. dbt tests can describe table grain and relationships, while metadata marks measures that are safe to aggregate. sqlsure can flag duplicated totals after a join, an inappropriate aggregation, or sensitive output columns. It returns a suggested fix that an agent can apply before checking the query again.
sqlsure runs offline and reads query text without connecting to a database. Its rule-based verdicts are deterministic for the same query and model. Models can come from dbt, declared primary and foreign keys, or catalogs from SQLite, PostgreSQL, and MySQL; a JSON model can also be written by hand. Joins without declared relationships may be unverifiable, so that gap matters before a query runs.
What it helps with
- catch duplicated totals after a join
- flag sums of averages or balances
- find joins lacking declared relationships
- prevent sensitive columns from appearing in results
Example prompts for the agent
- Check this SQL with sqlsure before running it:
SELECT .... - Inspect this query for joins that could duplicate revenue and suggest a fix.
- Check whether this query exposes any PII columns.
How to install sqlsure
Platform CLI
claude mcp add sqlsure -- uvx sqlsureuvx runs the command named after the package; if the README names another one, use uvx --from sqlsure <command>
Platform CLI
codex mcp add sqlsure -- uvx sqlsureuvx runs the command named after the package; if the README names another one, use uvx --from sqlsure <command>
Config file
{
"mcpServers": {
"sqlsure": {
"command": "uvx",
"args": [
"sqlsure"
]
}
}
}uvx runs the command named after the package; if the README names another one, use uvx --from sqlsure <command>
Config file
{
"servers": {
"sqlsure": {
"type": "stdio",
"command": "uvx",
"args": [
"sqlsure"
]
}
}
}uvx runs the command named after the package; if the README names another one, use uvx --from sqlsure <command>
Platform CLI
gemini mcp add sqlsure uvx sqlsureuvx runs the command named after the package; if the README names another one, use uvx --from sqlsure <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about sqlsure
How do I install sqlsure in Claude Code?
Run claude mcp add sqlsure -- uvx sqlsure. This adds sqlsure as an MCP server.
What does sqlsure do?
It checks SQL against a semantic model before execution, looking for join-cardinality problems, unsuitable aggregations, and sensitive output columns. For a violation, it provides a suggested correction.
Does sqlsure connect to a database?
No. It inspects query text offline. A model can be built from a database catalog, among other sources.