MCP for Data Lineage: What It Does and How to Test the Answers

Quick definition: MCP for data lineage

MCP for data lineage is the use of the Model Context Protocol (MCP) to expose a data lineage graph as tools an AI agent can call. The agent asks a lineage server what sits upstream of an asset, what depends on it downstream, and how two assets connect, then uses the answer in its next step.

For a long time, data lineage has been something an engineer looked up. A dashboard broke, or a migration was coming, and someone opened the graph, followed the edges, and noticed if a result looked thin. MCP changes who is asking. An agent in an IDE or an incident channel now calls the lineage graph in the middle of a task and acts on whatever comes back.

Connecting an agent to lineage is the easy part, and a growing number of catalogs and data platforms ship an MCP server that does that. The hard part is the lineage itself:

  • Whether each edge is correct
  • Whether the graph is complete, and
  • Whether an agent can tell a real “nothing depends on this” from a gap in coverage

All three can be tested before an agent is trusted with the answers.

How does MCP work with data lineage?

If you’re a data engineer wiring an agent into your stack, MCP works with data lineage by turning graph traversal into tool calls. A lineage server advertises a small set of tools, each with a name, a description, and typed inputs, and the agent decides when to call them. (For the protocol itself, see our guide to what an MCP server is.)

Lineage tools tend to come in two shapes:

  1. Traversal: Start from one asset and walk upstream to its sources or downstream to its consumers
  2. Path: Return the exact route between two data assets, including the transformations in between

The DataHub MCP Server exposes one tool for each. get_lineage returns upstream or downstream lineage for datasets, columns, dashboards, and other entities. get_lineage_paths_between returns the exact paths between two assets or columns, including intermediate transformations and SQL query information.

Column-level lineage is the granularity that makes these calls useful. Table-level lineage tells an agent that orders feeds a revenue dashboard. Column-level lineage tells the agent whether the specific field being changed is one the dashboard reads.

Three controls decide whether the tool holds up on a real graph:

  • Hop limits: How many steps from the starting asset the traversal goes
  • Filters: Narrowing results to a platform, an entity type, or a search within the lineage
  • Pagination: Returning a large result in pages the agent can work through

What teams use lineage tools for

Teams point agents at lineage for three jobs:

  1. Root cause analysis: Tracing the data flow upstream from a broken dashboard or failed check to the change that caused it
  2. Impact analysis: Listing what depends on a table or column before changing it
  3. Audit: Establishing data provenance by showing where a reported figure came from and how it was transformed along the way

Trustpilot is a working example of the second. The company is migrating from self-hosted MongoDB in AWS to Amazon DocumentDB, and its engineers trace the downstream impact of a collection migration through the DataHub UI, through chat, or by pulling lineage into Claude Code or Copilot through DataHub Cloud’s MCP integration.

“Lineage is one of the really big selling points. What people really want to do with that information is usually lineage-based—who do I need to go and ask, who’s querying my table, is it being used? All these things are lineage-based.”

Hugo HobsonSenior Data Engineer, Trustpilot

Why does lineage accuracy matter more when an agent is the consumer?

Picture an orders table that’s about to move to a new platform, and the question every migration starts with: what reads from it? An engineer opens the lineage view, sees two downstream tables, and remembers that a finance reconciliation job also reads orders every night. The graph looks thin, so the engineer goes digging. An agent that’s asked the same question calls the lineage tool, receives the same two tables, reports two dependencies, and drafts a migration plan around them.

Lineage accuracy matters more with the agent because it has no outside knowledge to check the result against. Whatever the tool returns becomes the premise for the next step, and the answer arrives in confident prose.

The empty result is the most acute version of the problem. “No downstream dependencies” can mean two very different things:

  • Nothing downstream: The asset has no consumers, and the change is safe
  • Nothing detected: Consumers exist, but the lineage never captured them

Both come back from the tool looking the same unless the server says otherwise.

