sql-review-agent

sql-review-agent

Enables reviewing BigQuery SQL queries for performance issues, cost estimation, and suggested rewrites via an MCP interface.

Category
Visit Server

README

SQL Review Agent

An agentic AI system that reviews BigQuery SQL queries before you run them — catching performance issues, estimating cost, and suggesting rewrites.

Work in progress. Building incrementally — check back for updates.


What it does

Paste a BigQuery SQL query and the agent:

  1. Dry-runs it — gets the estimated bytes scanned (= cost) without executing
  2. Reads your schema — understands partition keys, clustering, column types
  3. Flags issues — full table scans, missing partition filters, cartesian joins, SELECT *
  4. Suggests a rewrite — returns improved SQL with explanation
  5. Reports severity — low / medium / high / critical
Input SQL
    │
    ▼
dry_run()          get_schema()
→ bytes scanned    → partition keys, types, row count
    │
    ▼
Issue detection + rewrite suggestion
    │
    ▼
ReviewReport (cost · issues · rewritten SQL · severity)

Three trigger modes

  • CLIpython agent.py --sql "SELECT * FROM ..."
  • Web UI — paste SQL in browser, see review results
  • MCP — any MCP-compatible client (Claude Code, OpenClaw, Cursor, Zed)

Stack

  • Claude / Gemini — LLM provider (auto-detected, free Gemini supported)
  • BigQuerydry_run for cost estimation, schema introspection
  • Flask — web UI
  • FastMCP — MCP server
  • pytest — test suite

Setup

git clone https://github.com/ARAVINDHRAJA123/sql-review-agent.git
cd sql-review-agent
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt

export GCP_PROJECT=your-project
export BQ_LOCATION=asia-south1
export GEMINI_API_KEY=your-key   # free: aistudio.google.com
# or: export ANTHROPIC_API_KEY=your-key

gcloud auth application-default login

Project structure

sql-review-agent/
├── agent.py          ← agentic review loop (coming Day 3)
├── server.py         ← Flask web UI (coming Day 4)
├── mcp_server.py     ← FastMCP server (coming Day 5)
├── tools/
│   ├── bq_tools.py   ← dry_run, schema, metadata (coming Day 2)
│   └── sql_tools.py  ← SQL parsing helpers (coming Day 2)
├── tests/
├── docs/
└── requirements.txt

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured