PowerBI MCP Server

io.github.gurvinder-dhillon由 GitHub 帳號 gurvinder-dhillon 發布v0.1.2更新於 Oct 24, 2026

PowerBI REST API integration. Query workspaces, datasets, and execute DAX queries via MCP.

已驗證STDIO僅桌面資料庫資料與分析

概覽

AI 產生的概覽

讓助理透過 PowerBI REST API 瀏覽 PowerBI 工作區、資料集與報表,並對資料集執行 DAX 查詢。

可以做什麼
提供工具列出可存取 PowerBI 工作區、資料集與報表,並檢視資料集的結構描述、資料表、參數與重新整理歷程。query_dataset 工具可對指定資料集執行 DAX 查詢,查詢必須以 EVALUATE 開頭。結果可依簡潔、一般或完整層級回傳,並支援 markdown 或 JSON 格式。
適用情境
適合想在不開啟 PowerBI 的情況下探索 PowerBI 內容,或以對話方式查詢 PowerBI 資料的情境。適用於已有 PowerBI 租用戶、想讓助理探索資料集、查看結構描述或執行 DAX 查詢的分析人員與開發者。
執行需求
以 Python 套件(powerbi-mcp)透過 uvx 在本機執行,僅支援桌面端。需要具備 PowerBI API 存取權的 Azure AD 應用程式註冊,以及環境變數 POWERBI_TENANT_ID、POWERBI_CLIENT_ID 與 POWERBI_CLIENT_SECRET。服務主體必須在 PowerBI 管理入口網站中啟用,並被授予每個工作區的 Admin、Member 或 Contributor 權限。需要連線至 PowerBI REST API 的網路存取。
安裝前請注意
需要密鑰 POWERBI_CLIENT_SECRET,應避免提交至版本控制並定期輪換。文件說明此伺服器對 PowerBI 資料集具有讀寫權限,因此應使用最小權限的工作區角色。DAX 查詢與資料集中繼資料會傳送至 PowerBI REST API,助理可讀取服務主體能存取的所有工作區、資料集與報表資訊。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 PowerBI MCP Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

PowerBI MCP Server

[PyPI] [Python Versions] [License: MIT]

A Model Context Protocol (MCP) server that provides tools for interacting with PowerBI REST APIs. This server enables AI assistants like Claude to query PowerBI workspaces, datasets, and execute DAX queries.

[!WARNING] Security Best Practices

  • Never commit credentials to version control
  • Store credentials in .env files (add to .gitignore)
  • Rotate client secrets regularly in Azure AD
  • Use least-privilege access (only grant necessary workspace permissions)
  • This server has read/write access to PowerBI datasets - use with caution

✨ Features

  • Query Your Data: Run DAX queries to extract insights and analyze your PowerBI data directly through conversation
  • Discover Workspaces & Datasets: Explore what data is available across your organization's PowerBI environment
  • Understand Data Models: Get detailed schema information to know what tables, columns, and relationships exist
  • Natural Language to Insights: Ask questions about your data and get answers without opening PowerBI

See all available tools below.

💡 What Can You Do?

ScenarioExample Prompt
Explore available data"What workspaces do I have access to?"
Discover reports"What reports are available in my workspace?"
Understand data schema"Show me the schema for dataset [dataset-name]"
Monitor data freshes"When was this dataset last refreshed?"
Check parameters"What parameters does this dataset accept?"
Query data with DAX"Run a DAX query to get top 10 sales by region from [dataset]"
Analyze data quality"What tables are in the Sales dataset?"
Extract insights"Get the list of all measures in the Financial dataset"

📋 Prerequisites

  • Azure AD Service Principal: Required for authentication. Follow the Azure AD Configuration steps below to set this up.

🔐 Azure AD Configuration

Before installing the server, you need to set up an Azure AD application with PowerBI access.

Create Azure AD App Registration

  1. Go to Azure Portal
  2. Navigate to Azure Active Directory > App registrations
  3. Click New registration
  4. Enter a name (e.g., "PowerBI MCP Server")
  5. Click Register

Get Credentials

After registration, collect these values:

  • Tenant ID: Found in app Overview page (Directory ID)
  • Client ID: Found in app Overview page (Application ID)
  • Client Secret:
    • Go to Certificates & secrets
    • Click New client secret
    • Add description and set expiry
    • Copy the secret Value (you can only see this once!)

Enable Service Principal in PowerBI

  1. Go to PowerBI Admin Portal
  2. Navigate to Tenant settings > Developer settings
  3. Enable Service principals can use PowerBI APIs
  4. Add your app to the security group or enable for entire organization
  5. Click Apply

[!NOTE] Service principals can access workspaces where they've been granted explicit permissions (Admin, Member, or Contributor roles).

Grant Workspace Access

For each workspace you want to access:

  1. Go to the workspace in PowerBI
  2. Click workspace settings (⚙️) > Access
  3. Click Add people or groups
  4. Search for your app name
  5. Assign role: Admin, Member, or Contributor
  6. Click Add

📦 Installation

Method 0: From PyPI (Recommended)

Once published to PyPI, this is the simplest installation method.

