Claude MCP SQL Server: Let Claude Query Your Database
A Claude MCP SQL server lets Claude — whether you use Claude Desktop, Claude Code, or the API — read and query your SQL database over the Model Context Protocol. Once it’s wired up, you can ask Claude questions about your real data in plain English and it will inspect the schema, write the SQL, and answer with live rows.
Anthropic created MCP, so Claude has first-class support for it. That makes Claude one of the smoothest clients to connect to a database.
What you get
Ask Claude “what were our top 10 products by revenue last quarter?” and, instead of guessing, it queries your database through the MCP SQL server and answers from real data. It works for schema exploration, ad-hoc analysis, debugging data issues, and drafting reports — all without you writing SQL.
Critically, the AI2SQL gateway is read-only by default: Claude can SELECT and answer, but the SQL guard rejects any DROP, DELETE, or UPDATE before it reaches your database. See is it safe to connect AI to a database.
Setup
- Connect your database once at AI2SQL and grab your API key and connection ID.
- Add the server to your Claude MCP config:
{
"mcpServers": {
"ai2sql": {
"url": "https://builder.ai2sql.io/api/mcp",
"headers": {
"x-ai2sql-key": "sk_live_your_key",
"x-ai2sql-connection": "conn_your_database"
}
}
}
}
- Restart Claude. The
ai2sqltools appear, and Claude can now query your database.
For Claude Desktop, edit claude_desktop_config.json. For Claude Code, add it to your MCP settings. Both use the same server block above.
Which databases work
The same Claude MCP SQL server connects to Postgres, MySQL, Microsoft SQL Server, SQLite, Snowflake, and more — Claude writes correct dialect-specific SQL for each. Postgres users can follow the dedicated connect Claude to Postgres guide.
Prefer Cursor or ChatGPT?
The same gateway works for other clients:
Connect Claude to your data
Get your Claude MCP SQL server running in a couple of minutes — read-only by default, free to start.