<?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: Ronan Oliveira</title>
    <description>The latest articles on DEV Community by Ronan Oliveira (@oliveiraronan).</description>
    <link>https://dev.to/oliveiraronan</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4229340%2F7c2a7b1e-cd1e-4b8b-93b7-c7cb98699bf6.jpg</url>
      <title>DEV Community: Ronan Oliveira</title>
      <link>https://dev.to/oliveiraronan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oliveiraronan"/>
    <language>en</language>
    <item>
      <title>Why we stopped letting AI agents connect directly to the database</title>
      <dc:creator>Ronan Oliveira</dc:creator>
      <pubDate>Thu, 05 Nov 2026 22:58:11 +0000</pubDate>
      <link>https://dev.to/oliveiraronan/why-we-stopped-letting-ai-agents-connect-directly-to-the-database-4279</link>
      <guid>https://dev.to/oliveiraronan/why-we-stopped-letting-ai-agents-connect-directly-to-the-database-4279</guid>
      <description>&lt;p&gt;The request usually sounds like this: "the agent needs to query the ERP". And the first reaction from whoever runs IT is the right one: nobody wants to hand a production database username and password to software that decides on its own which query to run. The risk isn't theoretical — it's a malformed query at peak time, a sensitive field exposed in a reply, a credential leaking into a log.&lt;/p&gt;

&lt;p&gt;This guide is for the IT director who needs to say "yes" to the agent without saying "yes" to direct access. It explains why Zihin removed direct database connections and which path data takes instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why we took direct database access away from the agent
&lt;/h2&gt;

&lt;p&gt;On October 4, 2026, version 2.2.2 of Zihin's MCP package shipped alongside the removal of the direct database connection tools — the &lt;code&gt;db_config&lt;/code&gt; type and the &lt;code&gt;db_event&lt;/code&gt; trigger. Since then, data integrations go through API tools or MCP servers, such as the MCP Bridge. The change is recorded in the &lt;a href="https://www.zihin.ai/en/changelog" rel="noopener noreferrer"&gt;product changelog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The decision starts from a simple observation: giving an agent a connection string to the production database creates three problems that no prompt layer can solve.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The credential leaves your network.&lt;/strong&gt; Even in an encrypted vault, it exists outside the perimeter and has to be protected by one more party.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The agent decides the query.&lt;/strong&gt; A generic SQL tool trusts the model to write the right query, on the right table, with the right filter. In production, that's a bet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load on the system of record.&lt;/strong&gt; Exploratory queries compete with the ERP for the same database that closes payroll and issues invoices.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Removing a feature is an expensive decision for a product. We did it because direct database access was the point where the customer's security architecture stopped applying. The path that replaces it isn't more limited — it's more predictable.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How an AI agent accesses ERP data safely: three pieces
&lt;/h2&gt;

&lt;p&gt;The current design separates who holds the data, who queries it and who carries the answer. There are three components, each with a clear job.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Zihin Replay: a read-only copy, inside your network
&lt;/h3&gt;

&lt;p&gt;Replay keeps a read-only copy of the agreed tables in a Postgres database inside your network. You decide which tables go in. Oracle and SQL Server are copied via change data capture; systems like Sienge, via API. The production database never receives a query from the agent — ever.&lt;/p&gt;

&lt;p&gt;The practical result: the ERP keeps serving operations, and the copy serves the AI's questions. If a query is heavy, it's the replica that feels it, not billing.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. MCP Bridge: contract-based queries, not free-form SQL
&lt;/h3&gt;

&lt;p&gt;On top of that copy, the MCP Bridge publishes read-only queries with contracts specific to the business domain: "open orders by supplier", "stock balance by item", "bills coming due". The agent gets a list of tools with a defined name, description and parameters. It chooses which one to call and with which arguments — it doesn't write the query.&lt;/p&gt;

&lt;p&gt;That changes the security conversation. Instead of asking "what can the agent do in the database?", the answer is the list of contracts you approved. Nothing outside it exists for the agent. For Protheus, the Bridge is documented in production; SAP and Oracle EBS are planned. See the details at &lt;a href="https://www.zihin.ai/en/integrations" rel="noopener noreferrer"&gt;/integrations&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Zihin Tunnel: outbound-only connection, over port 443
&lt;/h3&gt;