Add the following to your MCP client configuration file:

For Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

json
{  "mcpServers": {    "powerbi-mcp": {      "command": "uvx",      "args": ["powerbi-mcp"],      "env": {        "POWERBI_TENANT_ID": "your-tenant-id-here",        "POWERBI_CLIENT_ID": "your-client-id-here",        "POWERBI_CLIENT_SECRET": "your-client-secret-here"      }    }  }}

For Claude Code (./.mcp.json in your project directory):

json
{  "mcpServers": {    "powerbi-mcp": {      "command": "uvx",      "args": ["powerbi-mcp"],      "env": {}    }  }}

When using Claude Code, create a .env file in your project directory (where you run Claude Code from):

env
POWERBI_TENANT_ID=your-tenant-id-herePOWERBI_CLIENT_ID=your-client-id-herePOWERBI_CLIENT_SECRET=your-client-secret-here

[!TIP] The .env file should be in your working directory, not where the server is installed.

For OpenCode (~/.config/opencode/opencode.json):

json
{  "$schema": "https://opencode.ai/config.json",  "mcp": {    "powerbi-mcp": {      "type": "local",      "command": ["uvx", "powerbi-mcp"],      "enabled": true,      "env": {        "POWERBI_TENANT_ID": "your-tenant-id-here",        "POWERBI_CLIENT_ID": "your-client-id-here",        "POWERBI_CLIENT_SECRET": "your-client-secret-here"      }    }  }}

After adding the configuration, restart your MCP client.

Method 1: Direct from GitHub (Development)

This method uses uvx to run the server directly from GitHub without cloning the repository.

Add the following to your MCP client configuration file:

For Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

json
{  "mcpServers": {    "powerbi-mcp": {      "command": "uvx",      "args": [        "--from",        "git+https://github.com/gurvinder-dhillon/powerbi-mcp@main",        "run-server"      ],      "env": {        "POWERBI_TENANT_ID": "your-tenant-id-here",        "POWERBI_CLIENT_ID": "your-client-id-here",        "POWERBI_CLIENT_SECRET": "your-client-secret-here"      }    }  }}

For Claude Code (./.mcp.json in your project directory):

json
{  "mcpServers": {    "powerbi-mcp": {      "command": "uvx",      "args": [        "--from",        "git+https://github.com/gurvinder-dhillon/powerbi-mcp@main",        "run-server"      ],      "env": {}    }  }}

When using Claude Code, create a .env file in your project directory (where you run Claude Code from):

env
POWERBI_TENANT_ID=your-tenant-id-herePOWERBI_CLIENT_ID=your-client-id-herePOWERBI_CLIENT_SECRET=your-client-secret-here

[!TIP] The .env file should be in your working directory, not where the server is installed.

The server will automatically load environment variables from the .env file in your current working directory.

For OpenCode (~/.config/opencode/opencode.json):

json
{  "$schema": "https://opencode.ai/config.json",  "mcp": {    "powerbi-mcp": {      "type": "local",      "command": [        "uvx",        "--from",        "git+https://github.com/gurvinder-dhillon/powerbi-mcp@main",        "run-server"      ],      "enabled": true,      "env": {        "POWERBI_TENANT_ID": "your-tenant-id-here",        "POWERBI_CLIENT_ID": "your-client-id-here",        "POWERBI_CLIENT_SECRET": "your-client-secret-here"      }    }  }}

After adding the configuration, restart your MCP client.

Method 2: Local Clone (Contributors)

For contributors who want to run from a local clone:

  1. Clone the repository:
bash
git clone https://github.com/gurvinder-dhillon/powerbi-mcp.gitcd powerbi-mcp
  1. Install dependencies:
bash
uv sync
  1. Add to your MCP client configuration:

For Claude Desktop:

json
{  "mcpServers": {    "powerbi-mcp-local": {      "command": "uv",      "args": [        "--directory",        "/absolute/path/to/powerbi-mcp",        "run",        "run-server"      ],      "env": {        "POWERBI_TENANT_ID": "your-tenant-id-here",        "POWERBI_CLIENT_ID": "your-client-id-here",        "POWERBI_CLIENT_SECRET": "your-client-secret-here"      }    }  }}

For Claude Code (./.mcp.json in your project directory):

json
{  "mcpServers": {    "powerbi-mcp-local": {      "command": "uv",      "args": [        "--directory",        "/absolute/path/to/powerbi-mcp",        "run",        "run-server"      ],      "env": {}    }  }}

For OpenCode (~/.config/opencode/opencode.json):

json
{  "$schema": "https://opencode.ai/config.json",  "mcp": {    "powerbi-mcp-local": {      "type": "local",      "command": [        "uv",        "--directory",        "/absolute/path/to/powerbi-mcp",        "run",        "run-server"      ],      "enabled": true,      "env": {        "POWERBI_TENANT_ID": "your-tenant-id-here",        "POWERBI_CLIENT_ID": "your-client-id-here",        "POWERBI_CLIENT_SECRET": "your-client-secret-here"      }    }  }}

Replace /absolute/path/to/powerbi-mcp with the actual path to your cloned repository.

