powerbi-mcp
Enables discovery of Power BI workspaces and datasets, retrieval of semantic model definitions (TMDL), and execution of DAX queries through the Power BI and Microsoft Fabric REST APIs, using MSAL/WAM authentication for secure token caching.
README
powerbi-mcp
A small Model Context Protocol (MCP) server for Microsoft Power BI. It lets an MCP-capable client (Claude, VS Code, etc.) discover your workspaces and datasets, read a semantic model's structure, and run DAX queries — all through the public Power BI and Microsoft Fabric REST APIs.
Authentication uses MSAL with the Windows broker (WAM): you sign in once, the token is cached locally, and the server refreshes it silently afterwards. No tokens are ever pasted by hand or stored in config.
Tools
| Tool | Description |
|---|---|
list_workspaces |
List the workspaces (groups) you can access. |
list_datasets |
List the datasets (semantic models) in a workspace. |
get_model_definition |
Return a model's TMDL: tables, columns, measures (with DAX) and relationships. |
run_dax |
Execute a DAX query and return the rows as JSON. |
Prerequisites
- Python 3.10+
- A Power BI account with access to at least one workspace
- Windows recommended — the interactive sign-in uses the OS broker (WAM). On macOS/Linux it falls back to the system browser.
Setup (step by step)
1. Install
git clone https://github.com/rajivdatta/powerbi-mcp.git
cd powerbi-mcp
python -m venv .venv
.venv\Scripts\activate # Windows (source .venv/bin/activate on macOS/Linux)
pip install -r requirements.txt
2. (Optional) Configure your tenant
All configuration is optional and via environment variables — copy
.env.example to .env if you want to set any:
| Variable | Default | Purpose |
|---|---|---|
POWERBI_TENANT_ID |
organizations |
Pin sign-in to one Azure AD tenant. Use a GUID or domain (e.g. contoso.com). Recommended for work accounts. |
POWERBI_CLIENT_ID |
Azure CLI public client | Override only if you want to use your own app registration. The default is a Microsoft first-party public client that works with the Windows broker. |
Finding your tenant ID: Azure Portal → Microsoft Entra ID → Overview → Tenant ID, or just use your email domain. Leaving it unset (
organizations) lets any work/school account sign in.
.env is git-ignored.
3. Sign in once
.venv\Scripts\activate
python server.py --login
This opens an interactive sign-in (Windows broker popup or browser) and caches a
refresh token at %LOCALAPPDATA%\powerbi-mcp\token_cache.bin. After this, the
server refreshes access tokens silently on every call — no re-login needed.
To switch accounts later, just run --login again and pick the other account.
4. Test it standalone
python -c "import server; print(server.list_workspaces())"
You should get a JSON list of your workspaces (each with an id and name).
5. Register with your MCP host
Point your client at server.py (see examples/mcp.json).
Use the venv's Python so dependencies resolve:
{
"mcpServers": {
"powerbi": {
"command": "C:\\path\\to\\powerbi-mcp\\.venv\\Scripts\\python.exe",
"args": ["C:\\path\\to\\powerbi-mcp\\server.py"],
"env": { "POWERBI_TENANT_ID": "your-tenant-id-or-domain" }
}
}
}
Restart your MCP client, then try: "using powerbi, list my workspaces".
Use with Claude Desktop
Claude Desktop reads its MCP servers from
claude_desktop_config.json. Open it from Settings → Developer → Edit Config
(this creates the file if it doesn't exist), or edit it directly:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add this server under mcpServers, using absolute paths to the venv's
Python and server.py:
{
"mcpServers": {
"powerbi": {
"command": "C:\\path\\to\\powerbi-mcp\\.venv\\Scripts\\python.exe",
"args": ["C:\\path\\to\\powerbi-mcp\\server.py"],
"env": { "POWERBI_TENANT_ID": "your-tenant-id-or-domain" }
}
}
}
On macOS the paths are POSIX, e.g. "command": "/Users/you/powerbi-mcp/.venv/bin/python".
Save the file and fully quit and reopen Claude Desktop (use Quit from the
tray/menu-bar icon — closing the window isn't enough). The server's tools then
appear in the tools (🔌) menu of a new chat. Sign in first with
python server.py --login so the token cache exists before Desktop launches it.
Usage flow
A typical sequence:
list_workspaces→ pick a workspaceidlist_datasets(workspace_id)→ pick a datasetidget_model_definition(workspace_id, dataset_id)→ learn table & measure namesrun_dax(workspace_id, dataset_id, "EVALUATE ...")→ get results
Security
The MSAL token cache (%LOCALAPPDATA%\powerbi-mcp\token_cache.bin) contains a
refresh token. Treat it like a password — it lives outside the repo and is never
committed.
License
MIT (c) 2026 Rajiv Datta
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。