Skip to content

LokiMCPUniverse/powerbi-mcp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Power BI MCP Server

Powerbi Mcp Server

GitHub stars GitHub forks GitHub watchers

License Issues Pull Requests Last Commit

Python MCP

A Model Context Protocol (MCP) server for integrating the Power BI REST API with GenAI applications such as Claude Desktop.

Features

  • FastMCP-based server targeting MCP SDK >=1.27 (protocol revision 2025-11-25).
  • Azure AD OAuth2 authentication (client credentials flow) with token caching and automatic refresh on 401 Unauthorized.
  • Typed async httpx client with typed exception hierarchy (PowerBIError, AuthenticationError, APIError, NotFoundError).
  • Full test suite using pytest-httpx for deterministic HTTP mocking.

Tool catalogue

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.).

Installation

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]"

Configuration

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.

Running

powerbi-mcp

This starts the MCP server on stdio.

Claude Desktop config

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>"
      }
    }
  }
}

Development

pip install -e ".[dev]"
pytest -x --tb=short
ruff check src/ tests/

License

MIT License - see LICENSE file for details.

Releases

No releases published

Packages

 
 
 

Contributors

Languages