Power BI MCP Server
# Power BI MCP Server
An MCP (Model Context Protocol) server that connects to Power BI semantic models, enabling natural language queries via DAX through AI assistants like Claude.
## Features
- **List workspaces** — Browse all Power BI workspaces you have access to
- **List datasets** — See semantic models in any workspace
- **Discover model schema** — Inspect tables, columns, measures, and data types via DMV queries
- **Execute DAX queries** — Run DAX `EVALUATE` statements and get structured results
- **Refresh datasets** — Trigger and monitor dataset refreshes
- **Get dataset details** — View metadata for any semantic model
## Authentication
Authenticates with Microsoft Entra ID, following the same patterns as the Azure MCP and Azure DevOps MCP servers. Three modes are supported:
| Mode | Flag | Description |
|------|------|-------------|
| **Interactive** (default) | `--authentication interactive` | Opens a browser for OAuth login |
| **Azure CLI** | `--authentication azcli` | Uses your `az login` session |
| **Environment** | `--authentication env` | Uses `DefaultAzureCredential` (service principal env vars, managed identity, etc.) |
You can optionally pass `--tenant <tenant-id>` for single-tenant or B2B scenarios.
## Setup
### Prerequisites
- Node.js 18+
- An Azure/Microsoft Entra ID account with access to Power BI
### Install from npm
```bash
npm install -g powerbi-mcp-server
```
### Configure in Claude Code
Add to your Claude Code MCP settings (`~/.claude/settings.json` or project `.claude/settings.json`):
```json
{
"mcpServers": {
"powerbi": {
"command": "npx",
"args": ["-y", "powerbi-mcp-server", "--authentication", "interactive"]
}
}
}
```
For Azure CLI authentication (if you're already logged in via `az login`):
```json
{
"mcpServers": {
"powerbi": {
"command": "npx",
"args": ["-y", "powerbi-mcp-server", "--authentication", "azcli"]
}
}
}
```
With a specific tenant:
```json
{
"mcpServers": {
"powerbi": {
"command": "npx",
"args": ["-y", "powerbi-mcp-server", "--authentication", "interactive", "--tenant", "your-tenant-id"]
}
}
}
```
### Build from source
```bash
git clone https://github.com/mbmccormick/powerbi-mcp-server.git
cd powerbi-mcp-server
npm install
npm run build
```
## Available Tools
### `list_workspaces`
List all Power BI workspaces the authenticated user has access to.
### `list_datasets`
List datasets (semantic models) in a workspace.
- `workspaceId` (optional) — omit for "My Workspace"
### `get_dataset`
Get detailed information about a specific dataset.
- `datasetId` (required)
- `workspaceId` (optional)
### `get_tables`
List tables in a dataset via the REST API.
- `datasetId` (required)
- `workspaceId` (optional)
### `discover_model`
Discover the full schema of a semantic model (tables, columns, measures) using DMV queries. This is the best tool to call first before writing DAX queries.
- `datasetId` (required)
- `workspaceId` (optional)
### `execute_dax_query`
Execute a DAX query against a semantic model.
- `datasetId` (required)
- `query` (required) — a valid DAX `EVALUATE` statement
- `workspaceId` (optional)
### `refresh_dataset`
Trigger a dataset refresh.
- `datasetId` (required)
- `workspaceId` (optional)
### `get_refresh_history`
Get refresh history for a dataset.
- `datasetId` (required)
- `workspaceId` (optional)
- `top` (optional) — number of entries, defaults to 10
## Example Workflow
1. **List workspaces** to find your workspace ID
2. **List datasets** in that workspace to find your semantic model
3. **Discover model** to understand the schema (tables, columns, measures)
4. **Execute DAX queries** to answer questions about your data
```
"Show me total sales by region for 2024"
→ discover_model → execute_dax_query with:
EVALUATE SUMMARIZECOLUMNS('Geography'[Region], 'Date'[Year], "Total Sales", SUM('Sales'[Amount]))
```
## Debugging
Set `LOG_LEVEL=debug` for verbose logging:
```json
{
"mcpServers": {
"powerbi": {
"command": "npx",
"args": ["-y", "powerbi-mcp-server", "--authentication", "interactive"],
"env": {
"LOG_LEVEL": "debug"
}
}
}
}
```
Use the MCP Inspector for interactive testing:
```bash
npm run inspect
```
TDQS
Scored across 8 tools
Most tools are clearly distinct by resource and action: workspace/dataset listing, dataset detail, DAX query, refresh, and refresh history. The only notable overlap is get_tables versus discover_model, but the description explicitly separates push datasets from semantic models.
All tools use a consistent snake_case verb-noun pattern: get_, list_, execute_, refresh_, and discover_. The variation between get_tables and list_datasets is semantically reasonable rather than inconsistent.
Eight tools is well-scoped for a Power BI MCP server focused on discovery, querying, and refresh. Each tool covers a meaningful operation without obvious redundancy.
The surface covers the core semantic-model workflow: list workspaces/datasets, inspect schemas, run DAX, refresh, and inspect refresh history. Minor gaps remain around reports/dashboards, workspace administration, and refresh lifecycle controls such as cancellation or schedules.