连接器指南阅读约 7 分钟35 个 MCP 工具7 种语言

如何通过 MCP 将 Microsoft Power BI 连接到 ChatGPT

使用 Microsoft 工作账户登录的 Power BI REST API:工作区、语义模型、报表、仪表板、数据流、网关和应用,对模型执行 DAX 查询,数据源、参数、刷新历史和计划,以及启动或取消刷新。修改模型参数在安装时关闭。

HC作者:HelpCode 团队更新于 7 分钟阅读 在 GitHub 开源

无需信用卡 · 7 天试用 · 提供自托管方案

Microsoft Power BI

Microsoft Power BI

Let your AI work with Power BI: list workspaces, semantic models, reports, dashboards, dataflows, gateways and apps, run DAX queries against a model, check data sources, parameters, refresh history and schedules, and start or cancel refreshes. Power BI REST API, signed in with your Microsoft work account.

个工具

35

区域

INTL

类别

数据分析

身份验证

OAuth 2.0

所需环境变量

MICROSOFT_CLIENT_IDMICROSOFT_CLIENT_SECRETMICROSOFT_TENANT_ID
在 Cloud 上一键安装

7 天免费试用 · 无需信用卡

  • 7 天免费试用
    无需信用卡
  • 符合 GDPR,SOC 2 就绪
    数据驻留欧盟,审计日志
  • 在 GitHub 开源
    开源 · AGPL-3.0
  • 支持 ChatGPT、Claude、Gemini
    任何兼容 MCP 的客户端

跳过安装。2 分钟内即可运行。

在 cloud.anythingmcp.com 开始免费试用,一键添加 Microsoft Power BI,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。

开始免费试用

摘要

使用 Microsoft 工作账户登录的 Power BI REST API:工作区、语义模型、报表、仪表板、数据流、网关和应用,对模型执行 DAX 查询,数据源、参数、刷新历史和计划,以及启动或取消刷新。修改模型参数在安装时关闭。

试试这样问

Microsoft Power BI 的示例提示

点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。

Microsoft Power BI · 通过 MCP 实时
分享
Opus 4.7

Claude 是 AI,可能会出错。请核对回答。

💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Microsoft Power BI、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无 git clone、无本地服务器。

Microsoft Power BI + ChatGPT

使用 Microsoft 工作账户登录的 Power BI REST API:工作区、语义模型、报表、仪表板、数据流、网关和应用,对模型执行 DAX 查询,数据源、参数、刷新历史和计划,以及启动或取消刷新。修改模型参数在安装时关闭。

前提条件

完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:

MICROSOFT_CLIENT_ID, MICROSOFT_CLIENT_SECRET, MICROSOFT_TENANT_ID

步骤 1 — 获取凭证

设置只需一次,大约 10 分钟。你需要一个带 Power BI 许可证(Free、Pro 或 Premium Per User)的 Microsoft 工作或学校账户,以及一个免费的 Microsoft Entra 应用注册。有些组织只允许管理员授予同意。

  1. 打开 https://entra.microsoft.com,然后进入 Applications、App registrations、New registration。也可以复用其他 Microsoft 连接器的应用注册。
  2. 支持的账户类型:通常选择 Accounts in this organizational directory only。Power BI 只支持工作或学校账户,不支持个人 Microsoft 账户。
  3. 重定向 URI:平台选 Web,在 AnythingMCP Cloud 上为 https://cloud.anythingmcp.com/api/mcp-oauth/callback,自行托管 AnythingMCP 时为 <your AnythingMCP URL>/api/mcp-oauth/callback。必须逐字符一致,否则 Microsoft 会返回 AADSTS50011。
  4. 在 API permissions、Add a permission、Power BI Service、Delegated permissions 中勾选 Workspace.Read.All、Dataset.ReadWrite.All、Report.Read.All、Dashboard.Read.All、Dataflow.ReadWrite.All、Gateway.Read.All 和 App.Read.All。如果连接器只能读取,请改用 Dataset.Read.All 和 Dataflow.Read.All。如果你的组织不允许用户自行同意,再点击 Grant admin consent。
  5. 在 Certificates & secrets、New client secret 中复制密钥的 Value(只显示一次),不是 Secret ID。
  6. 把 Application (client) ID 粘贴到 MICROSOFT_CLIENT_ID,把密钥值粘贴到 MICROSOFT_CLIENT_SECRET。把 MICROSOFT_TENANT_ID 设为 Directory (tenant) ID、你的域名(如 contoso.onmicrosoft.com),多租户应用则设为 organizations;common 和 consumers 不适用。安装连接器。
  7. 在连接器页面点击 Authorize with Provider,用拥有 Power BI 许可证的用户登录。刷新令牌会加密保存,访问令牌会自动续期。运行 power_bi_list_workspaces 进行检查。

