# sqlsure

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.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 99
- Author: sqlsure
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/sqlsure/sqlsure
- Updated: 2026-07-18
- HTML: https://affpapa.org/en/nevibecode/mcp/sqlsure

## What it 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.

## Requirements
- Needs: Python and uv (commands run via uvx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add sqlsure -- uvx sqlsure
```
uvx runs the command named after the package; if the README names another one, use uvx --from sqlsure <command>

### Codex

**Platform CLI**
```bash
codex mcp add sqlsure -- uvx sqlsure
```
uvx runs the command named after the package; if the README names another one, use uvx --from sqlsure <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "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>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "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>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add sqlsure uvx sqlsure
```
uvx runs the command named after the package; if the README names another one, use uvx --from sqlsure <command>

## When to use it
- 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
- 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.

## Similar
- [World Monitor](https://affpapa.org/en/nevibecode/mcp/world-monitor.md) — MCP server · ★ 89408
- [Scrapling MCP Server](https://affpapa.org/en/nevibecode/mcp/scrapling-mcp-server.md) — MCP server · ★ 89433
- [MCP Toolbox for Databases](https://affpapa.org/en/nevibecode/mcp/googleapis-mcp-toolbox-for-databases.md) — MCP server · ★ 16717
- [PostHog MCP Server](https://affpapa.org/en/nevibecode/mcp/posthog-mcp-server.md) — MCP server · ★ 40409
- [dbx](https://affpapa.org/en/nevibecode/mcp/dbx.md) — MCP server · ★ 27669
- [Metabase](https://affpapa.org/en/nevibecode/mcp/metabase.md) — MCP server · ★ 49845

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
