跳过安装。2 分钟内即可运行。
在 cloud.anythingmcp.com 开始免费试用,一键添加 Microsoft Power BI,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。
AnythingMCP 已收录在 Claude 的连接器目录中:一键添加到 Claude (在新标签页中打开),然后登录并选择 Claude 可以使用哪些 MCP 服务器。
摘要
使用 Microsoft 工作账户登录的 Power BI REST API:工作区、语义模型、报表、仪表板、数据流、网关和应用,对模型执行 DAX 查询,数据源、参数、刷新历史和计划,以及启动或取消刷新。修改模型参数在安装时关闭。
试试这样问
Microsoft Power BI 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Microsoft Power BI、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
Microsoft Power BI + Claude
使用 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 应用注册。有些组织只允许管理员授予同意。
- 打开 https://entra.microsoft.com,然后进入 Applications、App registrations、New registration。也可以复用其他 Microsoft 连接器的应用注册。
- 支持的账户类型:通常选择 Accounts in this organizational directory only。Power BI 只支持工作或学校账户,不支持个人 Microsoft 账户。
- 重定向 URI:平台选 Web,在 AnythingMCP Cloud 上为
https://cloud.anythingmcp.com/api/mcp-oauth/callback,自行托管 AnythingMCP 时为<your AnythingMCP URL>/api/mcp-oauth/callback。必须逐字符一致,否则 Microsoft 会返回 AADSTS50011。 - 在 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。 - 在 Certificates & secrets、New client secret 中复制密钥的 Value(只显示一次),不是 Secret ID。
- 把 Application (client) ID 粘贴到
MICROSOFT_CLIENT_ID,把密钥值粘贴到MICROSOFT_CLIENT_SECRET。把MICROSOFT_TENANT_ID设为 Directory (tenant) ID、你的域名(如contoso.onmicrosoft.com),多租户应用则设为organizations;common和consumers不适用。安装连接器。 - 在连接器页面点击 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 — 在 Claude 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
推荐路径:在 claude.ai web 上工作,无需触碰任何配置文件。
- 在 Claude 中打开 Customize → Connectors。
- 点击 +,然后点击 Add custom connector。
- 输入名称(例如
Microsoft Power BI)和远程 MCP 服务器 URLhttps://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID,然后点击 Add。 - 点击 Connect,登录 AnythingMCP(OAuth)并允许访问。
下面所有工具都会出现在你的聊天中,开始输入提示。
可用工具
| Tool | What it does |
|---|---|
power_bi_list_workspaces | List the workspaces (groups) the signed-in user can access: id, name, isReadOnly, isOnDedicatedCapacity (Premium or Fabric capacity) and… |
power_bi_get_workspace | Read one workspace: name, read-only flag, capacity and default semantic model storage format |
power_bi_list_workspace_users | List who has access to a workspace: email or app id, display name, principalType (User, Group, App) and groupUserAccessRight (Admin… |
power_bi_list_datasets | List the semantic models (datasets) of a workspace: id, name, configuredBy (owner), isRefreshable, isOnPremGatewayRequired… |
power_bi_list_my_datasets | List the semantic models (datasets) in the signed-in user's My workspace |
power_bi_get_dataset | Read one semantic model (dataset) of a workspace: name, owner (configuredBy), isRefreshable, storage mode, whether it needs a gateway or an… |
power_bi_execute_dax_query | Run 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_datasources | List the data sources of a semantic model: datasourceType (Sql, AnalysisServices, SharePointList, Web, File, ...), connectionDetails… |
power_bi_list_dataset_parameters | List the Power Query parameters of a semantic model: name, type, currentValue, isRequired and suggestedValues |
power_bi_get_refresh_history | Refresh history of a semantic model, newest first: requestId, refreshType (Scheduled, OnDemand, ViaApi, ...), startTime, endTime, status… |
power_bi_get_refresh_details | Execution details of one refresh of a semantic model (enhanced refreshes started through the API on Premium, PPU or Fabric capacity)… |
power_bi_get_refresh_schedule | The scheduled refresh of a semantic model: enabled, days, times, localTimeZoneId and notifyOption |
power_bi_list_reports | List the reports of a workspace: id, name, reportType (PowerBIReport or PaginatedReport), the datasetId it reads, description and webUrl |
power_bi_list_my_reports | List the reports in the signed-in user's My workspace: id, name, type, datasetId and webUrl |
power_bi_get_report | Read one report of a workspace: name, type, the datasetId (semantic model) behind it, description and webUrl |
power_bi_list_report_pages | List the pages of a Power BI report: name (the internal id used in URLs), displayName and order |
power_bi_list_dashboards | List the dashboards of a workspace: id, displayName, isReadOnly and webUrl |
power_bi_list_my_dashboards | List the dashboards in the signed-in user's My workspace: id, displayName, isReadOnly and webUrl |
power_bi_list_dashboard_tiles | List the tiles of a dashboard: id, title, the reportId and datasetId each tile comes from, and its size (rowSpan, colSpan) |
power_bi_list_dataflows | List the dataflows (Gen1) of a workspace: objectId, name, description and configuredBy |
power_bi_list_dataflow_transactions | Refresh transactions of a dataflow, newest first: id, refreshType, startTime, endTime and status |
power_bi_list_dataflow_datasources | List the data sources a dataflow reads: type, connection details and gateway ids |
power_bi_list_gateways | List the on-premises data gateways the signed-in user administers: id, name, type and gatewayStatus |
power_bi_list_gateway_datasources | List the data sources configured on a gateway: id, datasourceName, datasourceType, connectionDetails and credentialType |
power_bi_get_gateway_datasource_status | Check whether a gateway can reach one of its data sources |
power_bi_list_apps | List the Power BI apps installed for the signed-in user: id, name, description, publishedBy and lastUpdate |
power_bi_get_app | Read one installed app: name, description, publisher and last update |
power_bi_list_app_reports | List the reports of an installed app (ids are the app copies; datasetId names the semantic model) |
power_bi_list_app_dashboards | List the dashboards of an installed app: id, displayName, isReadOnly and webUrl |
power_bi_list_imports | List the imports (uploads of .pbix, .rdl, .xlsx or .json files) of a workspace: id, name, importState (Publishing, Succeeded, Failed)… |
power_bi_get_import | Read one import of a workspace: its state and the reports and semantic models it created |
power_bi_refresh_dataset | Start a refresh of a semantic model |
power_bi_cancel_refresh | Cancel a running enhanced refresh of a semantic model (one started through the API with enhanced options) |
power_bi_refresh_dataflow | Start a refresh of a dataflow |
power_bi_update_dataset_parameters | Change 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
Claude Code 和 Claude Desktop 一样工作吗? 是的,两者都指向 https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID。
下一步
这份指南对你有帮助吗?