&lt;p&gt;That leaves transport. The Tunnel opens an outbound connection from your network to the platform over port 443 — the same one your browser uses. No inbound ports, no VPN, no firewall changes. Credentials for internal systems are resolved inside your network and never leave it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ERP / production database
   └─ Replay  → read-only copy (Postgres, inside your network)
        └─ MCP Bridge → contract-based queries, read-only
             └─ Tunnel → outbound connection, 443, no open port
                  └─ the agent gets the answer, never the credential
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What the IT director gets from this design
&lt;/h2&gt;

&lt;p&gt;Whoever evaluates the architecture usually asks four questions. In this model, the answers are short.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Where does the database credential live?&lt;/strong&gt; In your network. The agent never receives it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Can the agent write to the ERP through this path?&lt;/strong&gt; No. Replay and MCP Bridge are read-only. Writes are never automatic in any integration: they require a dedicated tool, with permissions and policies, and can require human approval before running.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do I need to open a port on the firewall?&lt;/strong&gt; No. The connection is outbound, over 443.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How do I know what was queried?&lt;/strong&gt; Every execution is recorded, with its tool calls and policy decisions, and can be reviewed by the team. &lt;a href="https://www.zihin.ai/en/product" rel="noopener noreferrer"&gt;Zihin Watch&lt;/a&gt; monitors operations and produces reports according to its configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Start with an inventory of questions, not an inventory of tables. List the five queries your team runs against the ERP every day and turn each one into a Bridge contract. That's less surface than replicating the whole database — and it already covers most real usage.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Governance over what gets read
&lt;/h3&gt;

&lt;p&gt;Read-only solves data integrity, but on its own it doesn't solve confidentiality. That's where contextual security policies (CSP) come in: rules enforced on every execution, not suggested to the model. A data policy restricts sensitive fields and entities; a schedule policy defines when the agent can operate; an origin policy limits where it can be triggered from. They inherit from the broadest scope to the most specific — define them once for the company and refine them per team, agent or user.&lt;/p&gt;

&lt;p&gt;Combined with the platform's RBAC (what people and API keys can do) and the credential vault encrypted with AES-256-GCM, the whole set is described in plain language at &lt;a href="https://www.zihin.ai/en/security" rel="noopener noreferrer"&gt;/security&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A note of honesty: the availability and deployment scope of Replay, MCP Bridge and Tunnel depend on your infrastructure, your data agreement and your access requirements. Check with the sales team what applies to your case — the answer is in the &lt;a href="https://www.zihin.ai/en/faq" rel="noopener noreferrer"&gt;deployment FAQ&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary to take to the meeting
&lt;/h2&gt;

&lt;p&gt;Letting an AI agent access a database safely doesn't mean giving it a well-configured database user. It means not giving it database access at all — but a read-only copy, through queries you approved, over a connection your network initiates. Zihin removed the direct connection because it was the weakest link in the design. What remains is a path where the credential never leaves your network, the ERP doesn't feel the load, and every read is on record.&lt;/p&gt;

&lt;p&gt;If your IT team is holding back AI adoption at exactly this point, it's worth mapping the flow with real data from your ERP. &lt;a href="https://www.zihin.ai/en/contact?topico=diagnostico" rel="noopener noreferrer"&gt;Book a diagnostic&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Zihin.ai, product changelog — MCP 2.2.2 and removal of &lt;code&gt;db_config&lt;/code&gt; / &lt;code&gt;db_event&lt;/code&gt; (Oct 4, 2026): &lt;a href="https://www.zihin.ai/en/changelog" rel="noopener noreferrer"&gt;/changelog&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Zihin.ai, Integrations — Replay and MCP Bridge for ERPs: &lt;a href="https://www.zihin.ai/en/integrations" rel="noopener noreferrer"&gt;/integrations&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Zihin.ai, Security — Tunnel, vault and contextual policies: &lt;a href="https://www.zihin.ai/en/security" rel="noopener noreferrer"&gt;/security&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Zihin.ai, FAQ — Deployment and data: &lt;a href="https://www.zihin.ai/en/faq" rel="noopener noreferrer"&gt;/faq&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published in Portuguese on the &lt;a href="https://www.zihin.ai/blog/dados-para-agentes-sem-acesso-direto-ao-banco" rel="noopener noreferrer"&gt;Zihin blog&lt;/a&gt;. I work at Zihin, which connects AI agents to a company's systems and processes, with permissions, human approvals and cost tracking.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>security</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
