Build reliable AI agents with the dbt MCP Server

on Aug 21, 2025
61% of attendees at a recent Gartner conference stated they’d made investments in agentic AI. However, Gartner itself predicts that over 40% of those projects will be canceled by 2027. They cite escalating costs, unclear business value, inadequate risk controls, and agents’ lack of maturity and true autonomous agency as the primary reasons for failure.
In addition, we have observed that, as AI agents become more capable, their ability to interact with data pipelines and analytics workflows is hitting a wall. They lack context. Without knowing which models are trusted, how metrics are defined, or what transformations were applied, agents risk misleading or incomplete outputs.
You can take steps to ensure that your agentic AI doesn’t end up in the dustbin of abandoned AI projects. This article explains how you can build reliable AI agents with structured context from your dbt projects, using the new dbt MCP Server to expose your trusted data to AI.
The importance of structured metadata and context for agentic AI
By now, it’s common knowledge that large language models (LLMs) can hallucinate. They can make mistakes, fabricate data, and even introduce security risks. That’s because LLMs are ultimately probability models. They generate responses based on patterns in their training data, predicting what sounds right, not necessarily what is correct. They aren’t grounded in your business logic and don’t understand your data’s specific context.
This is where structured context becomes essential. Structured context is the governance layer that defines how your data is modeled, tested, and interpreted. It includes lineage (how datasets relate to each other), versioning, testing frameworks, metric definitions, SQL logic, personal identification tagging, and other reusable components.
Together, this context tells an AI system not just what data exists, but how it’s connected, what it means, and how it should be used. It’s the difference between an AI that’s guessing and one that delivers accurate, trustworthy answers.
By providing your AI agents with structured metadata and context, you're giving them a reliable playbook. Context unlocks five key components that transform AI agents from predictive guessers into trusted collaborators:
- Understanding your data and business logic. With access to your models, joins, and metrics, agentic outputs are accurate and aligned to how your business functions (and there’s no more guessing what “revenue” or “customer ID” means).
- Keeping multi-step workflows on track. By understanding how data is connected, agents can follow the correct path without causing downstream issues.
- Improving memory. When agents learn from clean, governed examples, they build on experience instead of fabricating responses.
- Reusing verified SQL logic. Instead of starting from scratch, agents can draw from version-controlled models, macros, and definitions that are already built into dbt.
- Providing an end-to-end audit trail. Using lineage and version control enables you to trace how decisions were made, validate results, and resolve issues quickly—whether it's a broken SQL query, a failed test, or a number that suddenly appears incorrect.
Your dbt projects already provide the structured foundation AI agents require, including models, relationships, and metrics defined in version-controlled, documented, and tested code. With the launch of dbt MCP Server, we can now make that structure accessible to AI in a way that’s usable, safe, and available in real time, laying the groundwork for trustworthy agentic AI workflows.
dbt MCP Server: Enabling a playbook for AI agents
The dbt MCP Server is an open-source implementation of the Model Context Protocol (MCP) that enables AI systems to dynamically access structured data. MCP Server exposes everything already built into your dbt project—structured metadata, the dbt compiler, the MetricFlow query engine, and compute integrations—and serves it to AI agents using a standard, open protocol. This enables agents to:
- Query the semantic layer.
- Execute transformations at scale.
- Generate SQL or documentation based on existing, tested logic.
- Reuse logic safely across teams without duplication or drift.
- Maintain governance guardrails, such as freshness, ownership, and version history.
- Collaborate and interoperate reliably.
Because agents answer business questions using the metrics and definitions from the dbt Semantic Layer, the answers they return are correct and reliable. By centralizing logic in one layer, you decrease compute, reduce redundant queries, and achieve faster results. And, as your AI stack evolves with new models, tools, and interfaces, your dbt-structured foundation remains consistent.
The dbt MCP server is the key to unlocking the value of your structured data with AI applications. It delivers:
- Fewer hallucinations
- Faster development
- Stronger governance and security
- Trusted outputs that scale with your data
Currently, the MCP Server enables three key use cases that bridge the gap between your dbt project and realizing the value of your structured data through agentic AI:
- Data discovery: Understanding what data assets exist in your dbt project and how they relate to each other.
- Data querying: Accessing trusted metrics and running queries against your data models. Uses the dbt Layer as a single source of truth for metrics reporting, enabling you to execute SQL queries for data exploration and development.
- Project execution: Running dbt commands and managing your project through conversational interactions with AI agents.
In a recent webinar, dbt and Indicium demonstrated how the dbt MCP Server enables AI agents to execute a data migration, converting legacy systems, such as PySpark notebooks, ETL scripts, and other artifacts, into a modern dbt project.
MCP Server in action: dbt migration
Migrating legacy systems to dbt is often a complex, manual process that demands extensive engineering hours, including multiple interviews and handoffs. With the dbt MCP Server, AI agents can take the lead, streamlining execution from mapping to validation.
AI agents need context, which means having a solid understanding of the target architecture and dbt project structure before engaging AI. With that foundation in place, the dbt MCP Server can power an agentic AI workflow that automates the migration process.
Data mapping and assessment
The migration workflow begins with mapping the legacy system and translating it into a knowledge graph. Knowledge graphs are powerful because they capture relationships and legacy data lineage. This enriched context is especially valuable for LLMs and AI agents because it’s expressed in language they can understand and use to drive the migration.
This stage uses an Assessment Agent to:
- Profile the legacy system’s schemas, code, and dependencies.
- Translate those artifacts into a knowledge graph that captures tables, columns, joins, and data-flow relationships.
Planning and project breakdown
Once your data has been mapped, so the AI agent has the necessary context, you can create a Planning Agent to break the migration into manageable tasks.
The Planning Agent:
- Breaks the migration into waves based on complexity and dependencies.
- Generates specific tasks such as creating staging models, intermediate models, or merging tables to handle differences in business logic. These tasks are stored in memory for execution.
Execution
In the final stage, an Executor Agent takes over to execute the migration tasks.
Specific Execute tasks include:
- Analyze: The Executor Agent ingests file schemas via MCP and writes a memory file that lists all migration subtasks.
- Implement: The Executor Agent auto-generates source files and staging models in SQL, following dbt best practices, then runs dbt compile and dbt run through MCP to catch errors early.
- Documentation and testing: The Executor Agent produces doc blocks and schema tests for each new model, then verifies test results via dbt test.
- Audit: The Executor Agent uses the dbt audit-helper package to build models that compare legacy tables to new tables, both at the table and column levels, and aggregate match rates over time.
- Final build: The Executor Agent calls dbt build and dbt test one more time, then surfaces a 100 % match as the migration’s definition of done.
The final result is a production-ready target data system for both business and technical users. Thanks to the context provided by the knowledge graph and MCP, documentation is no longer an afterthought. It’s generated early, with column descriptions and model metadata captured automatically.
Real-world impact: Migration use case
Recently, dbt Partner Indicium helped Aura Minerals harness the power of the MCP Server. Aura wanted to adopt a future-ready framework, powered by dbt, governance, and automation. Indicium created a proprietary AI Migration Agent that followed the above workflow to map, convert, validate, and migrate the company’s PySpark estate to dbt.
The results were stunning:
- Scale: 400+ PySpark notebooks—spanning bronze, silver, and gold layers—and 130 complex workflows migrated to dbt.
- Speed: 87% improvement in pipeline—from 45 hours to six hours.
- Quality: ~99% code conformity to organizational best practices.
- Collaboration Overhead: 66% reduction in team dependency by shifting context into a knowledge graph, minimizing stakeholder interviews and back-and-forth, and enabling agents to handle translation.
By combining context-grounded AI with dbt MCP, Aura now has a governed dbt environment with models that both business and data teams can trust and understand.
Building reliable AI agents with dbt and dbt MCP Server
Agentic AI workflows promise speed and automation, but without structured context, they deliver hallucinations and best guesses. The MCP Server is the bridge between your dbt project and any MCP-enabled client. Together, dbt and the dbt MCP Server help organizations build reliable AI agents by:
Providing metrics as a single source of truth
The dbt Semantic Layer provides version-controlled models, macros, documented code, and metrics. When AI agents query business metrics directly in the Semantic Layer, they ground their outputs in real business context, ensuring consistent logic and reducing the likelihood of hallucinations.
Exposing rich project metadata for discovery
The MCP Server exposes knowledge about your data assets to LLMs and AI agents, enabling powerful discovery capabilities. Agents can automatically discover and understand the available data models, their relationships, and their structures without human intervention. This allows agents to navigate complex data environments and produce accurate insights autonomously.
Accelerating discovery and reuse
dbt’s modular project structure is built on consistent naming conventions and layered model organization. dbt lineage lets you visualize dependencies as data flows through models, sources, and transformations. When you expose this rich context via the MCP Server, AI agents can automatically trace relationships, query metadata, and execute dbt commands, accelerating discovery, reuse, and development workflows without needing direct access to production systems.
Strengthening governance and trust
dbt helps you build a robust governance framework with software best practices like version control, testing, CI/CD, and auto-documentation. Key metadata, such as freshness, ownership, and sensitivity, provide clear guardrails to help AI agents make decisions based on your governance policies. The audit_helper package adds another layer of control by enabling easy comparisons between old and new models, helping you validate changes and prevent unintended impacts.
Standardizing AI-data integration via open protocol.
MCP replaces fragmented AI integrations with a universal standard, enabling AI agents to connect to dbt projects with reliability and scale. Using the MCP Server helps you accelerate future AI initiatives by allowing the creation and reuse of agents that operate on trusted, well-documented data models.
Take the next steps with the dbt MCP Server
The dbt MCP Server will fundamentally change how AI interacts with your data. By providing the missing glue between your dbt projects and AI agents, MCP Server ensures that your AI will deeply understand your data so you can trust the outcome of your AI projects.
The dbt MCP Server promises safe, reliable access to your structured data. Its built-in security features and access controls help ensure that AI agents operate within trusted guardrails. When dbt becomes the central control plane for your data, it provides a solid foundation for AI-driven insights, grounding every output in organizational truth.
The MCP Server is now available on GitHub for prototyping AI agents that will benefit from a deep understanding of how your data is structured and utilized.
To start building your reliable AI agents with the MCP Server, watch our webinar to view a demo of the MCP Server agentic AI workflow described above, and talk to a dbt expert to explore MCP pilot programs.
Published on: Aug 21, 2025
VS Code Extension
The free dbt VS Code extension is the best way to develop locally in dbt.
Don’t just read about data — watch it live at Coalesce Online
Register for FREE online access to keynotes and curated sessions from the premier event for data teams rewriting the future of data.
Set your organization up for success. Read the business case guide to accelerate time to value with dbt.