Scope:连接器请求 https://analysis.windows.net/powerbi/api/.default offline_access。.default 授予第 4 步中勾选的 Power BI 权限(在那里增删后需重新授权),offline_access 提供刷新令牌。不要给这个连接器添加 Microsoft Graph 的 scope:一个令牌只服务一个 API。

以谁的权限运行:AI 看到的正是登录用户在 Power BI 服务中可以看到的内容。启用了行级安全性的模型只返回该用户可以看到的行。

可读取的内容:工作区以及谁以什么角色拥有访问权限;每个工作区中的语义模型(数据集)、报表及其页面、仪表板及其磁贴、数据流,以及 .pbix、.rdl、.xlsx 或 .json 文件的导入;用户“我的工作区”(My workspace)中的内容,它没有工作区 ID,通过 power_bi_list_my_datasets、power_bi_list_my_reports 和 power_bi_list_my_dashboards 读取;已安装的应用及其报表和仪表板;模型的数据源和 Power Query 参数;刷新历史(失败的刷新在 serviceExceptionJson 中带有错误)、增强刷新的详情和刷新计划;数据流的刷新事务和数据源;用户管理的本地网关、其数据源,以及网关能否连接到其中某个数据源。

DAX 查询:power_bi_execute_dax_query 用语义模型中的数据回答问题。它需要开启租户设置 Dataset Execute Queries REST API(在较新的管理门户中叫 Semantic model Execute Queries REST API;Admin portal、Tenant settings、Integration settings),并且用户需要对模型有 Read 和 Build 权限。不支持托管在 Azure Analysis Services 中的模型。每次调用一个查询,以 EVALUATE 开头(可放在 DEFINE 之后),只支持 DAX。要了解模型,EVALUATE COLUMNSTATISTICS() 会列出其表和列,EVALUATE TOPN(5, 'Table') 会显示示例行。API 不会列出度量值(INFO 函数和 DMV 查询会被拒绝),因此 AI 会向你询问度量值名称,或使用报表中显示的度量值,并优先使用模型的度量值而不是对原始列求和。impersonated_user_name 用于在行级安全性下测试另一个用户看到的数据,需要对模型有写入权限。

可写入的内容:power_bi_refresh_dataset、power_bi_cancel_refresh 和 power_bi_refresh_dataflow 在安装时即开启。刷新会加载数据源并计入每日刷新次数上限,因此 AI 在启动前会先征得你的同意。数据集刷新返回不带内容的 202;运行期间,新的刷新会以 Unknown 状态出现在 power_bi_get_refresh_history 的最上方。共享容量(Pro)每个模型每天最多 8 次刷新(包括计划刷新),并且只能使用 notify_option。type、objects 或 commit_mode 等选项会使其成为增强刷新,需要 Premium、PPU 或 Fabric 容量,并且不能发送 notify_option。只有增强刷新可以用 power_bi_get_refresh_details 跟踪,并用 power_bi_cancel_refresh 取消。

安装时关闭:power_bi_update_dataset_parameters,它会修改模型的 Power Query 参数(例如加载哪个服务器或哪个时间段),并在下次刷新时生效。只有在需要 AI 执行此操作时,才单独开启该工具。

数据格式:列表以 {"value": [...]} 返回。ID 为 GUID。时间为 UTC 的 ISO 8601。webUrl 可在 Power BI 服务中打开该项目。DAX 结果位于 results[0].tables[0].rows,列键形如 Table[Column],计算列形如 [Name]。

分页和筛选:列表工具一次返回全部内容,只有 power_bi_list_workspaces 和 power_bi_list_workspace_users 使用 top 和 skip 分页。工作区可以用 OData 筛选,例如 contains(name,'Sales')。

限制:一个 DAX 查询返回一张表,最多 100,000 行或 1,000,000 个值(以先达到者为准),且不超过 15 MB;每个用户每分钟最多 120 次查询。Power BI REST API 按用户和租户限流,429 响应会带有 Retry-After。Premium 容量过载时会减慢刷新,被限流超过一小时的刷新会失败。

