Traditional SQL proxies — connection poolers and query routers — forward traffic from applications you wrote and trust. An AI agent is a different kind of client: it writes its own SQL from natural language, and that SQL can be steered by whatever text lands in its context. A read-only SQL proxy for AI is built for that client. Its job is not routing traffic; it is deciding whether each query may run at all.
A read-only database role is the right first layer, and you should keep it. But it enforces one property — no writes — and it has to be configured correctly in every database you connect. On its own it does not stop an agent from:
Model Context Protocol clients such as Claude Desktop and Cursor make it easy to hand an agent a database tool — and just as easy to hand it a raw connection string. QueryShield ships as an MCP server (pip install queryshield-mcp) that calls the proxy with a scoped API key, so the MCP client gets read-only, policy-bound database access and never holds the credential.
For a single trusted analyst agent on a non-sensitive replica, a read-only role with a statement timeout may be all you need. Reach for a read-only SQL proxy when agents take untrusted input, when several agents need different scopes, or when you must prove after the fact what each agent read.
A secure SQL proxy for AI agents: natural language in, SELECT-only validated SQL out, per-agent row-level security, and an append-only audit log. Your agents never see connection strings.