<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mads Hansen</title>
    <description>The latest articles on DEV Community by Mads Hansen (@mads_hansen_27b33ebfee4c9).</description>
    <link>https://dev.to/mads_hansen_27b33ebfee4c9</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3846701%2F6570ac8b-d5e5-413f-9198-dbbfaa431fc1.png</url>
      <title>DEV Community: Mads Hansen</title>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mads_hansen_27b33ebfee4c9"/>
    <language>en</language>
    <item>
      <title>AI agents should prepare database writes, not surprise production</title>
      <dc:creator>Mads Hansen</dc:creator>
      <pubDate>Wed, 27 May 2026 01:28:10 +0000</pubDate>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9/ai-agents-should-prepare-database-writes-not-surprise-production-464f</link>
      <guid>https://dev.to/mads_hansen_27b33ebfee4c9/ai-agents-should-prepare-database-writes-not-surprise-production-464f</guid>
      <description>&lt;p&gt;Read-only AI database access is the default for a reason.&lt;/p&gt;

&lt;p&gt;But eventually teams ask:&lt;/p&gt;

&lt;p&gt;“What if the agent could update the record too?”&lt;/p&gt;

&lt;p&gt;The answer should not be: give the model write access and hope.&lt;/p&gt;

&lt;p&gt;A safer pattern:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;agent prepares the proposed change&lt;/li&gt;
&lt;li&gt;tool runs validation and dry-run checks&lt;/li&gt;
&lt;li&gt;affected rows and scope are shown&lt;/li&gt;
&lt;li&gt;a human or policy gate approves&lt;/li&gt;
&lt;li&gt;execution uses a narrow write tool&lt;/li&gt;
&lt;li&gt;idempotency key prevents duplicate writes&lt;/li&gt;
&lt;li&gt;audit trail records request, approval, execution, and result&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The model can suggest.&lt;br&gt;
The runtime should enforce.&lt;br&gt;
The approver should decide.&lt;/p&gt;

&lt;p&gt;Longer version: &lt;a href="https://conexor.io/blog/approval-gates-for-ai-database-writes?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=content" rel="noopener noreferrer"&gt;Approval gates for AI database writes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Production writes should be boring, bounded, and traceable.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>database</category>
      <category>postgres</category>
      <category>ai</category>
    </item>
    <item>
      <title>AI database answers need receipts, not just confidence</title>
      <dc:creator>Mads Hansen</dc:creator>
      <pubDate>Wed, 27 May 2026 01:27:04 +0000</pubDate>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9/ai-database-answers-need-receipts-not-just-confidence-3ida</link>
      <guid>https://dev.to/mads_hansen_27b33ebfee4c9/ai-database-answers-need-receipts-not-just-confidence-3ida</guid>
      <description>&lt;p&gt;An AI answer about business data should not be a dead end.&lt;/p&gt;

&lt;p&gt;If someone asks:&lt;/p&gt;

&lt;p&gt;“Where did that number come from?”&lt;/p&gt;

&lt;p&gt;The system should not respond with vibes.&lt;/p&gt;

&lt;p&gt;It should be able to show:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;who asked&lt;/li&gt;
&lt;li&gt;which tool ran&lt;/li&gt;
&lt;li&gt;which database role was used&lt;/li&gt;
&lt;li&gt;which tenant/workspace scope applied&lt;/li&gt;
&lt;li&gt;which query or approved view produced the result&lt;/li&gt;
&lt;li&gt;how many rows came back&lt;/li&gt;
&lt;li&gt;whether the result was truncated&lt;/li&gt;
&lt;li&gt;when it happened&lt;/li&gt;
&lt;li&gt;which audit record proves it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is the difference between a useful demo and an audit-ready MCP database workflow.&lt;/p&gt;

&lt;p&gt;Model confidence is not evidence.&lt;br&gt;
A tool-call receipt is evidence.&lt;/p&gt;

