Build with the Bruin MCP and AI
Use the Bruin MCP with an AI agent to generate the entire pipeline from a single prompt, query your data, and ask questions about your pipeline.
Video
What is the Bruin MCP?
The Bruin MCP (Model Context Protocol) gives AI agents access to Bruin's documentation, CLI commands, and your project context. The agent can read your code, run commands, query data, and troubleshoot issues on your behalf.
Steps
1) Install the MCP
For Cursor or VS Code, go to IDE settings > Tools & MCP > Add New MCP, and paste the Bruin MCP configuration from the docs.
If the MCP shows as unavailable, restart your IDE.
2) Initialize the template
bruin init zoomcamp
The template includes a README with an example prompt you can give to the AI agent to build the entire pipeline end-to-end.
3) Generate the pipeline with AI
Give the agent the prompt from the README. It will:
- Configure the pipeline YAML
- Create the Python ingestion asset with correct materialization
- Create seed assets for lookup tables
- Build staging and report SQL assets with dependencies
- Set up quality checks and column metadata
- Validate and run the pipeline
- Run queries to verify the data
In a real workflow, you'd typically go asset-by-asset to stay involved in design decisions. The single-prompt approach is shown here for demonstration.
4) Review the generated assets
Check that the agent:
- Set materialization strategies correctly (append for ingestion, time_interval or table for staging)
- Created proper dependencies between layers
- Added quality checks and column metadata
- Filtered queries using
{{ start_date }}and{{ end_date }}
5) Query data with natural language
Ask the agent questions about your data:
"Query the staging table and tell me how many days of data we have."
"Which day had the highest number of trips and total fare?"
The agent uses bruin query to run SQL against your database and returns the results.
6) Ask questions about the pipeline
The agent also understands your pipeline structure:
"In which asset are we aggregating data?"
It can explain the logic, identify where transformations happen, and help you troubleshoot issues.
Key takeaways
- The Bruin MCP lets AI agents read your code, run Bruin commands, and query your data
- You can generate entire pipelines from a prompt, but going asset-by-asset gives you more control
- Natural language querying is powerful for ad-hoc analysis and troubleshooting
- The agent understands pipeline structure and can explain the logic behind your assets