
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.
概览
让助手通过 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 的网络连接。
安装
在 SourceWeft 中
- 打开 控制台中的 PowerBI MCP Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
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
.envfiles (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?
📋 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
- Go to Azure Portal
- Navigate to Azure Active Directory > App registrations
- Click New registration
- Enter a name (e.g., "PowerBI MCP Server")
- 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
- Go to PowerBI Admin Portal
- Navigate to Tenant settings > Developer settings
- Enable Service principals can use PowerBI APIs
- Add your app to the security group or enable for entire organization
- 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:
- Go to the workspace in PowerBI
- Click workspace settings (⚙️) > Access
- Click Add people or groups
- Search for your app name
- Assign role: Admin, Member, or Contributor
- 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):
For Claude Code (./.mcp.json in your project directory):
When using Claude Code, create a .env file in your project directory (where you run Claude Code from):
[!TIP] The
.envfile should be in your working directory, not where the server is installed.
For OpenCode (~/.config/opencode/opencode.json):
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):
For Claude Code (./.mcp.json in your project directory):
When using Claude Code, create a .env file in your project directory (where you run Claude Code from):
[!TIP] The
.envfile 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):
After adding the configuration, restart your MCP client.
Method 2: Local Clone (Contributors)
For contributors who want to run from a local clone:
- Clone the repository:
- Install dependencies:
- Add to your MCP client configuration:
For Claude Desktop:
For Claude Code (./.mcp.json in your project directory):
For OpenCode (~/.config/opencode/opencode.json):
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:
- Verify Connection: Ask Claude "What PowerBI workspaces do I have access to?"
- Explore Data: "Show me the datasets in workspace [workspace-name]"
- View Schema: "What tables are in dataset [dataset-name]?"
- Run a Query: "Execute this DAX query on [dataset-name]: EVALUATE TOPN(10, Sales)"
🛠️ Available Tools
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 IDworkspace_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 IDworkspace_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 IDworkspace_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 IDdax_query(required): DAX query (must start with "EVALUATE")workspace_id(optional): Workspace ID (omit for "My workspace")
DAX Query Examples
Basic Table Scan:
Top N with Sorting:
Filtered Results:
Calculated Columns:
Aggregated Summary:
⚠️ Troubleshooting
Authentication Errors
Error: "Authentication failed"
- Verify your
POWERBI_TENANT_ID,POWERBI_CLIENT_ID, andPOWERBI_CLIENT_SECRETare 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
.envfile is in the current working directory
📚 Resources
💬 Feedback and Support
- Issues: Report bugs or request features via GitHub Issues
- Discussions: Ask questions in GitHub Discussions
- Pull Requests: Contributions welcome! See DEVELOPER_GUIDE.md
🤝 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版本历史
1- v0.1.2最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分