&lt;p&gt;Longer version: &lt;a href="https://conexor.io/blog/audit-ready-mcp-database-workflows?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=content" rel="noopener noreferrer"&gt;Audit-ready MCP database workflows&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Production AI systems need answers with receipts.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>database</category>
      <category>ai</category>
      <category>security</category>
    </item>
    <item>
      <title>AI database agents need dead-letter queues</title>
      <dc:creator>Mads Hansen</dc:creator>
      <pubDate>Tue, 26 May 2026 01:43:04 +0000</pubDate>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9/ai-database-agents-need-dead-letter-queues-3i1h</link>
      <guid>https://dev.to/mads_hansen_27b33ebfee4c9/ai-database-agents-need-dead-letter-queues-3i1h</guid>
      <description>&lt;p&gt;An AI database agent should not turn one confusing question into an infinite retry loop.&lt;/p&gt;

&lt;p&gt;When a query fails, a schema changed, a policy blocks access, or a model cannot resolve ambiguity, the safe answer is not:&lt;/p&gt;

&lt;p&gt;“Try again forever.”&lt;/p&gt;

&lt;p&gt;The safe answer is:&lt;/p&gt;

&lt;p&gt;Stop. Preserve the evidence. Put the item somewhere inspectable.&lt;/p&gt;

&lt;p&gt;For MCP database workflows, a dead-letter record should include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;original user request&lt;/li&gt;
&lt;li&gt;tool name and parameters&lt;/li&gt;
&lt;li&gt;policy/scope decision&lt;/li&gt;
&lt;li&gt;query ID if one exists&lt;/li&gt;
&lt;li&gt;error type&lt;/li&gt;
&lt;li&gt;retry count&lt;/li&gt;
&lt;li&gt;model/tool output snapshot&lt;/li&gt;
&lt;li&gt;next human-readable action&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A timeout can retry.&lt;br&gt;
A missing tenant scope should not.&lt;br&gt;
A write approval failure should not.&lt;br&gt;
An ambiguous metric definition should not.&lt;/p&gt;

&lt;p&gt;Longer version: &lt;a href="https://conexor.io/blog/dead-letter-queues-for-ai-database-agents?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=content" rel="noopener noreferrer"&gt;Dead-letter queues for AI database agents&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Agent reliability is not “never fail.” It is failing in a way the team can inspect and recover from.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>database</category>
      <category>ai</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Tenant scope should not be a prompt instruction</title>
      <dc:creator>Mads Hansen</dc:creator>
      <pubDate>Tue, 26 May 2026 01:41:58 +0000</pubDate>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9/tenant-scope-should-not-be-a-prompt-instruction-50pb</link>
      <guid>https://dev.to/mads_hansen_27b33ebfee4c9/tenant-scope-should-not-be-a-prompt-instruction-50pb</guid>
      <description>&lt;p&gt;The most dangerous AI database bug is rarely a syntax error.&lt;/p&gt;

&lt;p&gt;It is the query that works, returns a polished answer, and quietly includes the wrong tenant.&lt;/p&gt;

&lt;p&gt;For MCP database servers, tenant scope should not live in the prompt:&lt;/p&gt;

&lt;p&gt;“Only answer for the current customer.”&lt;/p&gt;

&lt;p&gt;That is a preference, not a boundary.&lt;/p&gt;

&lt;p&gt;The safer design is boring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;derive tenant scope from auth, not user text&lt;/li&gt;
&lt;li&gt;expose approved views, not raw tables&lt;/li&gt;
&lt;li&gt;require scope before the tool runs&lt;/li&gt;
&lt;li&gt;fail closed when identity/scope is missing&lt;/li&gt;
&lt;li&gt;use read-only scoped DB roles&lt;/li&gt;
&lt;li&gt;log tenant, role, view, query ID, and audit event with the result&lt;/li&gt;
&lt;li&gt;require a separate privileged workflow for cross-tenant reporting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A model can forget a filter.&lt;br&gt;
A database policy should not.&lt;/p&gt;

