Listed from the MCP registry; nobody on Odel publishes it.

MCP server: One MCP server.

Sqlike

@orifisher2MCP server · External

Lints SQL and checks rewrites return the same rows. Postgres, MySQL, MariaDB, SQLite, MSSQL, DuckDB

Databasesv0.2.10Apache-2.0Rust
Freeno charge per call

Runs on your machine from its package; the steps are below.

What it does

  1. Reads
  2. Writes
  3. High impact

At most: only reads or looks up information.

What it costs

Free

Odel charges nothing per call. The publisher may charge for its own service.

Runs locally over stdio

This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).

npm@sqlike/mcpv0.2.10

Run

npx -y @sqlike/mcp

MCP client config

{
  "mcpServers": {
    "sqlike": {
      "command": "npx",
      "args": [
        "-y",
        "@sqlike/mcp"
      ]
    }
  }
}
README8 min read

sqlike: MCP server and CLI

@sqlike/mcp @sqlike/cli license

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. No language model takes part 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 on your machine, which replaces identifiers and literals with placeholders, and send only the tokenized query. The analysis engine is not in this repo. It runs server-side and is closed.

It supports Postgres, MySQL, MariaDB, SQLite, SQL Server, and DuckDB. Each rule has a verdict measured on each engine, so the severity you get is the behaviour of your database. DuckDB is columnar and has no general-purpose secondary index, so the ten index advisors are replaced there by four columnar ones.

Why

A query can read well and still be wrong. A LEFT JOIN that became an INNER JOIN drops rows. An UPDATE that lost its WHERE changes every row. A join on the wrong key returns rows that look plausible. These are easy to miss in review, whether a person or an AI model wrote the query.

sqlike checks the query before it runs. It reports unsafe patterns from a catalog of 172 rules, each verified on a real database before it ships. It also checks whether a rewrite returns the same results as the original. It answers Equivalent only when it has a proof, and Undecided when it has none.

The analysis is deterministic, so two runs on the same input give the same result, and there is no per-token cost. A pair the equivalence check decides takes a few milliseconds. The measurements are at sqlike.com/benchmark.

Install the MCP server

Add it to any MCP client (Claude Code, Claude Desktop, Cursor, and so on):

json
{
  "mcpServers": {
    "sqlike": { "command": "npx", "args": ["-y", "@sqlike/mcp"] }
  }
}

No key or account is needed. If you have an API key, set SQLIKE_API_KEY for higher rate limits.

Tools

analyze

Static analysis of one query: validity, anti-patterns, suggested rewrites, and schema and index advice. Returns the JSON analysis envelope.

ArgumentTypeDescription
sqlstringThe query to analyze. Required.
schemastringOptional DDL (CREATE TABLE / CREATE INDEX) for column and type aware checks.
statsstringOptional JSON map of table to row count, e.g. {"orders": 2000000}. Severity and index advice follow volume.
explainstringOptional query plan (Postgres EXPLAIN (ANALYZE, FORMAT JSON), MySQL EXPLAIN FORMAT=JSON, SQLite EXPLAIN QUERY PLAN as .mode json rows, SQL Server SHOWPLAN_XML, DuckDB EXPLAIN (FORMAT JSON)). Confirms or dismisses index findings by what the planner did.
dialectstringpostgres (default), mysql, mariadb, sqlite, mssql, or duckdb.

diff

Checks whether two queries return the same results. Returns a verdict (Equivalent, EquivalentWithNotes, Differs, Undecided, or NotComparable), a confidence level, and a report per property (columns, rows, cardinality, order), which shows what changed.

ArgumentTypeDescription
sql_astringThe original query. Required.
sql_bstringThe rewritten query to check against sql_a. Required.
schemastringOptional DDL both queries resolve against (one shared schema).
dialectstringpostgres (default), mysql, mariadb, sqlite, mssql, duckdb.
columnsstringby_position (default) compares columns in order. by_name is for code that reads columns by name: a moved column is then a note.
ignorestringorder for code that does not depend on the order rows arrive in: two queries that sort by different keys are then a note, not Undecided.

CLI

The same checks from a terminal or a CI job. Run it without installing, or install it:

sh
npx -y @sqlike/cli --help
npm i -g @sqlike/cli
brew install orifisher2/sqlike/sqlike
sh
# analyze a query (the hosted API is the default)
sqlike check query.sql

