Power BI MCP for Claude

Power BI MCP for Claude

MCP server for Microsoft Power BI and Fabric, enabling Claude to discover workspaces, semantic models, generate and execute DAX queries, and retrieve report metadata via device-code authentication.

Category
访问服务器

README

Power BI MCP for Claude

License: MIT TypeScript MCP

Claude Desktop and Claude Code MCP server for Microsoft Power BI and Fabric. It supports Microsoft device-code sign-in, Power BI workspace and semantic model discovery, active semantic model context, DAX query generation/execution, schema metadata, report metadata, and redacted diagnostics.

Local Node/TypeScript MCP proxy for Claude. It forwards JSON-RPC messages to Microsoft's remote Power BI MCP endpoint, exposes stable local wrapper tools for Claude discovery, and acquires delegated Microsoft Entra ID tokens with MSAL device-code authentication.

The key difference from a terminal-only proxy is that first-time sign-in can happen from Claude chat. If Claude advertises MCP URL-mode elicitation, the server uses it. Claude Desktop currently starts this extension with MCP Apps UI capabilities instead, so the server also exposes local auth tools that return the Microsoft URL and device code directly in chat.

Remote endpoint:

https://api.fabric.microsoft.com/v1/mcp/powerbi

Power BI data access goes through this Fabric MCP endpoint. The local tools only handle sign-in and provide stable wrapper names for Claude Desktop to call.

Features

  • Claude Desktop MCPB extension and Claude Code plugin support.
  • Microsoft Entra ID device-code authentication through MSAL.
  • Power BI workspace and semantic model discovery wrappers.
  • Default and chat-scoped workspace/semantic model context.
  • Fabric MCP wrappers for semantic model schema, DAX query generation, DAX execution, and report metadata.
  • Redacted diagnostics for auth, context, local wrapper tools, and upstream Fabric MCP tool discovery.
  • Fabric-only routing through https://api.fabric.microsoft.com/v1/mcp/powerbi.

Install

npm install
npm run build

Commands

npm run start          # run stdio MCP proxy
npm run login          # authenticate in a terminal and populate the cache
npm run status         # show non-sensitive cache/account info
npm run logout         # delete the local MSAL token cache
npm test               # run focused transport tests

Claude Desktop

Package as an MCPB desktop extension after building:

npm run build
npm run pack:mcpb

The root manifest.json describes the Claude Desktop extension. It passes POWERBI_MCP_CACHE_DIR, POWERBI_MCP_TENANT_ID, POWERBI_MCP_CLIENT_ID, and optional default workspace/semantic-model settings into the server.

Claude Code Plugin

The .claude-plugin/plugin.json, .mcp.json, and skills/powerbi/SKILL.md files let the same server run as a Claude Code plugin:

npm run build
claude --plugin-dir /path/to/Power-BI-MCP-Node

Authentication UX

The server first tries silent token acquisition from the local MSAL cache. It always exposes these local tools so Claude can discover them at connector startup:

  • powerbi_auth_start
  • powerbi_auth_status
  • powerbi_auth_logout
  • powerbi_diagnostics
  • powerbi_get_default_context
  • powerbi_set_context
  • powerbi_clear_context
  • powerbi_list_workspaces
  • powerbi_list_semantic_models
  • powerbi_get_semantic_model_schema
  • powerbi_generate_dax_query
  • powerbi_execute_dax_query
  • powerbi_get_report_metadata

If no cached token is available:

  1. Claude calls powerbi_auth_start.
  2. powerbi_auth_start returns Microsoft's verification URL and a device code in chat.
  3. The user completes Microsoft sign-in in the browser.
  4. MSAL stores refreshable tokens in the configured cache directory.
  5. Later requests, including workspace and semantic-model listing, refresh silently when possible and are sent to the Fabric MCP endpoint.

If chat-based sign-in is not convenient, run npm run login once from a normal terminal, then reconnect the MCP server.

Diagnostics

Use powerbi_diagnostics when Claude needs to verify whether the extension is healthy. It returns redacted status for the server version, authentication state, active/default context presence, local wrapper tools, and upstream Fabric MCP query tool discovery.

Diagnostics output intentionally omits tokens, auth headers, account email, cache paths, and raw workspace or semantic model IDs.

Default Power BI Context

Some Fabric MCP tools require a workspace ID or semantic model ID even when the endpoint does not advertise a tool that can list every available ID. In Claude Desktop settings, optionally configure one default workspace and one default semantic model:

  • Default workspace ID
  • Default workspace name
  • Default semantic model ID
  • Default semantic model name

The extension uses these defaults only when a Fabric MCP tool requires a missing ID. Explicit IDs supplied in chat are preserved.

You can also switch the active context inside a chat without changing Claude Desktop settings:

  • powerbi_set_context sets a chat-session workspace ID, semantic model ID, or display names.
  • powerbi_clear_context clears the chat-session override and returns to Claude Desktop settings.
  • powerbi_get_default_context shows the active context, chat override, and configured defaults.

Context precedence is: explicit IDs in the current tool call, then chat-session context, then Claude Desktop settings.

The query tools are local wrappers around Fabric MCP tools so Claude can discover them before sign-in:

  • powerbi_get_semantic_model_schema forwards to Fabric MCP GetSemanticModelSchema.
  • powerbi_generate_dax_query forwards to Fabric MCP GenerateQuery.
  • powerbi_execute_dax_query forwards to Fabric MCP ExecuteQuery.
  • powerbi_get_report_metadata forwards to Fabric MCP GetReportMetadata.

The wrappers still require Microsoft sign-in and still route all Power BI operations through https://api.fabric.microsoft.com/v1/mcp/powerbi.

Environment Variables

Variable Default
POWERBI_MCP_URL https://api.fabric.microsoft.com/v1/mcp/powerbi
POWERBI_MCP_CLIENT_ID built-in public Power BI client ID
POWERBI_MCP_TENANT_ID organizations
POWERBI_MCP_SCOPES https://analysis.windows.net/powerbi/api/.default
POWERBI_MCP_DEFAULT_WORKSPACE_ID empty
POWERBI_MCP_DEFAULT_WORKSPACE_NAME empty
POWERBI_MCP_DEFAULT_SEMANTIC_MODEL_ID empty
POWERBI_MCP_DEFAULT_SEMANTIC_MODEL_NAME empty
POWERBI_MCP_CACHE_DIR ~/.powerbi-mcp-claude, or ${CLAUDE_PLUGIN_DATA}/cache in Claude Code plugin mode
POWERBI_MCP_TIMEOUT_SECONDS 60
POWERBI_MCP_DEVICE_CODE_TIMEOUT_SECONDS 900
POWERBI_MCP_ALLOW_INTERACTIVE_AUTH true

Do not paste Microsoft access tokens or refresh tokens into Claude. Use device-code sign-in or a tenant-approved public-client app registration.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选