SQLike
Provides SQL static analysis and query-equivalence checking for MySQL, with support for dialect-specific validation, anti-pattern detection, and schema-aware optimization advice.
Provides SQL static analysis and query-equivalence checking for SQLite, with support for dialect-specific validation, anti-pattern detection, and schema-aware optimization advice.
sqlike: MCP server and CLI
Check your SQL before it runs, and check whether a rewrite still returns the same results.
sqlike reads a query and tells you what is wrong with it: validity errors, anti-patterns, rewrites it can apply for you, and index advice. It also compares two queries and reports whether the second one still returns the same results. There is no model anywhere in the analysis, so the same query always gets the same answer.
This repository holds the clients: an MCP server, a CLI, and the library they share. They tokenize your SQL locally, so identifiers and literals are masked before anything leaves your machine, and forward only the tokenized query. The analysis engine is not in this repo. It runs server-side and is closed.
Dialects: Postgres, MySQL, MariaDB, SQLite, SQL Server, and DuckDB. Each rule carries a verdict measured on that engine, so the severity you get is that database's behaviour and not Postgres by inheritance. DuckDB is the columnar one: it has no general-purpose secondary index, so the ten index advisors are replaced there by four columnar ones.
Why
A lot of SQL is written by an AI now, and the SQL it writes reads well more often than it runs
correctly. A LEFT JOIN turns into an INNER and rows quietly disappear. A WHERE goes missing and
the UPDATE hits every row. Two tables get joined on the wrong key. None of it looks wrong on the
page, and none of it shows up until it has already done something.
sqlike is the check in between. It flags unsafe patterns from a catalog of 170 rules, each one
verified against a real database before it ships, and it decides whether a rewrite preserves results.
That second check is sound rather than complete: it certifies the rewrites it can prove, and when it
cannot prove one it answers Undecided instead of guessing. Undecided never means equivalent.
Because nothing is generated, there is no retry loop, no per-token cost, and no variance between two runs on the same input. The equivalence check normalizes rather than solves, so it answers in about a millisecond where the state-of-the-art academic prover takes hundreds. That is measured head to head, including the queries where the prover wins.
Related MCP server: Boyce
Install the MCP server
Add it to any MCP client (Claude Code, Claude Desktop, Cursor, and so on):
{
"mcpServers": {
"sqlike": { "command": "npx", "args": ["-y", "@sqlike/mcp"] }
}
}Or install it through Smithery. Set SQLIKE_API_KEY
if you have a key and want the higher rate limits. Without one you get the anonymous tier, which
needs no signup.
Tools
analyze
Static analysis of one query: validity, anti-patterns, suggested rewrites, and schema and index advice. Returns the JSON analysis envelope.
Argument | Type | Description |
| string | The query to analyze. Required. |
| string | Optional DDL ( |
| string |
|
| boolean | Only used when a query fails to parse, and so cannot be tokenized: send the raw SQL to get a parse diagnostic. Default |
diff
Checks whether two queries are equivalent, which is the judgement an LLM cannot reliably make about
its own rewrite. Returns a verdict (Equivalent, EquivalentWithNotes, Differs, or Undecided),
a confidence level, and a report per property (columns, rows, cardinality, order), so you see what
changed rather than a single yes or no.
Argument | Type | Description |
| string | The original query. Required. |
| string | The rewritten query to check against |
| string | Optional DDL both queries resolve against (one shared schema). |
| string |
|
CLI
The same checks from a terminal or a CI job. Run it with no install, or put it on the path:
npx -y @sqlike/cli --help
npm i -g @sqlike/cli
brew install orifisher2/sqlike/sqlike# analyze a query
sqlike check query.sql --remote https://api.sqlike.com
# with a schema, reading from stdin, machine-readable output
cat query.sql | sqlike check - --schema schema.sql --json --remote https://api.sqlike.com
# check that a rewrite is equivalent (this one always runs server-side)
sqlike diff before.sql after.sqlIf you have the query's EXPLAIN output, pass it with --explain plan.json and the real access
paths will confirm or dismiss the index findings. The plan is tokenized before it leaves the machine,
same as the query and the schema.
check exits 0 when the query is clean, 1 on advisories, and 2 when something blocks. diff exits
0 for equivalent, 1 for differs, and 2 for undecided. Both use 3 for an operational failure, so a
pipeline can tell "the query is bad" from "the call did not go through".
Private by design
Tokenization happens here, on your machine, before any request goes out. sqlike never sees your real table names, columns, or values, so there is nothing to leak and nothing to train on. An AI assistant needs the real thing to help you; sqlike does not.
If a query cannot be parsed it cannot be tokenized, and the client refuses to send it rather than
transmit raw SQL. Sending it anyway is an explicit opt-in (allow_raw on the tools, --allow-raw on
the CLI).
See THREAT-MODEL.md for what that does and does not cover.
What is in this repo
crates/mcp:sqlike-mcp, the MCP server. Ships to npm as@sqlike/mcp.crates/cli:sqlike, the command-line client. Ships to npm as@sqlike/cli.crates/client: the shared forwarder, with no engine in it: tokenize, call the API, detokenize.crates/core-parse: the SQL parser, stage model, tokenizer, and result types.packages/: the npm packaging, with a prebuilt binary per platform.skills/: the agent skill, so a coding agent knows when to reach for sqlike on its own.
Learn more
Try it at sqlike.com. The equivalence checker is measured in public against the standard academic benchmark, including a head-to-head with the state-of-the-art prover, at sqlike.com/benchmark.
Note
This repository is generated from the upstream monorepo, which is the source of truth. Please file issues here. Code changes are made upstream and mirrored back.
License
MIT OR Apache-2.0, at your option.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Generate, fix, explain and run read-only SQL on PostgreSQL, MySQL and SQL Server
Deterministic safety, correctness & cost gate that vets Postgres SQL before your AI agent runs it.
DBRE-grade SQL analysis inside any MCP client. No connection. No install. Paste a query.
Executes SQL in a real ephemeral database: rows, typed errors with suggestions, plans, diffs.
Related MCP Servers
- AlicenseAqualityCmaintenance7 SQL tools (validate, format, parse, lint, security scan, metadata extraction, full analysis) over Streamable HTTP. Supports 6 SQL dialects with 1.25M+ ops/sec.7112Apache 2.0
- AlicenseNot gradedqualityCmaintenanceGive AI agents structured database intelligence. Deterministic SQL, NULL trap detection, EXPLAIN pre-flight. MIT licensed.1MIT
- AlicenseAqualityDmaintenanceProvides SQL analysis, linting, and dialect conversion using SQLGlot, enabling validation, transpilation, and extraction of table/column references.432MIT
- AlicenseNot gradedqualityCmaintenanceValidates SQL queries via AST parsing, ensuring they are single read-only SELECTs on allowed tables with enforced LIMITs, and masks PII columns based on user roles. Provides a tamper-evident audit log and runs fully offline.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/orifisher2/sqlike'
If you have feedback or need assistance with the MCP directory API, please join our Discord server