Agents also chain calls. An incident agent might trace upstream from a failed dashboard, pick the most likely source, look up its owner, and open a ticket. One wrong edge at the first step sends every later step to the wrong team.

Block runs this kind of workflow. The company manages 50+ data platforms and paired the DataHub MCP Server with Goose, its open source AI agent, alongside internal MCP servers for its service registry and incident management system.

“Something that might have taken hours, or days, or even weeks turns into just a few simple, short conversation messages.”

Sam OsbornSenior Software Engineer, Block

That speed is precisely why agents need lineage. It is also why the quality of the lineage underneath deserves scrutiny, a theme we cover more broadly in our guide to MCP context management.

What does accurate lineage mean?

When a vendor describes its lineage as accurate, the claim can refer to three separate properties, and an agent needs all three. Accurate lineage means the edges are correct, the graph is complete, and the gaps are visible.

1. Correct edges

An edge is correct when the dependency it describes exists in the data. Whether that holds depends on how the lineage was derived, and for most warehouses and transformation tools the derivation is SQL parsing.

SQL is often ambiguous on its own. A query that joins two tables and selects unqualified column names, or uses SELECT *, doesn’t say which table each column came from. A parser with no knowledge of the table schemas has to guess or give up.

A schema-aware parser resolves those columns against the real schemas. DataHub’s open source SQL parser works this way, using schemas registered in DataHub to qualify columns and expand SELECT *. Our technical write-up on extracting column-level lineage from SQL walks through each step.

Schema awareness has a dependency of its own. Outdated or incorrect schema information reduces column-level accuracy, so correct edges rely on the metadata behind the parser staying current.

2. A complete graph

A graph is complete when every real dependency has an edge. Completeness fails in two places: between systems and inside hard SQL.

Between systems, each tool in modern data stacks sees only its own part of the pipeline. The warehouse knows its tables, the transformation tool knows its models, and the BI tool knows its dashboards. An agent asking about orders needs the chain that crosses all three.

“Most teams do not lack lineage—they lack connected lineage. They have five partial views from five different tools, and the gaps between those views are exactly where the most critical dependencies live.”

Manuela WeiPrincipal Product Manager, DataHub

Inside hard SQL, some statements produce no edge at all. The DataHub SQL parsing docs list the cases for DataHub’s parser, and they are common trouble spots for SQL-derived lineage in general:

  • Runtime-resolved table names: Table references must be static, so a function such as Snowflake’s identifier() produces no lineage
  • Multi-statement SQL and scripting: Only partly supported for table-level lineage
  • MERGE INTO: Table-level lineage is captured. Column-level lineage is best effort: it’s reliable when source and target columns share names
  • Scalar UDFs: Lineage points to the function’s input columns, but the function’s logic isn’t understood
  • Nested and semi-structured data: json_extract isn’t supported, and UNNEST and struct subfields are best effort

In the migration example, the reconciliation job that reads orders through a table name built at runtime is exactly the consumer that goes missing.

Coverage is measurable. In the IDC Business Value of DataHub Cloud study (March 2026), the five organizations interviewed reported that the share of their data sets with mapped lineage rose from 42% to 73% with DataHub Cloud.

3. Visible gaps

No lineage system captures everything, so the third property is whether an agent, or the person reviewing its work, can see where coverage stops. Three signals make gaps visible:

  • Published limits: Documentation of the statements and patterns the lineage doesn’t capture
  • Confidence signals: A score or flag on results the parser couldn’t fully resolve
  • Manual edges: A way to declare lineage for the cases automation misses

DataHub publishes its parser’s limits, returns a confidence score between 0 and 1 from the SDK’s parse_sql_lineage() method, reflecting how much of the schema it could resolve, and supports emitting lineage edges through the Python SDK for dynamic SQL, exotic UDFs, and custom macros.

How do you evaluate a lineage MCP server?

If you’re deciding whether an agent can act on lineage without a person reviewing every answer, the best approach is to test the server against lineage you already know. Each of the six tests below takes a few tool calls.

