sqlsure
AI writes your SQL. sqlsure makes sure it's right.
接入你的智能体
發布者自己的指令。不是 PlugMCP 端點。
用我們的金鑰與日誌託管一份副本。
uvx sqlsure==0.1.1Claude Code 沒有本機指令的安裝連結。複製下方指令並在終端機中執行。
claude mcp add io.github.sqlsure-sqlsure -- uvx sqlsure==0.1.1在終端機中執行。
{ "mcpServers": { "io.github.sqlsure-sqlsure": { "command": "uvx", "args": [ "sqlsure==0.1.1" ] } }}claude_desktop_config.json
遠端 URL 還是本機指令? 兩種安裝方式的差異
A query can be perfectly valid, run without error, and return a number that's silently wrong — revenue double-counted by a join, an average summed, a patient identifier exposed. Databases don't catch this. Linters don't catch this. LLMs reviewing their own SQL don't catch this.
sqlsure does — deterministically, in 0.1 ms, before the query runs.
Proof, not promises: we ran sqlsure over the gold answers of the two benchmarks every text-to-SQL model is graded on. 2,568 expert-written queries, 45 flags, zero false alarms — including a BIRD dev gold answer that is provably wrong by 8× from the exact bug class sqlsure targets, and a schema defect now filed upstream.
sqlsure judges SQL against facts your team already declared — dbt unique
tests become grain, relationships tests become join cardinality, one-line
meta tags mark what's safe to sum. No new language to learn, no model to
maintain by hand. Rules are dictionary lookups, not LLM calls: same input,
same verdict, every time, offline.
Every rejection carries a machine-actionable fix, so AI agents
self-repair: draft → check → fix → check → execute. In our benchmark,
applying the fix verbatim produced a passing query 10/10 times.
pip install sqlsure
from sqlsure import SemanticModel, check
violations = check(sql, model) # [] means semantically safe
Or clone and run the 30-second demo:
python check.py # 5 wrong queries rejected, 1 approved — with fixes
python -m sqlsure.scan path/to/dbt-repo --report report.md # audit any dbt repo
1. CI gate — blocks the merge when a PR double-counts:
python -m sqlsure.cli --model model.json query.sql # exit 1 on violations
2. MCP server — your AI agent must pass inspection before executing:
claude mcp add sqlsure -- python -m sqlsure.mcp_server --model /abs/path/model.json
See docs/MCP.md for tool reference and agent-loop patterns.
3. Library — embed check() inside any text-to-SQL product or agent
framework. A drop-in SemanticGate wraps
Vanna/WrenAI-style generators; a
semantic eval metric scores NL2SQL output
where execution-accuracy is blind.
Also available as an Agent Skill — a single SKILL.md your agent loads directly; no server process needed.
When sqlsure can't verify something, it says "can't verify" — never "looks fine." Honest uncertainty is a feature.
dbt (works today): manifest.json or schema.yml — the tests teams
already wrote become enforceable semantics, zero config
Plain PK/FK declarations (works today — powered the benchmark audits)
The live database itself (works today): no semantic layer at all?
sqlsure.introspect builds the rulebook from the catalog — SQLite
PRAGMAs or information_schema PK/FK (postgres/mysql). Introspecting
BIRD's own database files recovered 2 foreign keys missing from the
benchmark's published schema
(bird-bench/mini_dev#37)
from sqlsure.introspect import model_from_sqlite
model = model_from_sqlite("app.db") # PK -> grain, FK -> join edges
Hand-written JSON — model.example.json
OSI and WrenAI MDL (working loaders in
integrations/): OSI
demonstrated on the spec's published examples;
WrenAI MDL demonstrated on WrenAI's own
shipped example manifest — primaryKey → grain, relationship
joinType + condition → join edges, cube measures → additivity
Cube, Snowflake Semantic Views — adapters on the roadmap; the
engine only ever sees one SemanticModel
Apache-2.0 · sqlsure.ai
mcp-name: io.github.sqlsure/sqlsure
Semantic SQL inspector: catches double-counting, wrong joins, PII exposure before execution.
{ "mcpServers": { "io.github.sqlsure-sqlsure": { "command": "uvx", "args": [ "sqlsure==0.1.1" ] } }}工具
尚無工具清單。遠端伺服器會在首次健康檢查後取得工具清單。
常見問題
在本頁複製適用於 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 設定。它使用發布者的安裝方式,而不是 PlugMCP 代理伺服器。
這筆記錄未列出必要的環境變數。
Sqlsure 透過 stdio 在本機執行。
上次檢查時間:2026-11-10。 Semantic SQL inspector: catches double-counting, wrong joins, PII exposure before execution.