&lt;p&gt;Longer version: &lt;a href="https://conexor.io/blog/tenant-scoped-mcp-database-tools?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=content" rel="noopener noreferrer"&gt;Tenant-scoped MCP database tools&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AI database access gets much safer when the tool cannot return the wrong tenant in the first place.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>database</category>
      <category>security</category>
      <category>ai</category>
    </item>
    <item>
      <title>AI database answers need citations, not just summaries</title>
      <dc:creator>Mads Hansen</dc:creator>
      <pubDate>Mon, 25 May 2026 01:15:46 +0000</pubDate>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9/ai-database-answers-need-citations-not-just-summaries-414h</link>
      <guid>https://dev.to/mads_hansen_27b33ebfee4c9/ai-database-answers-need-citations-not-just-summaries-414h</guid>
      <description>&lt;p&gt;An AI answer from a live database should not end at the sentence.&lt;/p&gt;

&lt;p&gt;If an assistant says:&lt;/p&gt;

&lt;p&gt;“MRR is down 8% in EMEA.”&lt;/p&gt;

&lt;p&gt;The next question is obvious:&lt;/p&gt;

&lt;p&gt;Based on what?&lt;/p&gt;

&lt;p&gt;For MCP database servers, citations should be part of the answer contract:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;query ID&lt;/li&gt;
&lt;li&gt;approved view or table family&lt;/li&gt;
&lt;li&gt;timestamp and freshness window&lt;/li&gt;
&lt;li&gt;row count or sample status&lt;/li&gt;
&lt;li&gt;filters applied&lt;/li&gt;
&lt;li&gt;redaction status&lt;/li&gt;
&lt;li&gt;metric definition used&lt;/li&gt;
&lt;li&gt;audit event ID&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;“Source: database” is not enough.&lt;/p&gt;

&lt;p&gt;The answer needs a source trail that a human can inspect when the number matters.&lt;/p&gt;

&lt;p&gt;Longer version: &lt;a href="https://conexor.io/blog/mcp-database-answer-citations?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=content" rel="noopener noreferrer"&gt;MCP database answer citations&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Natural-language summaries are useful. Evidence is what makes them safe to trust.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>database</category>
      <category>postgres</category>
      <category>ai</category>
    </item>
    <item>
      <title>MCP database servers need smaller tool catalogs</title>
      <dc:creator>Mads Hansen</dc:creator>
      <pubDate>Mon, 25 May 2026 01:14:41 +0000</pubDate>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9/mcp-database-servers-need-smaller-tool-catalogs-3jho</link>
      <guid>https://dev.to/mads_hansen_27b33ebfee4c9/mcp-database-servers-need-smaller-tool-catalogs-3jho</guid>
      <description>&lt;p&gt;The easiest MCP database server to build is also the riskiest:&lt;/p&gt;

&lt;p&gt;Expose a broad query tool.&lt;br&gt;
Point it at production.&lt;br&gt;
Trust the model to behave.&lt;/p&gt;

&lt;p&gt;That is not a production access model. It is a demo.&lt;/p&gt;

&lt;p&gt;For real teams, the tool catalog should be designed with least privilege:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;workflow-specific tools&lt;/li&gt;
&lt;li&gt;approved views instead of raw tables&lt;/li&gt;
&lt;li&gt;per-user and tenant scope&lt;/li&gt;
&lt;li&gt;read/write separation&lt;/li&gt;
&lt;li&gt;row, time, and cost budgets&lt;/li&gt;
&lt;li&gt;redaction before summarization&lt;/li&gt;
&lt;li&gt;approval gates for mutations&lt;/li&gt;
&lt;li&gt;structured refusal when scope is missing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The tool list is not just developer convenience. It is part of the permission boundary.&lt;/p&gt;

