ConfigsJul 22, 2026·2 min read

SQL Chat — Chat-Based SQL Client Powered by AI

A chat-based SQL client that converts natural language to SQL queries. Supports MySQL, PostgreSQL, SQL Server, TiDB, and more with a modern conversational interface.

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 29/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
CLI Tool
Install
Single
Trust
Trust: Established
Entrypoint
SQL Chat
Safe staging command
npx -y tokrepo@latest install e13ecd64-85a9-11f1-9bc6-00163e2b0d79 --target codex

Stages files first; activation requires review of the staged README and plan.

Introduction

SQL Chat is an open-source, chat-based SQL client that lets you query databases using natural language. Instead of writing raw SQL, you describe what you want in plain English and the AI generates and executes the query against your connected database.

What SQL Chat Does

  • Converts natural language questions to SQL queries
  • Connects to MySQL, PostgreSQL, SQL Server, TiDB, and more
  • Provides an interactive chat interface for iterative data exploration
  • Shows query results in formatted tables alongside the generated SQL
  • Maintains conversation context for follow-up questions

Architecture Overview

SQL Chat is a Next.js application with a chat-style frontend. The backend connects to your database via standard drivers and uses OpenAI-compatible APIs for natural language to SQL translation. Database credentials stay local to your deployment and are never sent to external services beyond the LLM provider.

Self-Hosting & Configuration

  • Deploy with Docker: docker run -p 3000:3000 sqlchat/sqlchat
  • Or clone the repo and run with pnpm dev
  • Set your OpenAI API key in environment variables
  • Add database connections through the web UI
  • Supports environment-based config for team deployments

Key Features

  • Natural language to SQL with contextual follow-up queries
  • Multi-database support including MySQL, PostgreSQL, TiDB, and more
  • Self-hostable with Docker for data privacy
  • Schema-aware query generation using database metadata
  • Conversation history for iterative data exploration

Comparison with Similar Tools

  • Vanna — Python-based text-to-SQL; SQL Chat offers a ready-to-use web UI
  • Chat2DB — Java-based database client; SQL Chat is lighter with a chat-first design
  • DBeaver — Traditional GUI client; SQL Chat focuses on natural language interaction
  • WrenAI — Semantic layer approach; SQL Chat connects directly to databases

FAQ

Q: Which LLM providers are supported? A: OpenAI by default, with support for any OpenAI-compatible API endpoint.

Q: Is my data sent to external servers? A: Only the schema metadata and your query text go to the LLM. Actual data stays between your deployment and the database.

Q: Can I use it with local LLMs? A: Yes, point the API endpoint to a local OpenAI-compatible server like Ollama or LiteLLM.

Q: What databases are supported? A: MySQL, PostgreSQL, SQL Server, TiDB, CockroachDB, ClickHouse, Snowflake, MongoDB, Redis, Oracle, and SQLite.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets