Claude Power BI MCP

Claude Power BI MCP

Enables Claude Code to read and modify Power BI data models locally, including searching DAX formulas and editing measures through a direct SSAS connection.

Category
Visit Server

README

Claude Power BI MCP Server

让 Claude Code 直接读取和修改你正在编辑的 Power BI 数据模型


背景与目的

行业现状:生态概览

截至 2026 年 7 月,Power BI 与 AI 助手的集成主要有以下路径:

方案 类型 连接方式 修改能力
ChatGPT/Copilot + 官方 Power BI 集成 商业产品 REST API / 云端 部分支持
VidSjen/mcp-powerbi-server 社区开源 Power BI REST API (Azure AD) 仅读取
lucas-labs/powerbi-mcp 社区开源 本地 SSAS (pythonnet) 仅读取
nheiniger/powerbi-mcp-knowledge-graph 社区开源 本地 SSAS (msmdsrv) 仅读取
本方案 (Claude Power BI MCP) 社区开源 本地 SSAS (ADOMD.NET + TOM) 读写

关键发现

  1. 没有官方 Claude Power BI MCP — Anthropic 的 modelcontextprotocol/servers 官方仓库不包含 Power BI 集成
  2. 社区方案存在,但功能有限 — GitHub 上有 3 个已知的 Power BI MCP 项目,但全部仅支持读取,无法修改 Measure
  3. ChatGPT/Copilot 的官方集成 — 可以连接 Power BI,但依赖云端 API 和 Azure AD 认证,不适合本地开发场景

为什么还需要造轮子?

对比维度 社区 MCP (lucas-labs 等) 本 MCP
读取模型 支持 支持
修改 Measure 不支持 支持 (TOM)
全文搜索 DAX 部分支持 全文搜索
自动发现实例 手动配置端口 零配置
批量替换 不支持 支持
部署难度 需配置 双击 setup.bat

Fashion Group 的实际场景

LVMH Fashion Group 旗下 5 个品牌的数据团队在日常开发中面临:

  1. 模型规模大 — 单个 PBIX 文件包含 500+ 个 Measure,维护成本高
  2. 列名变更频繁 — 底层数据源字段重命名后,需要快速定位所有受影响的 Measure
  3. 跨 Measure 搜索 — Power BI Desktop 不支持在 DAX 公式中全局搜索关键字
  4. 批量修改需求 — 社区方案仅支持读取,无法满足"改"的需求
  5. AI 模型因素 — 团队使用 Claude Code(deepseek-v4-pro 等模型)作为主力 AI 工具,无法直接使用 ChatGPT 的官方 Power BI 集成

为什么内部推广

  • 统一工具链 — 团队已使用 Claude Code,无需切换到 ChatGPT
  • 零配置部署 — 非技术人员双击 setup.bat 即可完成
  • 读写兼备 — 弥补社区方案"只读"的不足
  • 可复用 — 适用于任何使用 Power BI Desktop 的团队

部署方式(任选其一)

方式 A:Claude 自动部署(推荐 ✨)

把以下内容发给 Claude Code,Claude 会自动完成全部部署:

请帮我从 GitHub 下载并部署 Claude Power BI MCP: https://github.com/WenfengGu/Claude-PowerBI-MCP

  1. 下载 main.zip 并解压到 %USERPROFILE%\Claude-PowerBI-MCP
  2. 运行 pip install pythonnet
  3. 自动检测 Power BI Desktop 安装路径
  4. 生成 .mcp.json 配置文件
  5. 安装 Power BI Skill 到 ~/.claude/skills/
  6. 运行 test_connection.py 验证

Claude 执行完毕后:

  • MCP Server 已安装(8 个 Power BI 工具)
  • Skill 已安装(Claude 看到 PBI 任务会自动调用这些工具)
  • 打开 PBIX 文件即可使用

部署后发生了什么?

部署完成后,Claude Code 获得了两层能力

┌─────────────────────────────────────────────────┐
│  Skill: powerbi-model.md                        │
│  "当用户提到 Power BI/PBIX/DAX 时,             │
│   优先使用 claude-powerbi 工具"                  │
│  触发词: Power BI, PBIX, DAX, measure, 数据模型  │
├─────────────────────────────────────────────────┤
│  MCP Server: claude-powerbi                     │
│  8 个工具: discover, get_measures, search_dax,   │
│            replace_in_measure, run_dax, ...      │
├─────────────────────────────────────────────────┤
│  SSAS Client (ADOMD.NET)                        │
│  localhost:54013 → Power BI Desktop             │
└─────────────────────────────────────────────────┘
  • Skill = 告诉 Claude "何时使用" + "怎么用"
  • MCP Server = 提供实际的 "读写能力"

方式 B:手动部署(不需要 Claude)

见下方"一键部署(5 分钟)"章节。


这是什么?

一个 Claude Code 插件,让 Claude 能够:

  • 读取 Power BI 中的表、Measure、DAX 公式
  • 搜索 DAX 表达式中的关键字
  • 直接修改 Measure 定义(如批量替换列名)
  • 执行 DAX 查询并查看结果

