# Cube.dev MCP for AI Agents AI Agent Connect

> Cube.dev lets your AI agent talk directly to your data warehouse's semantic layer. It bridges the gap between natural language and your metrics, allowing your agent to fetch aggregated data, inspect generated SQL, explore your data models, and manage pre-aggregations. It ensures that when you ask a question, your agent pulls the correct, consistent numbers every time instead of guessing at the data.

## Overview
- **Category:** brain-trust
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_umZADPejupUUQHrfZkQT0lvv7MlK4j1JkrhOJOMy/ai-agent-connect
- **Tags:** semantic-layer, data-modeling, sql-api, rest-api, pre-aggregations

## Description

Connect your Cube.dev instance to your AI agent to bridge the gap between natural language and your data warehouse. This Connector allows your agent to interact with Cube's semantic layer, ensuring consistent metrics and high-performance data retrieval. When you ask a question, your agent doesn't have to guess your business logic; it uses the definitions you've already built. This makes it much easier to get accurate answers about your data without the usual back-and-forth between departments. It's a core part of the Vinkius catalog that helps you turn a complex data warehouse into a conversational tool. You can query metrics, inspect the logic being used, and even manage your pre-aggregations or Cloud deployments directly through your chat interface. It replaces the need to manually write queries for every single request, giving you a reliable way to explore your data model. Instead of looking at static dashboards, you get dynamic answers that stay in sync with your actual data source. You no longer have to worry about different departments using different formulas for the same metric, because the AI is looking at the same source of truth that your team has already verified. It provides a unified way to explore your data, whether you're looking for a high-level summary or a deep dive into specific segments. This connection turns your data into a live conversation where the AI understands the nuances of your business.

## Tools

### execute_cube_sql
Run a raw SQL query against the SQL API for deep data investigation.

### generate_meta_token
Create a JWT for the Metadata API when working with Cube Cloud.

### get_entity
Grab detailed metadata for a specific cube or view to understand its structure.

### get_meta
Retrieve the metadata for all cubes and views to see your whole data model.

### get_pre_aggregation_job_status
Check the progress of your background pre-aggregation builds.

### get_sql
View the SQL generated by a Cube query to see exactly how the data is being fetched.

### list_data_sources
See a list of all configured data sources in your Cube instance.

### list_deployments
View all your Cube Cloud deployments if you have the correct API key.

### list_entities
See a complete list of all cubes and views available in your model.

### list_environments
See the different environments for a specific deployment using Cube Cloud.

### load_query
Fetch aggregated data results based on your defined measures and dimensions.

### trigger_pre_aggregation_job
Start a new pre-aggregation build to keep your dashboard performance high.

### check_live
Verify if your current Cube deployment is live and reachable.

### check_ready
Confirm that your Cube deployment is fully initialized and ready for queries.

### convert_query
Turn a raw SQL query into the correct REST API query format.

## Prompt Examples

**Prompt:** 
```
Show me the metadata for all available cubes and views.
```

**Response:** 
```
I've retrieved the metadata. You have cubes for 'Orders', 'Users', and 'Products'. The 'Orders' cube includes measures like 'count' and 'totalAmount', and dimensions like 'status' and 'createdAt'.
```

**Prompt:** 
```
Run a query to get the total count of orders grouped by status for the last 30 days.
```

**Response:** 
```
Executing `load_query`... The results show 150 'completed' orders, 20 'pending', and 5 'cancelled' for the requested period.
```

**Prompt:** 
```
Trigger a pre-aggregation build for the 'Sales' cube.
```

**Response:** 
```
I've triggered the pre-aggregation job for the 'Sales' cube using `trigger_pre_aggregation_job`. You can check the status using the job token provided.
```

## Capabilities

### Fetch aggregated data with filters
Your agent pulls specific metrics and dimensions based on your predefined semantic layer rules.

### Inspect generated SQL for debugging
See the exact raw query your agent is running to verify the underlying logic.

