Power BI原生MCP服务器
Power BI的企业级模型上下文协议(MCP)服务器,设计用于在受限环境中运行。
powerbi原生mcp 是一个专用服务器,允许AI助手(如Claude、Cursor或专用代理)直接与本地Power BI Desktop模型交互。它依赖于一个独特的 原住民桥 绕过常见企业安全限制的技术。
快速启动(开发)
- 克隆:
git clone https://github.com/Klng79/powerbi-native-mcp.git - 安装:
npm install*(如果可用,将自动复制Microsoft Analysis Services DLL)* - 构建:
npm run build - 运行:
node dist/index.js
系统安装(生产)
要安装到 C:\Program Files\powerbi-native-mcp\:
- 完成上述快速入门步骤(克隆、安装、构建)。
- 打开 管理员命令提示符 或 PowerShell(管理员).
- 运行:
npm run install-global
这将把所有文件复制到 C:\Program Files\powerbi-native-mcp\ 包括DLL。
特性
- 🛡️ 安全旁路: 使用进程内DLL加载(
edge-js)避免产卵受阻.exe或PowerShell脚本。 - ⚡ 双模式:
- 阅读: 快速数据导出和DAX查询执行。 - 写: 直接使用TOM创建/编辑表和分区。
- 📦 自给自足: 使用本地Microsoft Analysis Services DLL完全在Node.js进程中运行。
- 🔗 多实例: 连接到两者 Power BI 桌面版 和 Excel数据模型 (动力枢轴)。
看 ROADMAP.md 对于计划中的功能。
先决条件
- Power BI 桌面版 必须在模型打开的情况下运行。
- Microsoft分析服务DLL -安装过程中自动获得:
1. 从本地DAX Studio复制(如果已安装),或 1. 已从NuGet自动下载
用法示例
一旦连接到您的AI助手,您就可以使用自然语言与Power BI模型进行交互:
📊 查询数据
"Show me the top 10 customers by sales"
"Run this DAX query: EVALUATE TOPN(5, 'Products', [Total Sales])"
"Export all sales data from 2024 to Excel"📋 列出并检查
"List all tables in my Power BI model"
"What columns are in the Customer table?"
"Show me the structure of the Sales table"➕ 创建表格
"Create a new table called 'RegionalSales' that groups sales by region"
"Add a table from Excel file W:\Data\inventory.xlsx"
"Create a calculated table with this M code: let Source = Sales, Grouped = Table.Group(Source, {\"Region\"}, {{\"Total\", each List.Sum([Amount])}}) in Grouped"✏️ 编辑表格
"Update the Power Query for 'Products' table to filter only active items"
"Change the M code for 'Customers' to include the new address column"
"Modify the source of 'Sales' table to point to the new database"🗑️ 删除表
"Delete the 'TempData' table"
"Remove the 'OldCustomers' table from the model"👁️ 能见度
"Hide the 'HelperTable' from report view"
"Make the 'Metrics' table visible again"文档
许可证
麻省理工学院
