Your head of sales types a simple question into an AI assistant: "Which of our customers in Germany haven't renewed yet?" Ten seconds later there's a tidy list of company names, contact emails, and contract values on the screen.
It feels like magic. But between the question and the answer, your data took a trip. It left your database, crossed at least one network, landed inside an AI model's working memory, and may have been written to a few log files along the way. Most teams connecting AI to their data have never actually traced that route.
That's what this article does. We'll follow one question from start to finish, name every stop it makes, and spell out what each stop can see, keep, and log. No deep security background required — if you can picture a package moving through a delivery network, you can follow along.
The short version: the AI sees the answer, not the database
The single most useful thing to understand is this: in a well-designed setup, the AI model never touches your database directly. It never holds your password, and it can't browse your tables like a file cabinet.
What it does see is everything a query sends back. If the answer contains 200 customer emails, the model has read 200 customer emails.
So the honest privacy question isn't "can the AI get into my database?" It's "what ends up in the results, and where do those results travel?" Keep that in mind as we walk the route.
The journey, stop by stop
Most modern setups use the Model Context Protocol (MCP) — an open standard that lets an AI assistant call "tools" provided by a separate program, called an MCP server. For databases, that server is the piece that actually holds the connection and runs queries. Here's the trip a single question takes:
Stop 1 — Your chat app. You type the question into an AI client (a chat app, an IDE, an internal tool). The client sends your question, plus the conversation so far, to the AI model.
Stop 2 — The AI model (first pass). The model reads your question and decides it needs data. It typically asks the MCP server for the database schema — the list of tables and columns — so it knows what's available. Note: the schema is metadata (table names like customers, columns like renewal_date), not your actual rows. Then it writes a SQL query.
Stop 3 — The MCP server. This is the gatekeeper. It receives the SQL, checks it against its rules (for example, "only SELECT statements allowed"), and runs it using credentials the AI never sees.
Stop 4 — Your database. The query runs. The database returns rows — real customer names, real emails, real numbers.
Stop 5 — Back through the MCP server. The results flow back to the server, which passes them to the AI client. Some servers trim, cap, or mask results at this point; many don't.
Stop 6 — The AI model (second pass). The rows are inserted into the model's context — its short-term working memory for this conversation. The model reads them and writes your friendly summary or chart.
Stop 7 — Your screen, and the conversation history. You see the answer. The full exchange, including the raw results, is often saved in your chat history.
Here's the same route as a cheat sheet:
| Stop | Sees your actual rows? | Holds DB credentials? | Might keep a copy? |
|---|---|---|---|
| Chat app / AI client | Yes (the results) | No | Yes — chat history |
| AI model provider | Yes (the results, in context) | No | Depends on your plan's retention terms |
| MCP server | Yes (passes them through) | Yes | Often — query and audit logs |
| Database | It is the data | — | Its own query logs |
Notice the pattern: credentials stay in one place, but results travel everywhere. That's by design, and it's a good design — but it means your attention belongs on the results.
The four places your data can linger
"Where does it go" is half the question. The other half is "where does it stay." There are four common resting places.
1. Chat history
The simplest and most overlooked. If a teammate asks for "all overdue invoices with customer contact details," those details now sit in their chat history — possibly synced across devices, possibly shared if they share the conversation. Treat an AI chat that touched production data the same way you'd treat an exported spreadsheet.
2. The AI provider
Whatever enters the model's context is processed on the provider's servers (unless you run a model locally). Whether that data is retained, for how long, and whether it can ever be used for training depends on your specific plan and contract — consumer, team, enterprise, and API terms often differ, and providers update these policies over time. Don't assume; read the current data-usage terms for the exact plan your team uses, and check whether options like zero-data-retention are available to you.
3. The MCP server's logs
A good MCP server logs every query it runs: who asked, what SQL ran, when. That's valuable for auditing. But check whether it also logs the results. Query text like SELECT email FROM customers WHERE country = 'DE' is fine to keep; a log full of the actual emails is a second copy of your customer list you now have to protect.
4. Your database's own logs
Slow-query logs and audit logs on the database side capture SQL text and sometimes parameter values. This isn't new with AI, but AI tends to generate many more ad-hoc queries, so these logs grow faster than they used to.
Five practical ways to shrink the footprint
You don't need to stop using AI on your data. You just need to send less of it on the trip.
1. Ask for aggregates, not rows. "How many German customers haven't renewed, and what's the total contract value?" returns two numbers. "Which German customers haven't renewed?" returns a list of names and emails. Both answer the business question; only one moves personal data around. Train your team to ask the aggregate question first.
2. Cap result sizes at the server. A model rarely needs 50,000 rows to answer a question. A server-side row limit means a sloppy query can't accidentally pour your entire users table into a chat window.
3. Point the AI at a reporting view, not raw tables. A database view is a saved query that looks like a table. Create one that leaves out sensitive columns, and give the AI access to that instead:
CREATE VIEW reporting.customer_renewals AS
SELECT customer_id, country, plan, contract_value, renewal_date
FROM customers; -- no name, email, or phone columns
Now even a careless question can't return contact details, because they're not in the view at all.
4. Keep credentials off the trip entirely. Use a setup where the database credentials live only in the MCP server and the AI connects via a scoped sign-in (like OAuth) instead of a pasted connection string. The model should never see a password, and access should be revocable in one click.
5. Decide your log policy on purpose. Log the question and the SQL; avoid logging full results. Set a retention period for chat history in workspaces that touch production data.
Common mistakes
- Assuming "read-only" means "private." Read-only stops the AI from changing data. It does nothing to limit what the AI reads and passes along. Both matter, and they're different controls.
-
Forgetting that schema is information too. Column names like
layoff_candidateoracquisition_target_flagreveal plenty without a single row. Review what your schema says about you. - Treating chat history as ephemeral. It's not. It's often the longest-lived copy of the data in the whole chain.
- Using a personal AI account for company data. Personal and business plans frequently have different retention and training terms. Use the account your company has actually reviewed.
- Testing on production "just this once." The first exploratory session is usually the one that pulls the widest, least-filtered results.
Key takeaways
- The AI model doesn't touch your database — but it reads every row a query returns.
- Credentials should live in exactly one place: the MCP server (or equivalent broker).
- Your data can linger in four places: chat history, the AI provider, the MCP server's logs, and the database's logs.
- The biggest wins are cheap: ask aggregate questions, cap result sizes, expose a trimmed reporting view, and choose your logging policy deliberately.
- Check the current data-usage terms of the exact AI plan your team uses — they vary and they change.
If you're evaluating tools, ask vendors to walk you through this exact route. A managed, read-only MCP server — Draxlr's is one example — keeps credentials server-side and connects over OAuth, but the questions above apply to any setup you choose.
Your turn
Have you traced where your data goes when your team uses AI on it? Did anything surprise you — a log you didn't know existed, or a chat history full of customer emails? Share what you found (or what your team's rules are) in the comments.
Top comments (0)