不需要配置服务器、不需要账号密码、不需要联网 — 只要你的电脑上打开了 Power BI Desktop。


一键部署(5 分钟)

第 1 步:确保你有 Python

打开"命令提示符"(按 Win+R,输入 cmd,回车),输入:

python --version

如果显示 Python 3.11.x 或更高版本,跳到第 2 步。

如果提示"不是内部命令":

  1. 去 https://www.python.org/downloads/ 下载 Python
  2. 安装时 勾选 "Add Python to PATH"(重要!)
  3. 重新打开命令提示符,再次输入 python --version 确认

第 2 步:运行安装脚本

  1. Claude-PowerBI-MCP 文件夹复制到你的电脑任意位置(如 D:\Claude-PowerBI-MCP
  2. 双击 setup.bat
  3. 看到 "SETUP COMPLETE!" 即为成功

如果双击没反应,右键 setup.bat → "以管理员身份运行"

第 3 步:测试连接

  1. 打开一个 PBIX 文件(用 Power BI Desktop 打开任意报表)
  2. Claude-PowerBI-MCP 文件夹中,双击 test_connection.py
  3. 看到 "ALL CHECKS PASSED!" 即为成功

第 4 步:配置 Claude Code

在 Claude Code 的项目根目录(你平时用 Claude Code 的文件夹)中,找到或创建 .mcp.json 文件,加入以下内容:

{
  "mcpServers": {
    "claude-powerbi": {
      "command": "python",
      "args": ["D:\\Claude-PowerBI-MCP\\server.py"],
      "env": {
        "PATH": "D:\\Program Files\\Microsoft Power BI Desktop\\bin;${PATH}"
      }
    }
  }
}

⚠️ 把 D:\\Claude-PowerBI-MCP 改成你实际的文件夹路径! ⚠️ 把 D:\\Program Files\\Microsoft Power BI Desktop\\bin 改成你的 Power BI 安装路径!

如何找到你的 Power BI 安装路径?

  • 运行 python test_connection.py,第一行输出的就是

第 5 步:开始使用

重启 Claude Code,打开 PBIX 文件,然后对 Claude 说:

帮我看看这个 PBIX 模型里有哪些表,有多少个 Measure
搜索所有 DAX 中引用了 "YEAR WEEK" 列的 Measure
把 [KPI] 表中所有 Measure 里的 'Calendar'[YEAR WEEK] 替换成 'Calendar'[MERCH YEAR]

能做什么?

功能 怎么用
查看模型概要 "帮我看看这个 Power BI 模型有哪些表"
列出所有 Measure "列出所有 measure 和它们的 DAX"
搜索包含 WTD 的 Measure "找出所有名字带 WTD 的 measure"
搜索 DAX 中的关键字 "搜索 DAX 中引用了 'Calendar'[YEAR WEEK] 的公式"
查看表的列 "列出 Calendar 表的所有列"
执行 DAX 查询 "运行 DAX 查询 EVALUATE VALUES('Store'[STORE TYPE])"
修改 Measure "把 [KPI] 的 WTD Sales 中的 YEAR WEEK 替换成 MERCH YEAR"

常见问题

Q: 提示 "No Power BI Desktop instances found"

A: 确保 Power BI Desktop 正在运行,且打开了一个 PBIX 文件。

Q: 提示 "pythonnet not found"

A: 重新运行 setup.bat,或手动执行 pip install pythonnet

Q: 我的 Power BI 安装在其他盘

A: 不需要手动配置!test_connection.py 会自动检测并显示路径。

Q: 修改 Measure 后 PBIX 中的星号消失了

A: 这是正常的。修改已直接保存到模型,不需要再手动保存。可以在 Power BI Desktop 中验证数据是否正确。

Q: 能在 Mac 上用吗?

A: 不能。Power BI Desktop 的 SSAS 引擎只在 Windows 上运行。


技术信息

  • 开发者: Claude Code + Max Gu
  • 联合开发 & 测试: Max Gu
  • 版本: 1.0.0 (2026-07)
  • 许可: MIT — 公司内部可自由使用和修改
  • 依赖: Python 3.11+, pythonnet, Power BI Desktop
  • 安全: 纯本地连接,数据不经过网络

文件说明

Claude-PowerBI-MCP/
├── deploy.ps1              ← Claude 自动部署脚本
├── deploy-github.bat       ← 双击部署脚本
├── setup.bat               ← 双击安装依赖
├── test_connection.py      ← 双击测试连接
├── server.py               ← MCP 主程序
├── ssas_client.py          ← 底层连接库
├── requirements.txt        ← Python 依赖
├── .mcp.json.template      ← 配置模板
├── .claude/
│   └── skills/
│       └── powerbi-model.md ← Skill 文件(自动触发)
├── .gitignore
├── README.md               ← 中文文档
└── README_EN.md            ← 英文文档

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured