MCP Catalogs
Home

ChatSQL

by thomasjerard·0·Score 30

ChatSQL converts natural language questions to PostgreSQL queries using Gemini and FastMCP protocol.

databaseai-llmdeveloper-tools
0
Forks
0
Open issues
11 mo ago
Last commit
2d ago
Indexed

Overview

ChatSQL is a command-line tool that enables users to query PostgreSQL databases using natural language. It leverages Google Gemini for natural language to SQL conversion and FastMCP for executing queries against the database. The tool creates a seamless experience where users can ask questions in plain English and receive valid SQL results instantly.

Try asking AI

After installing, here are 5 things you can ask your AI assistant:

you:Business analysts querying databases without SQL knowledge
you:Quick data exploration by asking questions instead of writing queries
you:Educational tool for learning SQL through natural language interaction
you:What databases are supported?
you:Can I use this with other LLMs besides Gemini?

When to choose this

Choose ChatSQL if you're using PostgreSQL and want to allow non-technical users to query databases with natural language, with minimal setup.

When NOT to choose this

Avoid ChatSQL if you need support for multiple database types, advanced query features, or if you're concerned about security with sending sensitive database queries to external APIs.

Tools this server exposes

1 tool extracted from the README
  • query_database

    Execute a SQL query against the PostgreSQL database

Note: Inferred from the description and example use case. The README doesn't explicitly list tool names but describes functionality where natural language is converted to SQL and executed against a database.

Comparable tools

sql-mcppostgres-mcpduckdb-mcp

Installation

Installation

  1. Clone the repository:
git clone https://github.com/thomasjerard/ChatSQL.git
cd chatSQL
  1. Create a .env file with your database credentials and Gemini API key:
DB_NAME=chattosql
DB_USER=postgres
DB_PASS=yourpassword
DB_HOST=localhost
DB_PORT=5432
GEMINI_API_KEY=your-gemini-api-key
  1. Run the server in one terminal:
./run_server.sh
  1. Run the client in another terminal:
./run_client.sh

To use with Claude Desktop, add to your config.json:

{
  "mcpServers": {
    "chatsql": {
      "command": "python",
      "args": ["path/to/chatsql/server.py"]
    }
  }
}

FAQ

What databases are supported?
Currently, only PostgreSQL is supported through the psycopg2 library.
Can I use this with other LLMs besides Gemini?
The current implementation is specifically designed for Google Gemini, though the architecture could potentially be adapted for other LLMs.

Compare ChatSQL with

GitHub →

Last updated · Auto-generated from public README + GitHub signals.