TestWhat to runWhat a good result looks like
Known pathPick a pipeline you can trace by hand and ask for its lineageEvery edge you know about is returned, with no extras
Hard casesQuery assets built with dynamic table names, MERGE, UDFs, and nested fieldsEdges are returned, or the miss matches a documented limit
Empty resultQuery an asset you know has consumers the lineage can’t seeThe response, or the docs, let you tell a gap from a true zero
Hop controlAsk for downstream impact at the default depth, then at a greater depthDependencies several hops out appear, and the default is stated
Large graphQuery a heavily used table with hundreds of consumersResults page cleanly and filters narrow them without dropping edges
Path between assetsAsk how a source column reaches a dashboard fieldThe route comes back with each transformation step, and you can retrieve the logic behind it

Run the tests through the agent as well as directly against the tool. A server can return the right edges and still be called badly if the tool descriptions don’t make hop limits and pagination clear to the model.

The hard cases matter most. A server that passes on clean SELECT statements and fails silently on the patterns your data pipelines use every night will give an agent a partial graph and no warning.

Where DataHub fits

DataHub exposes lineage to agents through the DataHub MCP Server, backed by lineage captured across the data stack. For teams evaluating it against the tests above:

  • Lineage tools: get_lineage covers upstream or downstream traversal at table and column level, with filtering, pagination, and hop control. get_lineage_paths_between returns exact paths, including the intermediate assets and the queries that connect them.
  • Derivation you can inspect: The SQL parser is schema-aware and open source, so you can run your own queries against it and see what comes back.
  • Documented limits: The cases the parser doesn’t cover are listed in the public docs.
  • Deployment: The managed MCP server, OAuth sign-in, and the DataHub Cloud plugins for Claude, ChatGPT, and Codex are available on DataHub Cloud. The self-hosted open source MCP server (mcp-server-datahub) works with DataHub Core and DataHub Cloud.

Organizations in the IDC study reduced data-related outages by 48% and resolved them 58% faster with DataHub Cloud. For how lineage supports model and agent workloads beyond MCP, see our guide to data lineage for AI.

To see how DataHub captures and serves column-level lineage, explore DataHub data lineage.

FAQs

What is an MCP for data?

An MCP for data is an MCP server that gives AI agents structured access to data systems or to metadata about them. Some servers run queries against a database. Others, such as a catalog’s server, return context about the data: schemas, lineage, ownership, data quality, and documentation. Agents often need both kinds to answer a question correctly.

Can MCP connect to a database?

Yes. An MCP server can sit in front of a database and expose tools for listing tables, reading schemas, and running queries. A database server tells an agent what is in a table. A lineage server tells the agent where that data originates and what depends on it, which the database alone doesn’t record across systems.

Can AI agents trace column-level lineage through MCP?

Yes, when the lineage server supports it. Column-level tools let an agent start from a single field and trace its data origins upstream or follow it downstream to the reports that use it. In the DataHub MCP Server, get_lineage works on columns as well as datasets and dashboards, and get_lineage_paths_between returns the path between two columns.

Is MCP enough to make data lineage trustworthy for AI agents?

No. MCP standardizes how an agent asks for lineage and receives it. The protocol has no view on whether the edges are correct or the graph is complete. Trustworthy answers depend on how the lineage was derived, how much of the stack it covers, and whether gaps in coverage are visible to the agent.

How do agents handle very large lineage graphs through MCP?

Agents handle large lineage graphs through limits built into the tool. Hop limits keep a traversal near the starting asset, filters narrow results to the platforms or entity types that matter, and pagination returns results in pages. A tool without these controls either truncates the answer or floods the agent’s context window.

Does the DataHub MCP Server work with open source DataHub?

Yes. The self-hosted open source MCP server (mcp-server-datahub) works with DataHub Core and with DataHub Cloud, and it includes the get_lineage and get_lineage_paths_between tools. The managed MCP server, OAuth sign-in, and the DataHub Cloud plugins for Claude, ChatGPT, and Codex are available on DataHub Cloud only.