&lt;p&gt;Longer version: &lt;a href="https://conexor.io/blog/least-privilege-tool-catalogs-for-mcp-database-servers?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=content" rel="noopener noreferrer"&gt;Least-privilege tool catalogs for MCP database servers&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AI agents do better when the safe path is also the narrow path.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>database</category>
      <category>security</category>
      <category>ai</category>
    </item>
    <item>
      <title>AI database agents should not use forever credentials</title>
      <dc:creator>Mads Hansen</dc:creator>
      <pubDate>Sun, 24 May 2026 00:45:44 +0000</pubDate>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9/ai-database-agents-should-not-use-forever-credentials-2m6p</link>
      <guid>https://dev.to/mads_hansen_27b33ebfee4c9/ai-database-agents-should-not-use-forever-credentials-2m6p</guid>
      <description>&lt;p&gt;Autonomous agents should not carry permanent database credentials around like a human service account.&lt;/p&gt;

&lt;p&gt;Persistent credentials are convenient.&lt;/p&gt;

&lt;p&gt;They are also a bad fit for AI workflows where intent changes request by request.&lt;/p&gt;

&lt;p&gt;For production MCP database servers, I’d rather see credentials that are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;short-lived&lt;/li&gt;
&lt;li&gt;read-only by default&lt;/li&gt;
&lt;li&gt;scoped to approved views/tables&lt;/li&gt;
&lt;li&gt;tied to a human/workflow identity&lt;/li&gt;
&lt;li&gt;limited by tenant, timeout, and row budget&lt;/li&gt;
&lt;li&gt;visible in the audit trail&lt;/li&gt;
&lt;li&gt;expired after the specific task&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The point is not to trust the model harder.&lt;/p&gt;

&lt;p&gt;The point is to make unsafe behavior impossible at the credential and database boundary.&lt;/p&gt;

&lt;p&gt;Longer version: &lt;a href="https://conexor.io/blog/temporary-credentials-for-ai-database-agents?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=content" rel="noopener noreferrer"&gt;Temporary credentials for AI database agents&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If an agent only needs access for one question, the credential should behave like it.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>database</category>
      <category>security</category>
      <category>ai</category>
    </item>
    <item>
      <title>Natural-language SQL needs an explain plan before it runs</title>
      <dc:creator>Mads Hansen</dc:creator>
      <pubDate>Sun, 24 May 2026 00:44:38 +0000</pubDate>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9/natural-language-sql-needs-an-explain-plan-before-it-runs-1m5n</link>
      <guid>https://dev.to/mads_hansen_27b33ebfee4c9/natural-language-sql-needs-an-explain-plan-before-it-runs-1m5n</guid>
      <description>&lt;p&gt;Natural-language SQL should not go straight from prompt to production query.&lt;/p&gt;

&lt;p&gt;The generated SQL may look reasonable.&lt;/p&gt;

&lt;p&gt;The database may accept it.&lt;/p&gt;

&lt;p&gt;But the plan can still be dangerous:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;full table scan&lt;/li&gt;
&lt;li&gt;accidental cross join&lt;/li&gt;
&lt;li&gt;missing tenant/date filter&lt;/li&gt;
&lt;li&gt;unbounded aggregate&lt;/li&gt;
&lt;li&gt;query touching the wrong approved surface&lt;/li&gt;
&lt;li&gt;estimated rows far above budget&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For MCP database servers, I think an explain-plan preflight should be a normal production pattern.&lt;/p&gt;

&lt;p&gt;Not because every user wants to read query plans.&lt;/p&gt;

&lt;p&gt;Because the system needs a way to catch expensive or suspicious queries before execution, and leave evidence for review when an answer matters.&lt;/p&gt;

&lt;p&gt;Longer version: &lt;a href="https://conexor.io/blog/explain-plans-for-ai-database-agents?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=content" rel="noopener noreferrer"&gt;Explain plans for AI database agents&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A model can generate SQL. The tool layer should decide whether it is safe enough to run.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>database</category>
      <category>postgres</category>
      <category>ai</category>
    </item>
    <item>
      <title>Small AI database questions can become big scans</title>
      <dc:creator>Mads Hansen</dc:creator>
      <pubDate>Sat, 23 May 2026 00:16:51 +0000</pubDate>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9/small-ai-database-questions-can-become-big-scans-67i</link>
      <guid>https://dev.to/mads_hansen_27b33ebfee4c9/small-ai-database-questions-can-become-big-scans-67i</guid>
      <description>&lt;p&gt;A small question can become a big database scan when an AI agent writes the query.&lt;/p&gt;

