# sqlike-mcp

sqlike-mcp — an MCP server that checks SQL queries for errors, anti-patterns and suggests indexes. Compares two queries to verify a rewrite did not change the result.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 8 repo stars
- Author: orifisher2
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/orifisher2/sqlike
- Updated: 2026-10-24
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/sqlike-mcp

## What it does

The server tokenizes SQL locally and forwards it to a remote analysis engine, which returns a list of issues from a catalog of 172 rules: syntax errors, unsafe patterns like a `LEFT JOIN` turning into an `INNER`, a missing `WHERE` in an `UPDATE`. The engine also compares two queries and reports if they are equivalent — this verifies that a rewritten query by an LLM did not lose rows. Identifiers and literals are masked before transmission.

Two commands: `analyze` takes a query, optional schema (`CREATE TABLE`), table statistics and an execution plan, returns JSON with findings and index advice; `diff` compares two queries and gives a verdict (`Equivalent`, `Differs`, `Undecided`) with a report on columns, rows, cardinality. Supports Postgres, MySQL, MariaDB, SQLite, SQL Server, DuckDB. Without `SQLIKE_API_KEY`, the anonymous rate limit applies.

Requires Node.js and access to `sqlike.com`. The analysis engine is closed and does not run locally.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `SQLIKE_API_KEY` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add sqlike-mcp -e SQLIKE_API_KEY=<SQLIKE_API_KEY> -- npx -y @sqlike/mcp
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add sqlike-mcp --env SQLIKE_API_KEY=<SQLIKE_API_KEY> -- npx -y @sqlike/mcp
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "sqlike-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@sqlike/mcp"
            ],
            "env": {
                "SQLIKE_API_KEY": "<SQLIKE_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "sqlike-mcp": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@sqlike/mcp"
            ],
            "env": {
                "SQLIKE_API_KEY": "<SQLIKE_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e SQLIKE_API_KEY=<SQLIKE_API_KEY> sqlike-mcp npx -y @sqlike/mcp
```
Replace <…> with your own values

## When to use it
- check an SQL query before it runs against the database
- catch anti-patterns like a missing `WHERE` in an `UPDATE`
- verify that a rewritten query returns the same rows
- get index recommendations for a specific database engine

## Example prompts
- Analyze `SELECT * FROM orders WHERE status = 'pending'` and tell me what's wrong
- Check if the two queries in `before.sql` and `after.sql` are equivalent
- Suggest indexes for this query, here's the schema from `schema.sql` and the `EXPLAIN` plan

## Similar
- [DBHub](https://affpapa.org/en/nevibecode/mcp/dbhub.md) — MCP server · ★ 3890 repo stars
- [Faucet](https://affpapa.org/en/nevibecode/mcp/faucet.md) — MCP server · ★ 177 repo stars
- [sql-database-assistant](https://affpapa.org/en/nevibecode/skills/sql-database-assistant.md) — skill · 727 installs
- [drizzle-orm](https://affpapa.org/en/nevibecode/skills/oakoss-drizzle-orm.md) — skill · 263 installs
- [DB Explorer](https://affpapa.org/en/nevibecode/mcp/db-explorer.md) — MCP server · ★ 8 repo stars
- [quarry](https://affpapa.org/en/nevibecode/mcp/quarry.md) — MCP server · ★ 5 repo stars

---
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