常见错误:401 表示授权已过期或被撤销,或客户端密钥已过期:必要时粘贴新密钥,然后再次点击 Authorize with Provider。403 PowerBINotAuthorizedException 或 Unauthorized 表示用户无权访问该工作区或项目、缺少第 4 步中的某个权限,或者对于 DAX 缺少 Build 权限或租户设置。404 ItemNotFound 或 PowerBIEntityNotFound 表示 ID 错误或项目位于其他工作区。400 DatasetExecuteQueriesError 表示 DAX 查询无效;引擎返回的消息会说明原因。刷新时出现 400 表示与增强选项一起发送了 notify_option、在共享容量上使用了增强选项,或已有刷新在运行。

该连接器不创建、编辑或删除报表、仪表板或模型,不上传 .pbix 文件,也不使用 Microsoft Graph。它不支持个人 Microsoft 账户。

步骤 2 — 安装 adapter

curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d

步骤 3 — 在 ChatGPT 中添加连接器

你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(https://cloud.anythingmcp.com/mcp/…)。本指南中出现 YOUR_SERVER_ID 的地方都用它替换。

ChatGPT 在网页版的 Plugins 页面把 MCP 服务器添加为插件,仅付费套餐可用,不再需要开发者模式。在 Business 工作区中只有管理员和所有者可以添加;在 Enterprise 和 Edu 中,管理员可以授予 Create plugins with MCPs 权限。

  1. 前往 chatgpt.com/plugins,点击 Add,然后选择 Add custom MCP server。
  2. 填写名称,例如 Name: Microsoft Power BI。
  3. 在 Connection 下的 Server URL 中填入 https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID,Authentication 保持为 OAuth。
  4. 选择 I understand and want to continue,然后点击 Create as a plugin。ChatGPT 提示时,登录 AnythingMCP 并允许访问。
  5. 在个人插件中安装这个新插件,然后在对话中输入 @ 并选择它。

可用工具

ToolWhat it does
power_bi_list_workspacesList the workspaces (groups) the signed-in user can access: id, name, isReadOnly, isOnDedicatedCapacity (Premium or Fabric capacity) and…
power_bi_get_workspaceRead one workspace: name, read-only flag, capacity and default semantic model storage format
power_bi_list_workspace_usersList who has access to a workspace: email or app id, display name, principalType (User, Group, App) and groupUserAccessRight (Admin…
power_bi_list_datasetsList the semantic models (datasets) of a workspace: id, name, configuredBy (owner), isRefreshable, isOnPremGatewayRequired…
power_bi_list_my_datasetsList the semantic models (datasets) in the signed-in user's My workspace
power_bi_get_datasetRead one semantic model (dataset) of a workspace: name, owner (configuredBy), isRefreshable, storage mode, whether it needs a gateway or an…
power_bi_execute_dax_queryRun a DAX query against a semantic model and get the rows back as JSON (results[0].tables[0].rows, keys like "Table[Column]" or "[Measure]")
power_bi_list_dataset_datasourcesList the data sources of a semantic model: datasourceType (Sql, AnalysisServices, SharePointList, Web, File, ...), connectionDetails…
power_bi_list_dataset_parametersList the Power Query parameters of a semantic model: name, type, currentValue, isRequired and suggestedValues
power_bi_get_refresh_historyRefresh history of a semantic model, newest first: requestId, refreshType (Scheduled, OnDemand, ViaApi, ...), startTime, endTime, status…
power_bi_get_refresh_detailsExecution details of one refresh of a semantic model (enhanced refreshes started through the API on Premium, PPU or Fabric capacity)…
power_bi_get_refresh_scheduleThe scheduled refresh of a semantic model: enabled, days, times, localTimeZoneId and notifyOption
power_bi_list_reportsList the reports of a workspace: id, name, reportType (PowerBIReport or PaginatedReport), the datasetId it reads, description and webUrl
power_bi_list_my_reportsList the reports in the signed-in user's My workspace: id, name, type, datasetId and webUrl
power_bi_get_reportRead one report of a workspace: name, type, the datasetId (semantic model) behind it, description and webUrl
power_bi_list_report_pagesList the pages of a Power BI report: name (the internal id used in URLs), displayName and order
power_bi_list_dashboardsList the dashboards of a workspace: id, displayName, isReadOnly and webUrl
power_bi_list_my_dashboardsList the dashboards in the signed-in user's My workspace: id, displayName, isReadOnly and webUrl
power_bi_list_dashboard_tilesList the tiles of a dashboard: id, title, the reportId and datasetId each tile comes from, and its size (rowSpan, colSpan)
power_bi_list_dataflowsList the dataflows (Gen1) of a workspace: objectId, name, description and configuredBy
power_bi_list_dataflow_transactionsRefresh transactions of a dataflow, newest first: id, refreshType, startTime, endTime and status
power_bi_list_dataflow_datasourcesList the data sources a dataflow reads: type, connection details and gateway ids
power_bi_list_gatewaysList the on-premises data gateways the signed-in user administers: id, name, type and gatewayStatus
power_bi_list_gateway_datasourcesList the data sources configured on a gateway: id, datasourceName, datasourceType, connectionDetails and credentialType
power_bi_get_gateway_datasource_statusCheck whether a gateway can reach one of its data sources
power_bi_list_appsList the Power BI apps installed for the signed-in user: id, name, description, publishedBy and lastUpdate
power_bi_get_appRead one installed app: name, description, publisher and last update
power_bi_list_app_reportsList the reports of an installed app (ids are the app copies; datasetId names the semantic model)
power_bi_list_app_dashboardsList the dashboards of an installed app: id, displayName, isReadOnly and webUrl
power_bi_list_importsList the imports (uploads of .pbix, .rdl, .xlsx or .json files) of a workspace: id, name, importState (Publishing, Succeeded, Failed)…
power_bi_get_importRead one import of a workspace: its state and the reports and semantic models it created
power_bi_refresh_datasetStart a refresh of a semantic model
power_bi_cancel_refreshCancel a running enhanced refresh of a semantic model (one started through the API with enhanced options)
power_bi_refresh_dataflowStart a refresh of a dataflow
power_bi_update_dataset_parametersChange Power Query parameter values of a semantic model (for example a server name or a date range)

示例提示

  • “Sales 工作区中哪些语义模型上次刷新失败了?原因是什么?”
  • “根据 Sales Overview 报表背后的模型,2026 年第三季度各地区的收入是多少?”
  • “列出 Finance 模型的表和列,并给我看 Orders 表的五行示例数据。”
  • “列出 Executive Summary 报表的页面和 KPI 仪表板的磁贴。”
  • “显示 Inventory 模型今天的刷新历史,在我确认后再启动一次刷新。”

FAQ

ChatGPT 免费套餐能用自定义 MCP 服务器吗? OpenAI 只为付费套餐提供自定义 MCP 服务器的说明,Free 套餐不在其列。

下一步

这份指南对你有帮助吗?

你的 Microsoft Power BI 智能体只差一次点击。

安装连接器,粘贴密钥,向 ChatGPT 提问。免费试用 7 天,无需信用卡。

相关指南

连接器

如何通过 MCP 将 Microsoft Power BI 连接到 Claude

使用 Microsoft 工作账户登录的 Power BI REST API:工作区、语义模型、报表、仪表板、数据流、网关和应用,对模型执行 DAX 查询,数据源、参数、刷新历史和计划,以及启动或取消刷新。修改模型参数在安装时关闭。

连接器

如何通过 MCP 将 Microsoft Power BI 连接到 Microsoft Copilot

使用 Microsoft 工作账户登录的 Power BI REST API:工作区、语义模型、报表、仪表板、数据流、网关和应用,对模型执行 DAX 查询,数据源、参数、刷新历史和计划,以及启动或取消刷新。修改模型参数在安装时关闭。

连接器

如何通过 MCP 将 Microsoft Power BI 连接到 Cursor

使用 Microsoft 工作账户登录的 Power BI REST API:工作区、语义模型、报表、仪表板、数据流、网关和应用,对模型执行 DAX 查询,数据源、参数、刷新历史和计划,以及启动或取消刷新。修改模型参数在安装时关闭。

连接器

如何通过 MCP 将 Microsoft Power BI 连接到 Gemini

使用 Microsoft 工作账户登录的 Power BI REST API:工作区、语义模型、报表、仪表板、数据流、网关和应用,对模型执行 DAX 查询,数据源、参数、刷新历史和计划,以及启动或取消刷新。修改模型参数在安装时关闭。

连接器

如何通过 MCP 将 Microsoft Power BI 连接到 Meta Muse

使用 Microsoft 工作账户登录的 Power BI REST API:工作区、语义模型、报表、仪表板、数据流、网关和应用,对模型执行 DAX 查询,数据源、参数、刷新历史和计划,以及启动或取消刷新。修改模型参数在安装时关闭。

连接器

Microsoft Power BI 接入 MCP:在任意 AI 智能体中使用 DAX 查询、语义模型、报表和刷新

使用 Microsoft 工作账户登录的 Power BI REST API:工作区、语义模型、报表、仪表板、数据流、网关和应用,对模型执行 DAX 查询,数据源、参数、刷新历史和计划,以及启动或取消刷新。修改模型参数在安装时关闭。