When using Claude Code or OpenCode, create a .env file in your project directory with your credentials (see Method 1 Claude Code section above for the format).

🚀 Quick Start

Once installed, try these steps to get started:

  1. Verify Connection: Ask Claude "What PowerBI workspaces do I have access to?"
  2. Explore Data: "Show me the datasets in workspace [workspace-name]"
  3. View Schema: "What tables are in dataset [dataset-name]?"
  4. Run a Query: "Execute this DAX query on [dataset-name]: EVALUATE TOPN(10, Sales)"

🛠️ Available Tools

ToolDescriptionKey Parameters
get_workspacesList accessible PowerBI workspacestop, detail
get_datasetsGet datasets from workspace or "My workspace"workspace_id, detail
get_datasetGet detailed dataset info including schemadataset_id, workspace_id, detail
get_reportsList PowerBI reports in workspaceworkspace_id, format, detail
get_refresh_historyGet dataset refresh history with status/timestampsdataset_id, workspace_id, top, format
get_parametersList dataset parameters and their current valuesdataset_id, workspace_id, format, detail
query_datasetExecute DAX queries against datasetdataset_id, dax_query, workspace_id

Tool Details

1. get_workspaces

List PowerBI workspaces accessible to the service principal.

Parameters:

  • top (optional): Number of workspaces to return (default: 100, max: 5000)
  • detail (optional): Level of detail - "concise", "normal", or "full" (default: "normal")
2. get_datasets

Get list of datasets from a workspace or "My workspace".

Parameters:

  • workspace_id (optional): Workspace ID (omit for "My workspace")
  • detail (optional): Level of detail - "concise", "normal", or "full" (default: "normal")
3. get_dataset

Get detailed information about a specific dataset including schema and tables.

Parameters:

  • dataset_id (required): Dataset ID
  • workspace_id (optional): Workspace ID (omit for "My workspace")
  • detail (optional): Level of detail - "concise", "normal", or "full" (default: "normal")
4. get_reports

List PowerBI reports in a workspace.

Parameters:

  • workspace_id (optional): Workspace ID (omit for "My workspace")
  • format (optional): Response format - "markdown" or "json" (default: "markdown")
  • detail (optional): Level of detail - "concise" or "normal" (default: "concise")
5. get_refresh_history

Get refresh history for a dataset showing recent refresh operations.

Parameters:

  • dataset_id (required): Dataset ID
  • workspace_id (optional): Workspace ID (omit for "My workspace")
  • top (optional): Number of refresh records to return (default: 5, max: 60)
  • format (optional): Response format - "markdown" or "json" (default: "markdown")
6. get_parameters

Get parameters defined in a dataset.

Parameters:

  • dataset_id (required): Dataset ID
  • workspace_id (optional): Workspace ID (omit for "My workspace")
  • format (optional): Response format - "markdown" or "json" (default: "markdown")
  • detail (optional): Level of detail - "concise" or "normal" (default: "normal")

Note: Not supported for datasets with SQL, Oracle, Teradata, SAP HANA DirectQuery connections or datasets modified via XMLA endpoint.

7. query_dataset

Execute DAX queries against a dataset.

Parameters:

  • dataset_id (required): Dataset ID
  • dax_query (required): DAX query (must start with "EVALUATE")
  • workspace_id (optional): Workspace ID (omit for "My workspace")

DAX Query Examples

Basic Table Scan:

dax
EVALUATE'Sales'

Top N with Sorting:

dax
EVALUATETOPN(10, 'Sales', [Amount], DESC)

Filtered Results:

dax
EVALUATEFILTER('Sales', [Year] = 2024)

Calculated Columns:

dax
EVALUATEADDCOLUMNS(    'Sales',    "Profit", [Revenue] - [Cost])

Aggregated Summary:

dax
EVALUATESUMMARIZE(    'Sales',    'Product'[Category],    "Total Sales", SUM('Sales'[Amount]))

⚠️ Troubleshooting

Authentication Errors

Error: "Authentication failed"

  • Verify your POWERBI_TENANT_ID, POWERBI_CLIENT_ID, and POWERBI_CLIENT_SECRET are correct
  • Check that the client secret hasn't expired in Azure AD
  • Ensure the service principal is enabled in PowerBI Admin Portal

Permission Errors

Error: "403 Forbidden" or "Access denied"

  • Verify the service principal has been granted access to the workspace
  • Check that the workspace role is Admin, Member, or Contributor (Viewer is not sufficient for API access)
  • Confirm "Service principals can use PowerBI APIs" is enabled in PowerBI Admin Portal

Connection Issues

Server not appearing in MCP client

  • Restart your MCP client after adding the configuration
  • Check the configuration file syntax (JSON must be valid)
  • For local clone, verify the absolute path is correct

Tools not working

  • Ensure credentials are configured
  • Check the MCP client logs for detailed error messages
  • For Claude Code, verify .env file is in the current working directory

📚 Resources

💬 Feedback and Support

🤝 Contributing

See DEVELOPER_GUIDE.md for information about developing and contributing to this project.

License

This project is licensed under the MIT License.

來源:README.md,提交 0407c00

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.2最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分