powerbi-mcp-server
v0.1.0
Published
MCP server for interacting with Power BI semantic models via DAX queries
Maintainers
Readme
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
EVALUATEstatements 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
Build
npm install
npm run buildConfigure in Claude Code
Add to your Claude Code MCP settings (~/.claude/settings.json or project .claude/settings.json):
{
"mcpServers": {
"powerbi": {
"command": "node",
"args": ["/path/to/PowerBIMCP/dist/index.js", "--authentication", "interactive"],
"env": {}
}
}
}For Azure CLI authentication (if you're already logged in via az login):
{
"mcpServers": {
"powerbi": {
"command": "node",
"args": ["/path/to/PowerBIMCP/dist/index.js", "--authentication", "azcli"],
"env": {}
}
}
}With a specific tenant:
{
"mcpServers": {
"powerbi": {
"command": "node",
"args": [
"/path/to/PowerBIMCP/dist/index.js",
"--authentication", "interactive",
"--tenant", "your-tenant-id"
],
"env": {}
}
}
}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 DAXEVALUATEstatementworkspaceId(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
- List workspaces to find your workspace ID
- List datasets in that workspace to find your semantic model
- Discover model to understand the schema (tables, columns, measures)
- 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:
{
"mcpServers": {
"powerbi": {
"command": "node",
"args": ["/path/to/PowerBIMCP/dist/index.js"],
"env": {
"LOG_LEVEL": "debug"
}
}
}
}Use the MCP Inspector for interactive testing:
npm run inspect