Answers still start with an export
Someone runs a report, downloads a CSV and uploads it to a chat window. The answer is only as current as the file, the file now lives outside your controls, and the work repeats tomorrow.
AI database integration connects AI models and agents to your databases, data warehouses and business applications, so they can retrieve, interpret and use business information without anyone exporting a spreadsheet first. Twopir Consulting designs the access layer in between: approved queries, APIs and MCP servers, read-only where it should be, with your permissions enforced on every request. Your data stays where it is. The AI gets only what it is allowed to see.
Trusted by 500+ organizations, including technology, SaaS and professional-services companies connecting their CRM, data and AI with Twopir Consulting.


Platforms We Connect
Most AI pilots work in a demo because someone pasted the data in by hand. They stall when the same assistant has to reach a production database, a warehouse and three business applications on its own, safely, every day. These are the six gaps we are most often asked to close.
Someone runs a report, downloads a CSV and uploads it to a chat window. The answer is only as current as the file, the file now lives outside your controls, and the work repeats tomorrow.
The fastest prototype connects the AI with an admin login. That account can read every table and change every row, so the model's reach is now wider than any single user who asks it a question.
A model writing free-form queries against production can join the wrong tables, scan millions of rows or return a confident number built on a misread column. Without validation, nobody notices until a decision is made on it.
Salaries, health details, card or bank data and personal contact fields sit in the same tables as the useful columns. If the access layer does not exclude or mask them, they travel to the model with everything else.
Custom-built applications and legacy systems often hold the operational truth, yet expose nothing an AI agent can call. Teams either leave them out of the answer or let the model reach straight into the database underneath.
When an answer is questioned, nobody can show which tool ran, which query it sent, whose permissions applied or what data came back. Without that trail, security and compliance teams stop the rollout, and they are right to.
AI database integration is the work of connecting AI models and AI agents to an organization's databases, data warehouses and business applications, so they can retrieve, interpret and act on business information through controlled access, instead of relying on data someone exported by hand. It covers how the AI reaches each system (directly, through an API, through a Model Context Protocol server or through middleware), which operations it is allowed to perform, whose permissions apply to each request, how sensitive fields are protected, and how every call is validated and logged.
Three parties are involved, and it helps to keep them apart. The model providers, such as OpenAI, Anthropic, AWS and Google Cloud, supply the models and the tool-calling interfaces that let a model request data. Your data platforms, such as PostgreSQL, MySQL, Microsoft SQL Server, MongoDB and your warehouse, store the data and enforce their own roles and security policies. Twopir Consulting designs and builds the layer in between: the connectors, APIs and MCP servers, the access model and the safeguards described on this page. The open standard for that layer is described in the Model Context Protocol documentation.
What changes once it is in place? A sales lead asks for an account's open orders and gets them from the ERP and the CRM in one answer. A finance manager asks how this quarter's renewals compare with last year's and the query runs against the warehouse, under their own access, without a ticket to the data team. The data never moves to a new platform, and the AI sees only what the person asking is allowed to see.
This page covers the data and application layer. For the wider programme, including use-case selection, model choice and AI inside your CRM, see our AI integration services.
There is no single right connection. Each pattern trades speed of setup against control, and most production estates use two or three of them side by side. This is how we decide which one each system gets.
| Pattern | How it works | Best suited to | What has to be controlled |
|---|---|---|---|
| Direct database connectivity | The AI application holds a database connection and runs SQL or database queries itself, often generated by the model from the question. | Analytics on a read replica or warehouse, internal prototypes, and well-modelled reporting schemas. | A read-only role, a replica rather than the primary, row-level security, statement timeouts and row limits, and validation of every generated query before it runs. |
| API-based integration | The AI calls named operations on a service you own, such as "get open orders for account", and the service runs the query it was written to run. | Production systems, write operations, custom and legacy applications, and any data with strict business rules. | Authentication per user or service, scopes per operation, input validation, rate limits and versioning. The model never sees the SQL. |
| MCP-based connectivity | An MCP server exposes approved tools, resources and prompts through the open Model Context Protocol, so any MCP-capable AI client can discover and call them in a standard way. | Several AI assistants or agents sharing the same data operations, and teams that want one governed interface rather than one integration per model. | Which tools exist and what each may do, server authorization, the identity passed through to the data source, and human approval for anything that changes data. |
| Middleware-based integration | An integration platform such as MuleSoft or Workato sits between the AI and many systems, orchestrating calls, transforming data and applying shared policies. | Answers that need several systems at once, estates that already run an integration platform, and processes with retries, queues and approvals. | Policies on the exposed endpoints, connector credentials, data mapping between systems, and monitoring of each flow the AI can trigger. |
For production data we start with APIs or MCP tools that run reviewed, parameterised queries. The model chooses which approved operation to call and supplies the parameters; it does not write the query.
That keeps the behaviour predictable, testable and easy to audit.
Exploratory questions against a warehouse are where generated SQL earns its place. We give it a curated, documented schema, a read-only role and a replica or warehouse, then validate and limit every statement before it runs.
The flexibility stays; the blast radius does not.
Six workstreams make up most engagements. Each starts from the system as it is today, and none of them requires moving your data to a new platform before the AI can use it.
AI access to PostgreSQL, MySQL, Microsoft SQL Server and MongoDB, through a dedicated read-only identity, a replica where load matters, and the database's own row and column controls.
Natural-language and AI-assisted analysis on the warehouse your reporting already trusts, on AWS, Google Cloud or elsewhere, with a documented semantic layer so the model reads metrics the way finance does.
Approved database operations and application functions exposed to AI agents as named tools, through APIs you own or MCP servers any MCP-capable client can use, each with its own scope and tests.
A safe interface for the systems that never had one: an API or MCP layer in front of a custom-built application or legacy database, so agents can use it without touching its tables directly.
AI that reads and updates the systems teams work in every day, Salesforce first, with HubSpot, ERP and finance systems connected, so an answer about a customer includes what the CRM and the back office both know.
Several databases and applications joined behind one governed interface on an integration platform such as MuleSoft or Workato, so the AI asks once and the platform handles the systems, mappings and retries.
An AI integration should never become a second, looser way into your data. We layer the controls your databases already provide with checks in the access layer, so the model can only do what the person or process behind it is allowed to do.
| Control | What it enforces |
|---|---|
| Read-only by default | AI identities get read access only, granted through the database's own roles (for example SELECT-only grants in MySQL or a read role in MongoDB). Write access is added per operation, never as a blanket grant. |
| Authentication & least privilege | Each AI application or agent has its own identity and scoped credentials held in a secrets store, never a shared admin login or a key inside a prompt. |
| Row-level permissions | Users see only their rows, enforced in the database where it supports it, such as PostgreSQL row security policies and SQL Server Row-Level Security, or in the API when it does not. AI roles never own the tables or carry a bypass privilege, which would skip the policies. |
| Sensitive information | Personal, financial and health fields are excluded from AI views, or redacted before results leave the access layer. Masking features such as SQL Server dynamic data masking help, but Microsoft documents them as one layer among several, so we never rely on masking alone. |
| Query restrictions | Allow-listed operations and curated views, parameterised queries, statement timeouts, row limits and scan limits, so no single question can overload a production system. |
| Query validation | Generated SQL is parsed and checked before it runs: read statements only, approved schemas only, limits applied, and anything else rejected with a reason. |
| Audit & access governance | Every tool call is logged with who asked, which operation ran, under which permissions and what came back, and access is reviewed on the same cycle as your other systems. |
The same access layer supports very different work. These are the patterns we build most often, and what each one decides about sources, access and output.
Managers ask business questions in plain language and get answers from the warehouse, without writing SQL or waiting for an analyst.
Recurring reports explained in words: what moved, by how much and where to look next, written from the same numbers the dashboard shows.
A rep or agent asks about an account and gets orders, invoices and open cases from the systems that hold them, without leaving Salesforce or HubSpot.
AI agents that do more than read: create a case, update a record or raise a request, through approved operations with a person confirming where it matters.
Operations and support teams query custom-built and legacy applications in plain language, through a service layer that protects the system underneath.
Questions that span many systems, answered through one governed endpoint on your integration platform instead of a separate connection per source.
We work with the AI and data platforms you already use rather than asking you to standardise on ours. This is what each one contributes and what moves across the connection.
OpenAI models call functions you define and, through the Responses API, remote MCP servers. Questions go out as tool calls; your access layer runs them and returns only the approved result. We keep OpenAI's approval and allowed-tools controls switched on.
Claude uses tools that run in your application, or remote MCP servers through Anthropic's MCP connector. For read-only assistants we expose read tools only and leave write tools out, as Anthropic itself recommends.
Amazon Bedrock Knowledge Bases can connect to structured data stores and turn a user's question into a query, so data held in AWS answers in plain language without being converted first. Results return to the application under its IAM role.
Gemini in BigQuery generates SQL from plain-English prompts, and Google's open-source MCP Toolbox for Databases exposes BigQuery, PostgreSQL, MySQL, SQL Server and more to AI agents as tools. Generated SQL is reviewed before it is trusted.
MuleSoft's MCP Connector lets a Mule application act as an MCP server, so APIs, legacy systems and SaaS applications you already run on Anypoint become tools an AI client can call, with no separate hosting. See our MuleSoft integration work.
Workato MCP servers give agents a curated set of tools over databases, APIs and business applications, and can act on each user's own credentials instead of a shared token. Tools are marked read-only or destructive. See our Workato services.
Customer context flows from Salesforce to the AI, and order, billing and product data flows back from the systems that own it, so agents and reps answer from both. Grounding Agentforce on outside data is covered in Agentforce data integration.
Contact, company and deal records give the AI its customer context, while ERP, finance and product databases supply what HubSpot does not hold. Updates the AI proposes return to HubSpot through approved actions only.
Native connectors, existing integration-platform connectors, warehouse roles and the database's own row and masking features. Where a platform already solves part of the problem, we configure it rather than rebuild it.
Less custom code means less for your team to maintain.
Custom MCP servers, wrapper APIs for systems without one, query validation services, identity pass-through and the tests that prove each tool returns only what it should.
Everything we build is documented and handed over, so your developers can extend it.
The size of the project depends on how many systems are connected, whether they already have APIs, and whether the AI only reads or also acts. We start narrow, with one use case on read-only access, and widen from evidence rather than ambition.
We agree the questions and tasks the AI must handle, then map which systems hold the answer, who owns them, how they are secured today and which fields are sensitive.
DeliverableUse-case list, source map and data classification
For each system: the connection pattern, the identities and roles, the tool catalogue, the row and column rules, and what needs human approval. Your security team signs this off.
DeliverableSigned-off access design
Database roles and views, APIs, MCP servers and middleware flows, built in a non-production environment against masked or test data, never directly against production.
DeliverableWorking tools, demoed per use case
Accuracy tests against known answers, permission tests with users of different roles, attempts to reach data the AI should not see, and load tests on the systems it reads from.
DeliverableTest evidence and accuracy baseline
A pilot group first, with logging and feedback switched on, then a staged rollout. Write operations are enabled only after the read path has proven itself in production.
DeliverablePilot review and rollout plan
Monitoring of tool usage, errors, latency and cost, regular access reviews, and new tools added as teams find new questions. Schema changes are caught before they break an answer.
DeliverableRunbook, dashboards and handover
Connecting a model to a database takes an afternoon. Connecting it to production data that is secured, reliable and trusted by your security team is integration work. We help growing and mid-market companies solve complex CRM, integration, and business system challenges, and AI data access is now one of them.
We design the access model, identities and tool catalogue before writing a connector, and record every decision, so the integration still makes sense when the second and third AI use case arrive.
Most business questions involve a customer, so most AI integrations end up touching the CRM. We know its data model, sharing rules and APIs, in AI in Salesforce and AI in HubSpot projects alike.
ERP, finance, warehouse and custom-application integrations on MuleSoft, Workato and direct APIs are the core of our integration services. AI is a new caller on infrastructure we already build.
We build the data foundations AI depends on. For a US asset management firm we replaced four disconnected CSV pipelines with a BigQuery data foundation that cut cost per analytics cycle by 61%; for a US legal tech platform, OpenAI-powered email processing creates a Salesforce case note in under 60 seconds.
Senior architects lead the design and stay on the work, with specialists in databases, integration platforms and AI on each build. You get documented tools your own team can maintain, not a black box.
AI database integration connects AI models and AI agents to an organization's databases, data warehouses and business applications, so they can retrieve and use business information through controlled access instead of manual exports. It covers the connection pattern for each system, the operations the AI may perform, whose permissions apply, how sensitive fields are protected, and how every request is validated and logged.
With direct connectivity, the AI application runs queries against the database itself, which suits read-only analytics on a replica or warehouse. With API-based integration, the AI calls named operations on a service you own and never sees the query. MCP-based connectivity exposes approved tools and resources through the open Model Context Protocol, so several AI clients can share one governed interface. Middleware-based integration puts a platform such as MuleSoft or Workato between the AI and many systems to orchestrate, map and govern the calls. Most production estates combine two or three of these.
It can be, when the access is designed for it. We give the AI its own read-only identity, point analytical questions at a replica or warehouse rather than the primary database, enforce row-level permissions and column exclusions, validate every generated query, apply timeouts and row limits, and log each call. For production systems we prefer approved, parameterised operations over free-form queries, and any write operation needs its own scope and, where it matters, a human approval step.
An MCP server is a service that exposes tools, resources and prompts to AI applications through the Model Context Protocol, an open standard for connecting AI applications to external systems. You need one when several AI assistants or agents should share the same governed data operations, or when you want a standard interface rather than a separate integration per model. A single application calling a single API may not need one.
Yes. When a system has no API, we build a service layer in front of it, either a wrapper API or an MCP server, that exposes a small set of approved operations. Agents use those operations instead of reaching into the database underneath, which protects older systems from unexpected load and keeps business rules in one place.
We connect models from OpenAI and Anthropic, as well as AI services on AWS and Google Cloud, with PostgreSQL, MySQL, Microsoft SQL Server, MongoDB, cloud data warehouses and business applications such as Salesforce, HubSpot and ERP systems. Where an integration platform is already in place, such as MuleSoft or Workato, we build on it rather than around it.
No. The data stays in the databases and applications where it lives today, and the AI reaches it through governed connections. A consolidated warehouse or curated views can improve answer quality for analytical questions, and we recommend them where they help, but they are not a precondition for a first read-only use case.
A first conversation covers the questions you want AI to answer, the databases and applications that hold the answers, and how they are secured today: enough to say which connection pattern fits each system and what a first read-only use case would take. No obligation to proceed.
Talk to an architect who connects AI with enterprise data