sql-review-agent
Enables reviewing BigQuery SQL queries for performance issues, cost estimation, and suggested rewrites via an MCP interface.
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:
- Dry-runs it — gets the estimated bytes scanned (= cost) without executing
- Reads your schema — understands partition keys, clustering, column types
- Flags issues — full table scans, missing partition filters, cartesian joins,
SELECT * - Suggests a rewrite — returns improved SQL with explanation
- 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
- CLI —
python 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)
- BigQuery —
dry_runfor 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
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.