### Explore cube definitions and views
Let your agent browse your entire data model to understand what questions it can answer.

### Trigger background pre-aggregation jobs
Start cache builds directly from your chat to ensure your dashboards stay fast.

### Check deployment status and environments
Verify if your Cube Cloud deployment is live and ready for production queries.

### Convert SQL queries to REST API formats
Transform manual SQL queries into the correct format for your agent to execute.

## Use Cases

### Answering complex business questions
A PM asks for 'Total revenue by region.' The agent uses `load_query` to fetch the data from the semantic layer.

### Debugging metric discrepancies
An engineer suspects a metric is wrong. The agent uses `get_sql` to show the query and `execute_cube_sql` to test it.

### Maintaining dashboard speed
A dashboard is loading slowly. The agent uses `trigger_pre_aggregation_job` to refresh the cache.

### Onboarding new users to the data
A new user wants to know what data is available. The agent uses `list_entities` and `get_meta` to map out the model.

## Benefits

- Accurate metrics: Use `load_query` to ensure your agent pulls numbers based on your actual business logic rather than guessing.
- Faster debugging: Use `get_sql` to see the exact SQL your agent is running, making it easier to spot and fix logic errors.
- Model transparency: Use `get_meta` to let your agent understand your full data model, including all available dimensions and filters.
- High performance: Use `trigger_pre_aggregation_job` to keep your data snappy by managing background cache builds directly via chat.
- Infrastructure oversight: Use `list_deployments` and `list_environments` to manage your Cube Cloud setup without switching tabs.
- Seamless conversion: Use `convert_query` to quickly turn manual SQL into the REST API format your agent needs to fetch data.

## How It Works

The bottom line is that your AI agent gets a direct line to your business logic, delivering accurate data without the manual query middleman.

1. Subscribe to the Cube.dev MCP and add your API URL and Secret Token to your environment.
2. Connect your AI client to the Vinkius catalog to activate the tools.
3. Ask your agent questions about your metrics, and it will query the semantic layer for the answers.

## Frequently Asked Questions

**Can the Cube.dev MCP help my AI agent understand our specific business metrics?**
Yes, it connects your agent to the Cube.dev semantic layer. This means the AI uses your predefined measures and dimensions, ensuring it speaks your company's specific data language.

**How does Cube.dev ensure the data my AI agent provides is consistent?**
It pulls data directly from your semantic layer rather than guessing. By using your established business logic, the agent provides consistent numbers every time you ask a question.

**Can I use Cube.dev to refresh my data caches using just a chat prompt?**
You can trigger pre-aggregation jobs directly through your chat. This allows you to refresh your data caches and keep your dashboards fast without needing to find the right button in a dashboard.

**How can I see the actual queries my AI agent is making to the data warehouse?**
You can ask your agent to show you the generated SQL for any query. This gives you full visibility into how the data is being fetched, which is great for auditing or debugging.

**Can Cube.dev help my team explore our data model without writing SQL?**
Yes, the agent can list all your cubes and views and show you the metadata for each. This makes it easy to see what data is available without ever opening a spreadsheet or a SQL editor.

**Can I check my Cube Cloud deployment status through my AI client?**
Yes, it can check if your deployment is live and ready. You can quickly verify your infrastructure status through a natural conversation with your agent.

**Can I see the exact SQL that Cube generates for a specific query?**
Yes. You can use the `get_sql` tool. By providing the query JSON, the agent will return the generated SQL string, which is perfect for debugging or verifying your data logic.

**How do I refresh the data cache or pre-aggregations using the AI?**
You can use the `trigger_pre_aggregation_job` tool. You can specify which cubes or data sources to target, and the agent will initiate the background build process for you.

**Is it possible to explore the available measures and dimensions?**
Absolutely. Use the `get_meta` tool to fetch all metadata. This allows the AI to understand what data is available to be queried, including views and segments.