People ask ChatGPT to write SQL and then wish it could just run the query against their actual data. With the AI2SQL app it can, without giving a general-purpose assistant unrestricted access to a database that matters.
Set it up in 3 steps
- Install AI2SQL in ChatGPT. Open the AI2SQL app in the ChatGPT plugin directory and add it.
- Sign in. ChatGPT opens AI2SQL; sign in (or create an account) and press Allow.
- Ask a question. Start with the sample store: "Use AI2SQL to show the top 5 customers by revenue in demo_shop."
To use your own data, connect a PostgreSQL, MySQL or SQL Server database in the AI2SQL dashboard. It shows up in ChatGPT on the next question. Credentials are encrypted and stay on the AI2SQL server.
What ChatGPT can do through AI2SQL
- Read your schema so it writes SQL against tables and columns that exist.
- Run read-only queries: one
SELECTorWITHper call, up to 1,000 rows. - Write, fix, explain and convert SQL between dialects.
What ChatGPT can't do through AI2SQL
- Write anything. INSERT, UPDATE, DELETE and DDL are blocked before they reach your database.
- See your password. It holds a sign-in token you can revoke; your database credentials never leave the encrypted store.
- Act unlogged. Every query is recorded in Agent activity in the AI2SQL dashboard, including blocked attempts.
Adding it by hand in developer mode
If you prefer to add the server yourself, turn on developer mode in ChatGPT's connector settings,
create a connector with the URL https://builder.ai2sql.io/api/chatgpt-mcp and OAuth
authentication, and sign in to AI2SQL when ChatGPT asks.
Why a gateway instead of a direct connection
A chat assistant is exactly the case where you don't want a raw database connection: its output can be confidently wrong, and a chat makes it easy to run a query nobody reviewed. Read-only enforcement, bounded results and an audit trail make "connect ChatGPT to my database" a safe idea. More in is it safe to connect AI to your production database?
Running queries on your own database is part of the Pro and Team plans, which start with a 7-day trial. demo_shop works on every plan. The same server also works from Claude, Cursor, Gemini CLI and n8n.