&lt;p&gt;“Show me customers at risk” sounds harmless.&lt;/p&gt;

&lt;p&gt;But depending on schema context, the agent might join:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;accounts&lt;/li&gt;
&lt;li&gt;subscriptions&lt;/li&gt;
&lt;li&gt;invoices&lt;/li&gt;
&lt;li&gt;usage events&lt;/li&gt;
&lt;li&gt;support tickets&lt;/li&gt;
&lt;li&gt;notes&lt;/li&gt;
&lt;li&gt;activity logs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then it may retry when the first query does not answer the question.&lt;/p&gt;

&lt;p&gt;For production MCP database servers, row limits should be treated as a safety boundary, not a UI preference.&lt;/p&gt;

&lt;p&gt;Useful defaults:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;preview first, not full export&lt;/li&gt;
&lt;li&gt;aggregate before raw rows when possible&lt;/li&gt;
&lt;li&gt;enforced row limits per tool/intent&lt;/li&gt;
&lt;li&gt;page cursors for continuation&lt;/li&gt;
&lt;li&gt;explicit “more rows exist” metadata&lt;/li&gt;
&lt;li&gt;structured refusal for unbounded requests&lt;/li&gt;
&lt;li&gt;audit logs with rows scanned and rows returned&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Longer version: &lt;a href="https://conexor.io/blog/row-limits-for-ai-database-agents?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=content" rel="noopener noreferrer"&gt;Row limits for AI database agents&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The model should never summarize 50 preview rows as if it saw the whole database.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>database</category>
      <category>postgres</category>
      <category>ai</category>
    </item>
    <item>
      <title>Your AI database agent should not see every column</title>
      <dc:creator>Mads Hansen</dc:creator>
      <pubDate>Sat, 23 May 2026 00:15:46 +0000</pubDate>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9/your-ai-database-agent-should-not-see-every-column-4fi5</link>
      <guid>https://dev.to/mads_hansen_27b33ebfee4c9/your-ai-database-agent-should-not-see-every-column-4fi5</guid>
      <description>&lt;p&gt;The fastest way to leak sensitive data through an AI database agent is to expose columns the model never needed.&lt;/p&gt;

&lt;p&gt;Table access is too broad.&lt;/p&gt;

&lt;p&gt;A customer table can contain useful business fields and risky fields at the same time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;account name&lt;/li&gt;
&lt;li&gt;plan&lt;/li&gt;
&lt;li&gt;renewal date&lt;/li&gt;
&lt;li&gt;usage trend&lt;/li&gt;
&lt;li&gt;email&lt;/li&gt;
&lt;li&gt;phone&lt;/li&gt;
&lt;li&gt;private notes&lt;/li&gt;
&lt;li&gt;raw payloads&lt;/li&gt;
&lt;li&gt;billing references&lt;/li&gt;
&lt;li&gt;internal flags&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The agent may need the first four. It probably does not need the rest.&lt;/p&gt;

&lt;p&gt;For production MCP database access, I would rather expose approved projections than raw tables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;approved views for common business questions&lt;/li&gt;
&lt;li&gt;masked/pseudonymized fields by default&lt;/li&gt;
&lt;li&gt;aggregate-only modes for trend analysis&lt;/li&gt;
&lt;li&gt;structured refusal for blocked columns&lt;/li&gt;
&lt;li&gt;audit logs showing exactly which columns were returned&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Longer version: &lt;a href="https://conexor.io/blog/column-level-permissions-for-ai-database-agents?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=content" rel="noopener noreferrer"&gt;Column-level permissions for AI database agents&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The model should not be the thing deciding whether a sensitive field is safe to see.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>database</category>
      <category>postgres</category>
      <category>ai</category>
    </item>
    <item>
      <title>Natural-language SQL breaks quietly when schema context goes stale</title>
      <dc:creator>Mads Hansen</dc:creator>
      <pubDate>Fri, 22 May 2026 02:53:56 +0000</pubDate>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9/natural-language-sql-breaks-quietly-when-schema-context-goes-stale-1on</link>
      <guid>https://dev.to/mads_hansen_27b33ebfee4c9/natural-language-sql-breaks-quietly-when-schema-context-goes-stale-1on</guid>
      <description>&lt;p&gt;Natural-language SQL breaks quietly when schema context goes stale.&lt;/p&gt;