# several files at once, with a schema
sqlike check migrations/*.sql --schema schema.sql

# read from stdin and print JSON, one record per file
cat query.sql | sqlike check - --schema schema.sql --json

# check that a rewrite is equivalent
sqlike diff before.sql after.sql

Use --remote or SQLIKE_URL for a different server, and --key or SQLIKE_API_KEY for an API key.

If you have the query's EXPLAIN output, pass it with --explain plan.json. Index findings are then confirmed or dismissed by what the planner did. The plan is tokenized before it is sent, like the query and the schema.

Exit codes:

checkdiff
0clean, or nothing at or above --fail-onequivalent
1a warning, when --fail-on warn asks for itdiffers
2a blocking finding: invalid SQL, or a high-severity correctness problemundecided
3the check could not run: unreachable, rate-limited, or unparseablesame
4usage error (a bad flag)same

check defaults to --fail-on block, so advisory findings are reported without failing a build. Use --fail-on warn to fail on warnings, or never to only report. Exit code 3 says nothing about the SQL, so a pipeline can tell a bad query from a call that did not go through.

diff exits 0 for equivalent, and also for notes such as a renamed column. A result's columns are ordered, as SQL defines them, so a rewrite that moves a column differs (1). If your code reads columns by name, --columns by-name compares each name's values instead, and a moved column is a note. Two queries that both sort, by different keys, are undecided (2), since the rows can arrive in another sequence; --ignore order makes that a note, for code that does not depend on row order. --fail-on names,position,order turns those notes into failures.

In CI, and on commit

The GitHub Action and the pre-commit hook run the same checks as the CLI, and tokenize on your machine first.

GitHub Actions

Findings appear inline on the pull-request diff. The workflow authenticates as your repository owner with GitHub's OIDC token, so there is no signup and no API key to store.

yaml
permissions:
  id-token: write        # authenticate as this repo's owner
  pull-requests: read    # check only the files this PR changes
  contents: read         # mode: diff, to read the earlier version of a file
steps:
  - uses: actions/checkout@v5
  - uses: orifisher2/sqlike@cli-v0.4.9
    with:
      dialect: postgres
      schema: db/schema.sql

With mode: diff, each modified file is compared with its earlier version, and the action reports whether the rewrite changed what the query returns. An Undecided verdict does not fail the build. A moved column is a change, since columns are ordered. Set columns: by-name if your code reads them by name.

Pull requests from forks run anonymously. GitHub does not issue OIDC tokens to workflows that a fork triggers, so such a pull request is counted under the anonymous rate limit for its network. There is nothing to configure, and your own branches authenticate as usual.

Outside a pull request there is no set of changed files, so changed-only does not apply and every matching file is checked. The action warns when that happens, because on a large repository it can reach a rate limit.

pre-commit

The same checks before the commit is made:

yaml
repos:
  - repo: https://github.com/orifisher2/sqlike
    rev: cli-v0.4.9
    hooks:
      - id: sqlike
        args: [--dialect, postgres]

The hook blocks a commit on a blocking finding. If sqlike cannot be reached, it says so and lets the commit through.

Privacy

Tokenization runs on your machine before any request is made. The server does not receive your table names, column names or values.

A query that does not parse is reported on your machine and nothing is sent. A query that holds text the tokenizer cannot replace is not sent: the MCP server refuses it, and the CLI sends it only when you pass --allow-raw for that run.

See THREAT-MODEL.md for what tokenization covers and what it does not.

What is in this repo

  • crates/mcp: sqlike-mcp, the MCP server. Published to npm as @sqlike/mcp.
  • crates/cli: sqlike, the command-line client. Published to npm as @sqlike/cli.
  • crates/client: the code both share: tokenize, call the API, detokenize. It has no engine in it.
  • crates/core-parse: the SQL parser, stage model, tokenizer, and result types.
  • packages/: the npm packaging, with a prebuilt binary per platform.
  • skills/: the skill file for coding agents. AGENTS.md has the same instructions for any agent.

Learn more

Try it at sqlike.com. How the rules and the equivalence check are measured is 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

Apache-2.0. See LICENSE.

crates/sqlparser is a vendored copy of sqlparser-rs, also Apache-2.0. Its NOTICE file records the upstream version and lists every file changed since.

Similar modules

Browse Databases