A Model Context Protocol (MCP) server for integrating the Power BI REST API with GenAI applications such as Claude Desktop.
- FastMCP-based server targeting MCP SDK
>=1.27(protocol revision2025-11-25). - Azure AD OAuth2 authentication (client credentials flow) with token caching
and automatic refresh on
401 Unauthorized. - Typed async
httpxclient with typed exception hierarchy (PowerBIError,AuthenticationError,APIError,NotFoundError). - Full test suite using
pytest-httpxfor deterministic HTTP mocking.
| Tool | Description |
|---|---|
list_workspaces |
List all Power BI workspaces (groups) visible to the service principal. |
list_datasets(workspace_id?) |
List datasets in a workspace or across My Workspace. |
list_reports(workspace_id?) |
List reports in a workspace or across My Workspace. |
list_dashboards(workspace_id?) |
List dashboards in a workspace or across My Workspace. |
refresh_dataset(dataset_id, workspace_id?, notify_option?) |
Trigger an on-demand dataset refresh. |
get_dataset_refresh_history(dataset_id, workspace_id?, top?) |
Return the refresh history entries for a dataset. |
execute_dax_query(dataset_id, query, workspace_id?) |
Run a DAX EVALUATE ... query against a dataset. |
export_report(report_id, format, workspace_id?) |
Start an export job for a report (PDF, PPTX, PNG, etc.). |
git clone https://github.com/LokiMCPUniverse/powerbi-mcp-server.git
cd powerbi-mcp-server
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"Set the following environment variables (or put them in a local .env file):
| Variable | Required | Description |
|---|---|---|
POWERBI_TENANT_ID |
yes (client creds) | Azure AD tenant ID. |
POWERBI_CLIENT_ID |
yes (client creds) | Azure AD application ID. |
POWERBI_CLIENT_SECRET |
yes (client creds) | Azure AD application secret. |
POWERBI_ACCESS_TOKEN |
optional | Pre-minted bearer token; bypasses OAuth flow. |
POWERBI_API_BASE |
optional | Override API base (default https://api.powerbi.com/v1.0/myorg). |
POWERBI_TIMEOUT |
optional | HTTP timeout in seconds (default 30). |
The Azure AD application must be granted the Power BI service scope
https://analysis.windows.net/powerbi/api/.default and added as a
member/admin to any workspaces it needs to read from.
powerbi-mcpThis starts the MCP server on stdio.
Add the following entry to your Claude Desktop claude_desktop_config.json:
{
"mcpServers": {
"powerbi": {
"command": "powerbi-mcp",
"env": {
"POWERBI_TENANT_ID": "<tenant-guid>",
"POWERBI_CLIENT_ID": "<client-guid>",
"POWERBI_CLIENT_SECRET": "<client-secret>"
}
}
}
}pip install -e ".[dev]"
pytest -x --tb=short
ruff check src/ tests/MIT License - see LICENSE file for details.