&lt;p&gt;The model may still produce SQL that looks reasonable.&lt;/p&gt;

&lt;p&gt;The query may even run.&lt;/p&gt;

&lt;p&gt;But if a column was renamed, a relationship changed, a view gained new filtering logic, or a metric moved to an approved surface, the answer can be wrong in a way that is hard to spot.&lt;/p&gt;

&lt;p&gt;For MCP database servers, schema drift detection should be part of the tool contract.&lt;/p&gt;

&lt;p&gt;Practical things I would want in production:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;schema/context version on every tool result&lt;/li&gt;
&lt;li&gt;metadata refresh timestamp&lt;/li&gt;
&lt;li&gt;migration/catalog hash where possible&lt;/li&gt;
&lt;li&gt;detection for changed tables/views/columns&lt;/li&gt;
&lt;li&gt;refusal when context is stale&lt;/li&gt;
&lt;li&gt;audit trail tying query output to the context used&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Longer version: &lt;a href="https://conexor.io/blog/schema-drift-detection-for-mcp-database-servers?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=content" rel="noopener noreferrer"&gt;Schema drift detection for MCP database servers&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The model cannot safely reason from yesterday's database shape.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>database</category>
      <category>postgres</category>
      <category>ai</category>
    </item>
    <item>
      <title>Your AI database agent should not query the primary by default</title>
      <dc:creator>Mads Hansen</dc:creator>
      <pubDate>Fri, 22 May 2026 02:52:50 +0000</pubDate>
      <link>https://dev.to/mads_hansen_27b33ebfee4c9/your-ai-database-agent-should-not-query-the-primary-by-default-29ka</link>
      <guid>https://dev.to/mads_hansen_27b33ebfee4c9/your-ai-database-agent-should-not-query-the-primary-by-default-29ka</guid>
      <description>&lt;p&gt;Most AI database questions do not need the primary database.&lt;/p&gt;

&lt;p&gt;They feel urgent because somebody typed them into a chat box.&lt;/p&gt;

&lt;p&gt;But many are exploratory reads:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;trends&lt;/li&gt;
&lt;li&gt;customer lists&lt;/li&gt;
&lt;li&gt;backlog summaries&lt;/li&gt;
&lt;li&gt;operational snapshots&lt;/li&gt;
&lt;li&gt;anomaly checks&lt;/li&gt;
&lt;li&gt;aggregate reporting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If every question goes straight to the primary, the AI assistant becomes another source of production pressure.&lt;/p&gt;

&lt;p&gt;For production MCP database servers, I think read replica routing should be a default design question.&lt;/p&gt;

&lt;p&gt;The important part is not only routing. It is making the routing visible:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;source role used&lt;/li&gt;
&lt;li&gt;replica lag&lt;/li&gt;
&lt;li&gt;snapshot/query timestamp&lt;/li&gt;
&lt;li&gt;freshness window&lt;/li&gt;
&lt;li&gt;fallback reason if the primary was used&lt;/li&gt;
&lt;li&gt;audit/query ID&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Longer version: &lt;a href="https://conexor.io/blog/read-replica-routing-for-ai-database-agents?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=content" rel="noopener noreferrer"&gt;Read replica routing for AI database agents&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A stale-but-labeled answer is often safer than a live answer that quietly competed with production traffic.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>database</category>
      <category>postgres</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
