{"slug": "how-to-connect-an-llm-agent-to-your-data-pipelines", "title": "How to Connect an LLM Agent to Your Data Pipelines", "summary": "Bruin released `bruin mcp`, an open-source (Apache 2.0) MCP server that runs over stdio beside a pipeline repository so coding agents such as Claude Code, Cursor and Codex can call the Bruin CLI (`bruin validate`, `bruin run`, `bruin lineage`, `bruin query`), alongside a Bruin Cloud MCP server at `cloud.getbruin.com/mcp` that exposes 36 tools for pipelines, runs, assets, logs and backfills. Each Bruin Cloud tool checks one permission on the token given to the agent, so a read-only token can diagnose a failure without changing anything, and Bruin recommends keeping the agent in a dev environment and reviewing its fixes as pull requests. The local server ships three read-only tools (`bruin_get_overview`, `bruin_get_docs_tree`, `bruin_get_doc_content`) that serve documentation built into the installed binary, and Bruin points to the dbt MCP server, Astronomer's Airflow MCP server and LangGraph with `langchain-mcp-adapters` as alternative routes.", "body_md": "**TL;DR:** Connect an LLM agent to your data pipelines by exposing them as MCP tools the agent can call, which in Bruin takes two servers. `bruin mcp` runs next to your pipeline repo, so a coding agent such as Claude Code, Cursor or Codex can learn and run the Bruin CLI (`bruin validate`, `bruin run`, `bruin lineage`, `bruin query`). The Bruin Cloud MCP at `cloud.getbruin.com/mcp` gives the agent 36 tools for pipelines, runs, assets, logs and backfills, and each tool checks one permission on the token you hand the agent, so a read-only token can diagnose a failure and change nothing. Keep the agent in a dev environment and review its fix as a pull request. Other routes: the dbt MCP server for dbt projects, Astronomer's Airflow MCP server for DAGs, and LangGraph with `langchain-mcp-adapters` for an agent you build yourself.\n\nAn LLM on its own knows SQL. It does not know your pipelines: where the code lives, which table feeds which, what failed last night and why. Connecting an agent means giving it those things through tools it can call, and drawing a clear line around what it may change.\n\nWe build [Bruin](https://getbruin.com), so we use it for the examples and say where other tools fit better.\n\n## [What an agent needs from your pipelines](#what-an-agent-needs-from-your-pipelines)\n\nAn agent needs four things: the code, the metadata around it, the errors, and a small set of actions. Bruin splits them between a local server for the repo and a cloud server for production.\n\n| Need | Example question | Bruin, local ( `bruin mcp` + terminal) | Bruin Cloud MCP | \n|---|---|---|---|\n| **Code** | \"Where is revenue computed?\" | Reads the SQL and Python asset files in the repo | `asset-list-tool` (asset details and dependencies) | \n| **Metadata** | \"What feeds this table, and which checks guard it?\" | `bruin lineage --full -o json` , columns and checks in each asset file | `asset-list-tool` ,`asset-health-tool` | \n| **Errors** | \"Why did last night's run fail?\" | `bruin run` output and the local`logs/` folder | `pipeline-run-list-tool` ,`asset-instance-list-tool` ,`asset-instance-logs-tool` | \n| **Actions** | \"Fix it and prove the fix.\" | Edits files, `bruin validate` ,`bruin run --environment dev` | `asset-rerun-tool` ,`pipeline-trigger-tool` (write permission needed) | \n\nThe two servers do different jobs. Locally, the agent changes code in a branch. In Bruin Cloud, it reads what happened in production and, only if you allow it, reruns things. Most teams want both.\n\n## [Step 1: Give the agent your repo with `bruin mcp`](#step-1-give-the-agent-your-repo-with-bruin-mcp)\n\n`bruin mcp`\n`bruin mcp` is part of the open-source Bruin CLI (Apache 2.0) and runs over stdio next to your project. Register it with the full path to the binary, because editors opened from the Dock or Start menu often don't read your shell's `PATH`:\n\n```\n# Claude Code, available in all your projects\nclaude mcp add --scope user bruin -- \"$(which bruin)\" mcp\nclaude mcp list\n```\n\nFor Cursor, add the same command to `~/.cursor/mcp.json`:\n\n```\n{\n  \"mcpServers\": {\n    \"bruin\": {\n      \"command\": \"/Users/you/.local/bin/bruin\",\n      \"args\": [\"mcp\"]\n    }\n  }\n}\n```\n\nVS Code and Codex take the same command. The [Bruin MCP docs](https://getbruin.com/docs/bruin/getting-started/bruin-mcp.html) have each config.\n\nThe server itself is deliberately small. It has three read-only tools, `bruin_get_overview`, `bruin_get_docs_tree` and `bruin_get_doc_content`, which serve the Bruin documentation built into the binary. So the agent reads docs that match the CLI version you installed, not a web page about a newer release. The work happens in the agent's terminal, with the commands you would type yourself:\n\n```\nbruin validate ./pipelines                          # config, references, dry-run queries\nbruin lineage --full -o json assets/orders.sql      # upstream and downstream as JSON\nbruin query -c bq -q \"SELECT status, count(*) FROM raw.orders GROUP BY 1\" -o json\nbruin run --environment dev assets/orders.sql       # build one asset and run its checks\n```\n\nBecause these are shell commands, your agent client shows each one and asks before running it unless you have allowed it. That is your review point for local work.\n\nTwo additions make the local agent more reliable:\n\n- **Skills and an `AGENTS.md`.**` bruin ai skills all` adds a Bruin section to`AGENTS.md` and starter skills such as`pipeline-diagnose` ,`freshness-check` and`quality-check-investigate` , so the agent follows the same steps every time.\n- **Dev as the default environment.** With`default_environment: dev` in`.bruin.yml` , a stray`bruin run` builds prefixed dev tables, not production ones.`bruin run --environment production` asks for confirmation unless`--force` is passed, so tell the agent in`AGENTS.md` never to use`--force` .\n\n```\n# .bruin.yml (Bruin adds it to .gitignore)\ndefault_environment: dev\nenvironments:\n  dev:\n    schema_prefix: agent_\n    connections:\n      google_cloud_platform:\n        - name: bq\n          project_id: acme-dev\n          service_account_file: /path/to/agent-dev.json\n  production:   # the agent reads production; Bruin Cloud writes it\n    config:\n      full_refresh_restricted: true   # --full-refresh can't drop and recreate tables\n    connections:\n      google_cloud_platform:\n        - name: bq\n          project_id: acme-prod\n          service_account_file: /path/to/reader.json\n          read_only: true\n```\n\nBigQuery, ClickHouse, DuckDB and MotherDuck connections accept `read_only: true`. Pair it with a warehouse user that can only read, and a query the agent gets wrong can't change production data.\n\n## [Step 2: Give the agent production runs with the Bruin Cloud MCP](#step-2-give-the-agent-production-runs-with-the-bruin-cloud-mcp)\n\nBruin Cloud runs your pipelines on a schedule and keeps the run history, logs and asset health. Its MCP server lives at `https://cloud.getbruin.com/mcp`. Create a personal access token in Bruin Cloud (user menu, **Access Tokens**), then:\n\n```\n# Claude Code\nclaude mcp add --transport http bruin_cloud https://cloud.getbruin.com/mcp \\\n  --header \"Authorization: Bearer YOUR_TOKEN_HERE\"\n```\n\nIn Cursor, add it to `~/.cursor/mcp.json`:\n\n```\n{\n  \"mcpServers\": {\n    \"bruin_cloud\": {\n      \"type\": \"streamable-http\",\n      \"url\": \"https://cloud.getbruin.com/mcp\",\n      \"headers\": { \"Authorization\": \"Bearer YOUR_TOKEN_HERE\" }\n    }\n  }\n}\n```\n\nIn Claude Desktop or on the web there is no token to paste: add `https://cloud.getbruin.com/mcp` as a custom connector, sign in to Bruin Cloud, and pick the team. That connection is limited to your own permissions on that team, and you can revoke it under **Profile → OAuth Apps**.\n\nThe [Cloud MCP docs](https://getbruin.com/docs/bruin/cloud/mcp-setup.html) list 36 tools as of November 2026, 16 that read and 20 that write:\n\n| Group | Read tools | Write tools | \n|---|---|---|\n| **Pipelines and runs** | `pipeline-list-tool` ,`pipeline-run-list-tool` ,`asset-runs-tool` ,`run-tags-tool` ,`validation-error-list-tool` | `pipeline-trigger-tool` ,`pipeline-rerun-tool` ,`pipeline-toggle-tool` ,`mark-pipeline-run-tool` ,`run-note-tool` ,`run-delete-tool` | \n| **Assets and logs** | `asset-list-tool` ,`asset-health-tool` ,`asset-instance-list-tool` ,`asset-instance-logs-tool` | `asset-rerun-tool` ,`mark-asset-run-tool` ,`mark-external-dependency-tool` , manual asset-health entries | \n| **Backfills** | `backfill-list-tool` | `backfill-trigger-tool` ,`backfill-mark-tool` ,`backfill-skip-assets-tool` ,`backfill-delete-tool` | \n| **Connections** | `connection-list-tool` (never secret values),`connection-types-tool` | `connection-create-tool` ,`connection-delete-tool` | \n| **Costs and alerts** | `cost-explorer-tool` ,`cost-explorer-schema-tool` ,`notification-rule-list-tool` ,`notification-rule-schema-tool` | create, update and delete notification rules | \n\nA failed quality check shows up here as a failed asset instance with its log, and assets that a blocking check stopped show as not run.\n\nIf the agent already has a terminal and a token, the CLI covers the same ground: `bruin cloud runs diagnose --project-id <id> --pipeline daily_revenue --latest` fetches the latest run, finds every failed asset and prints the errors and check results in one command. Bruin's own docs suggest that route when an assistant has shell access, and the MCP when it works through tool calls in chat.\n\n## [Step 3: Decide what the agent may change](#step-3-decide-what-the-agent-may-change)\n\nEvery Cloud MCP tool checks one concrete permission, such as `pipeline:run:list` or `pipeline:run:re-run`. The token must carry it, and for a personal token your own team role must grant it too. Pick the level when you create the token:\n\n| Access level | What the agent can do | \n|---|---|\n| **Read only** | View pipelines, runs, dashboards and agents | \n| **Read & write (no delete)** | Run pipelines and create or edit resources, without deletion | \n| **Read & write** | Everything your role permits, including deletion | \n| **Custom** | Only the permissions you tick | \n\nFor an agent that diagnoses failures and proposes fixes, a **Custom** token with `pipeline:list`, `pipeline:show`, `pipeline:run:list`, `pipeline:asset:show` and `pipeline:run:asset-instance:show` is enough. Add `pipeline:run:asset-instance:re-run` only when you want it to rerun assets itself. There is no reason to give it any `delete` permission or `connection:create`.\n\nSet an expiry too: 30, 60 or 90 days, a year, or a custom date (90 days is the default). Bruin Cloud flags a token as expiring 7 days before, and records token creation and changes, plus each API request with the calling token's name, in the [audit log](https://getbruin.com/docs/bruin/cloud/audit-logs.html). One token per agent and per tool, named for what it does (`mcp-cursor-diagnose`), makes that log readable.\n\n## [Walkthrough: from a failed run to a reviewed fix](#walkthrough-from-a-failed-run-to-a-reviewed-fix)\n\nHere is an example pipeline, `daily_revenue`. Setup: Claude Code with both servers registered, a Custom read token for Bruin Cloud, and the repo cloned with `dev` as the default environment. One prompt:\n\nThe daily_revenue pipeline failed last night. Find the cause, fix it on a new branch, prove the fix in dev, and show me the diff with your evidence. Don't rerun anything in production.\n\nWhat the agent calls, in order:\n\n1. **`pipeline-run-list-tool`** finds the latest failed run of` daily_revenue` .\n2. **`asset-instance-list-tool`** shows that` analytics.orders` failed on its checks, and that`analytics.revenue_daily` downstream never ran because the check is blocking.\n3. **`asset-instance-logs-tool`** returns the failure: the` accepted_values` check on`status` found rows outside`[paid, refunded, pending]` .\n4. **In the terminal** , it reads`assets/orders.sql` , then runs`bruin lineage --full -o json` on it to see which tables and dashboards sit downstream.\n5. It runs `bruin query` in dev to count each`status` in the source and finds a new value,`partially_refunded` , that started arriving yesterday.\n6. It writes the change: the new value in `accepted_values` , and a line in the revenue SQL for partially refunded orders. Then it asks you the one thing it can't know: do partially refunded orders count as revenue, and at what amount?\n7. After your answer, it runs `bruin validate` and`bruin run --environment dev --downstream assets/orders.sql` , and the checks pass on the dev tables.\n8. It shows the diff, the log line, and the query result behind its diagnosis.\n\nHow you review it: read the diff next to the evidence, not just the summary. Open the pull request, let CI run `bruin validate` and your unit tests (our [CI/CD testing guide](https://getbruin.com/blog/how-to-test-data-pipelines-in-ci-cd/) has the workflow), and merge. Then rerun the failed run from Bruin Cloud yourself, or give the token `pipeline:run:re-run` so the agent can call `pipeline-rerun-tool`. Either way the rerun lands in the audit log.\n\nThe business rule in step 6 is why the human stays in the loop. The agent can find a new status in seconds. Whether it counts as revenue is your call.\n\nThis works because the agent's context lives in one place. ProphetX runs ingestion, transformation, checks and definitions from one Bruin repo, and its VP of Analytics says a crash gets a root cause analysis in 15 minutes. [Read the case study](https://getbruin.com/case-studies/prophetx/).\n\n## [Other ways to connect an agent](#other-ways-to-connect-an-agent)\n\n| Route | What the agent can reach | Setup | Fits when | \n|---|---|---|---|\n| **Bruin** (`bruin mcp` + Bruin Cloud MCP) | Ingestion, SQL and Python assets, checks and lineage in the repo; runs, logs, assets, backfills and costs in Cloud | One `claude mcp add` per server; scoped token or OAuth for Cloud | Your pipeline, from ingestion to checks, lives in one project | \n| **dbt MCP server** | dbt CLI tools ( `build` ,`run` ,`test` ,`compile` ,`show` ; local only), Discovery API lineage and model health, Semantic Layer, read-only`execute_sql` , Admin API jobs | `dbt-mcp` locally, or the remote server on the dbt platform | Transformations live in dbt and ingestion runs elsewhere | \n| **Airflow MCP server** (Astronomer, Apache 2.0) | DAGs, runs, task logs and import errors; trigger, clear and pause DAGs | `uvx astro-airflow-mcp --transport stdio` | Orchestration lives in Airflow 2.x or 3.x | \n| **LangGraph** with`langchain-mcp-adapters` | Any MCP server above as LangChain tools, plus your own Python functions | `MultiServerMCPClient` , then`get_tools()` | You are building your own agent rather than using a coding agent | \n| **Your own HTTP tools** | Whatever you wrap. Bruin Cloud's [query API](https://getbruin.com/docs/bruin/cloud/ai-agents/query-api.html) runs read-only SQL with credentials kept in Bruin | A team token and an HTTP call | A narrow agent that only needs to query | \n\nThe dbt remote server leaves out the CLI and codegen tools, and which tools you get depends on your dbt plan. Astronomer's server works with open-source Airflow and installs alongside Astronomer's agent skills.\n\nIf you build your own agent, the same Bruin Cloud tools load into LangGraph in a few lines:\n\n``` python\nimport os\nfrom langchain_mcp_adapters.client import MultiServerMCPClient\nfrom langchain.agents import create_agent\n\nclient = MultiServerMCPClient({\n    \"bruin_cloud\": {\n        \"transport\": \"http\",\n        \"url\": \"https://cloud.getbruin.com/mcp\",\n        \"headers\": {\"Authorization\": f\"Bearer {os.environ['BRUIN_CLOUD_TOKEN']}\"},\n    }\n})\ntools = await client.get_tools()\nagent = create_agent(\"provider:model-name\", tools)\nawait agent.ainvoke({\"messages\": \"Which assets failed in the latest daily_revenue run?\"})\n```\n\nFor the wider list of data tools with MCP servers, see [which data tools have a built-in MCP server](https://getbruin.com/blog/data-tools-with-mcp-servers-2026/). For building new pipelines with an agent rather than fixing them, see [how to build data pipelines with AI agents](https://getbruin.com/blog/how-to-build-data-pipelines-with-ai-agents/).\n\n## [Mistakes to avoid](#mistakes-to-avoid)\n\n1. **A token with delete rights \"just in case\".** Start with read only. Add one write permission when a real task needs it.\n2. **Production as the default environment.** Make`dev` the default and give production a read-only connection where your warehouse supports it.\n3. **A token in a committed file.** Project-level files such as`.cursor/mcp.json` often end up in Git. Put the Cloud token in the user-level config or an environment variable.\n4. **Letting the agent merge its own fix.** It opens the pull request. A person merges it, after CI passes.\n5. **Connecting the warehouse but not the pipeline.** A warehouse-only server shows the agent tables, not how they are produced or which checks guard them. Lineage and checks are what let it trace a wrong number to its cause. More on that in[how to give AI agents context about your company data](https://getbruin.com/blog/how-to-give-ai-agents-context-about-company-data/) .\n\n## [FAQ](#faq)\n\n### [How do I connect an LLM agent to my data pipelines?](#how-do-i-connect-an-llm-agent-to-my-data-pipelines)\n\nExpose the pipelines as MCP tools and register them with your agent. With Bruin, run `claude mcp add --scope user bruin -- \"$(which bruin)\" mcp` so the agent can use the Bruin CLI in your repo, and add the Bruin Cloud MCP at `https://cloud.getbruin.com/mcp` with a scoped token so it can read runs and logs. For dbt projects use the dbt MCP server, and for Airflow use Astronomer's Airflow MCP server.\n\n### [Does Bruin have an MCP server?](#does-bruin-have-an-mcp-server)\n\nYes, two. `bruin mcp` ships with the open-source Bruin CLI and gives a coding agent the Bruin docs for your installed version, so it can run commands like `bruin validate` and `bruin run` in your terminal. The Bruin Cloud MCP has 36 tools for pipelines, runs, assets, logs, backfills, connections and costs, each behind a token permission.\n\n### [Can an AI agent rerun my data pipelines safely?](#can-an-ai-agent-rerun-my-data-pipelines-safely)\n\nYes, if you scope it. In Bruin Cloud each MCP tool needs one permission on the agent's token, so an agent can rerun an asset only if you grant `pipeline:run:asset-instance:re-run`, and every rerun is recorded in the audit log. Locally, `bruin run` asks for confirmation before running in a production environment unless `--force` is passed.\n\n### [What permissions should I give an AI agent's token?](#what-permissions-should-i-give-an-ai-agents-token)\n\nStart with a read-only or Custom token that can list pipelines, runs and assets and read logs, with an expiry of 90 days or less. In Bruin Cloud that is `pipeline:list`, `pipeline:show`, `pipeline:run:list`, `pipeline:asset:show` and `pipeline:run:asset-instance:show`. Add rerun or trigger permissions only for a task that needs them, and never give an agent delete permissions.\n\n### [Do I need Bruin Cloud to connect an agent to Bruin pipelines?](#do-i-need-bruin-cloud-to-connect-an-agent-to-bruin-pipelines)\n\nNo. `bruin mcp` is part of the open-source CLI and works on any local Bruin project, including DuckDB projects on a laptop. Bruin Cloud adds scheduled runs, run history, logs, asset health and costs, and its MCP server is how an agent reads them.\n\n### [Can I connect my own LangGraph agent to Bruin?](#can-i-connect-my-own-langgraph-agent-to-bruin)\n\nYes. Load the Bruin Cloud MCP tools into LangGraph with `MultiServerMCPClient` from `langchain-mcp-adapters`, passing your Bruin token in the `Authorization` header. If the agent only needs to query data, Bruin Cloud's query API runs read-only SQL with the warehouse credentials kept in Bruin.\n\n## [Try Bruin](#try-bruin)\n\nInstall the [Bruin CLI](https://github.com/bruin-data/bruin), run `bruin init` to create a project, register `bruin mcp` with your agent, and ask it to explain one pipeline before you let it change one. When you are ready for production, create a read-only token in [Bruin Cloud](https://getbruin.com/product/cloud/) and connect the Cloud MCP. The [API token docs](https://getbruin.com/docs/bruin/cloud/api-tokens.html) cover every access level, and the [Bruin MCP page](https://getbruin.com/product/mcp/) shows what agents can do with it.", "url": "https://wpnews.pro/news/how-to-connect-an-llm-agent-to-your-data-pipelines", "canonical_source": "https://getbruin.com/blog/how-to-connect-an-llm-agent-to-data-pipelines/", "published_at": "2026-11-15 00:00:00+00:00", "updated_at": "2026-11-25 17:17:22.296566+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "developer-tools", "mlops"], "entities": ["Bruin", "bruin mcp", "Bruin Cloud MCP", "Claude Code", "Cursor", "Codex", "dbt", "Astronomer"], "also_reported_by": [], "takeaway": "Register `bruin mcp` with the full binary path (editors launched from the Dock or Start menu often miss your shell PATH), and give the agent a read-only Bruin Cloud token so its 36 tools can diagnose failures without changing production.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/how-to-connect-an-llm-agent-to-your-data-pipelines", "markdown": "https://wpnews.pro/news/how-to-connect-an-llm-agent-to-your-data-pipelines.md", "text": "https://wpnews.pro/news/how-to-connect-an-llm-agent-to-your-data-pipelines.txt", "jsonld": "https://wpnews.pro/news/how-to-connect-an-llm-agent-to-your-data-pipelines.jsonld"}}