Featured

Deploy OpenClaw in 60 seconds β€” 20% off logoDeploy OpenClaw in 60 seconds β€” 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger β†’
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger β†’
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free β†’
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free β†’
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data β€” no proxies, no parsers, no maintenance.

Start building free β†’
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it β€” secured from day one.

Get it set up for you β†’
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free β†’
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here β†’

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

FreelexHo/power-bi-mcp MCP server](https://glama.ai/mcp/servers/FreelexHo/power-bi-mcp/badges/score.svg)](https://glama.ai/mcp/servers/FreelexHo/power-bi-mcp) 🐍 ☁️ πŸͺŸ 🍎 🐧 - Power BI MCP server with device code auth, enhanced refresh (table-level polling...

README.md

Power BI MCP Server

An MCP (Model Context Protocol) server that lets AI agents manage Power BI workspaces, datasets, and refreshes via natural language.

Features

Authentication & Discovery

| Tool | Description | |---|---| | pbi_auth | Authenticate via Azure AD device code flow (with token caching & auto-refresh) | | pbi_list_workspaces | List accessible workspaces (with optional name filter) | | pbi_list_datasets | List datasets in a workspace |

Dataset & Refresh Management

| Tool | Description | |---|---| | pbi_dataset_info | Aggregate dataset metadata + datasources + gateways + refresh schedule + impacted reports + PBIP locate (single call) | | pbi_refresh_dataset | Trigger an Enhanced refresh (supports table-level, polling, retry, timeout) | | pbi_refresh_manage | Refresh lifecycle: view history (status), get execution details (details), or cancel (cancel) |

Diagnostics & Source Code

| Tool | Description | |---|---| | pbi_diagnose | One-shot diagnostic report for refresh failures β€” root cause classification, error catalog, next actions, PBIP source hints | | pbi_locate_pbip | Locate PBIP source code for a dataset (fuzzy folder match + optional table TMDL & M source extraction) |

Query & Reporting

| Tool | Description | |---|---| | pbi_execute_query | Execute DAX queries against a dataset (supports RLS impersonation) | | pbi_scheduled_refresh_report | Generate a daily scheduled-refresh status report across all datasets in a workspace (JSON or Markdown table) |

Architecture

server.py            # Entry point β€” configures logging, runs MCP via stdio
app.py               # FastMCP instance with server instructions
config.py            # Configuration loader (config.json, defaults, constants)
auth.py              # Azure AD device code flow, token caching, HTTP helpers
diagnostics.py       # Refresh error classification, PBIP folder/table locator
error_catalog.py     # Error code catalog + regex patterns for failure classification
tools/               # MCP tool modules (auto-registered via __init__.py)
  β”œβ”€β”€ auth_tool.py   #   pbi_auth
  β”œβ”€β”€ workspace.py   #   pbi_list_workspaces, pbi_list_datasets
  β”œβ”€β”€ dataset.py     #   pbi_dataset_info
  β”œβ”€β”€ refresh.py     #   pbi_refresh_dataset, pbi_refresh_manage
  β”œβ”€β”€ diagnose.py    #   pbi_diagnose, pbi_locate_pbip
  β”œβ”€β”€ query.py       #   pbi_execute_query
  └── report.py      #   pbi_scheduled_refresh_report
setup.ps1            # Azure AD App Registration automation (PowerShell)
config.json          # User-specific config (gitignored)

Quick Start

1. Install dependencies

git clone https://github.com/FreelexHo/power-bi-mcp.git && cd power-bi-mcp
uv venv && uv sync

<details> <summary>Don't have uv? Use pip instead</summary>

python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate

pip install -e .

</details>

2. Register in your MCP client

Add to your MCP client configuration:

Cursor / Windsurf / Antigravity IDE (mcp.json):

{
  "mcpServers": {
    "power-bi": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/power-bi-mcp", "server.py"],
      "transport": "stdio"
    }
  }
}

3. Authenticate (one-time)

Just use the MCP! On first use, the agent will call pbi_auth and show you a message like:

To sign in, visit https://microsoft.com/devicelogin
and enter the code XXXXXXXX
  1. Open the link in your browser
  2. Enter the code shown
  3. Sign in with your Microsoft work account
  4. Approve the permissions

That's it. Tokens are cached to ~/.powerbi-mcp/token.json and auto-refreshed β€” you won't need to do this again unless you revoke access.

Configuration

The server works out of the box with a built-in public client_id. Create a config.json in the project root to customize:

{
    "client_id": "<your-azure-ad-client-id>",
    "token_cache_dir": "~/.powerbi-mcp",
    "pbip_root": "C:/path/to/your/pbip-repo/data/power-bi-report"
}

| Key | Default | Description | |---|---|---| | client_id | Built-in public app | Azure AD App Registration client ID | | token_cache_dir | ~/.powerbi-mcp | Directory for cached OAuth tokens | | pbip_root | (none) | Local PBIP repo root β€” enables pbi_locate_pbip and pbi_diagnose source-level hints |

A setup.ps1 script is included to automate App Registration creation via Azure CLI. See Advanced Setup below.

Troubleshooting

AADSTS7000218: The request body must contain ... client_assertion

Your organization may block public client flows. Ask your Azure AD admin to either:

  • Allow public client flows on the app registration, or
  • Create a dedicated App Registration for your team (use setup.ps1)

AADSTS65001: The user or administrator has not consented

First-time users in a new Azure AD tenant need to consent to Power BI permissions. If your tenant requires admin consent:

  • Ask your admin to grant consent via Azure Portal -> App registrations -> API permissions -> "Grant admin consent"
  • Or use setup.ps1 to create your own App Registration where you are the owner

AADSTS50076: MFA required or AADSTS50079

Multi-factor authentication is required by your organization. The device code flow supports MFA β€” complete the MFA challenge in your browser when prompted.

Not authenticated. Call pbi_auth first.

Token has expired and could not be refreshed. The agent should automatically re-trigger pbi_auth. If it doesn't, ask the agent to call pbi_auth again.

Token keeps expiring

By default, tokens are cached at ~/.powerbi-mcp/token.json. Make sure:

  • The directory is writable
  • You are not running multiple instances that overwrite each other's tokens

Refresh details return 403

A 403 on pbi_refresh_manage action=details typically indicates insufficient permissions or the refresh record has expired.

Advanced Setup

For organizations that require their own App Registration:

Prerequisites

  • Azure CLI
  • Azure AD permissions to create App Registrations

Run setup

./setup.ps1

This creates an Azure AD App Registration with the correct configuration:

| Setting | Value | |---|---| | Sign-in audience | Multi-tenant (any Azure AD directory) | | Public client flows | Enabled | | Redirect URI | https://login.microsoftonline.com/common/oauth2/nativeclient | | API Permissions | Power BI Service: Dataset.ReadWrite.All, Workspace.Read.All (Delegated) |

Tech Stack

  • Python β‰₯ 3.10
  • FastMCP (mcp[cli] β‰₯ 1.6.0) β€” MCP server framework, stdio transport
  • httpx β‰₯ 0.27.0 β€” HTTP client for Azure AD & Power BI REST API calls

License

MIT

See related servers & alternatives β†’

Related MCP servers

Browse all β†’

Related guides

Hand-picked reading to help you choose and use Developer Tools servers.