pbixray-mcp-server
PBIXRay MCP 服务器
PBIXRay 的模型上下文协议(MCP) 服务器。
该 MCP 服务器将PBIXRay的功能公开为 LLM 客户端与 Power BI (.pbix) 文件交互的工具和资源。
特征
[x] 加载和分析 PBIX 文件
[x] 数据模型探索
[x] 列出模型中的表
[x] 检索模型元数据
[x] 检查模型尺寸
[x] 获取模型统计数据
[x] 获取全面的模型摘要
[x] 查询语言访问
[x] 查看 Power Query (M) 代码
[x] 访问 M 参数
[x] 探索 DAX 计算表
[x] 查看 DAX 指标
[x] 检查 DAX 计算列
[x] 数据结构分析
[x] 检索架构信息
[x] 分析表关系
[x] 使用分页访问表格内容
工具列表是可配置的,因此您可以选择要向 MCP 客户端开放的工具。如果您不使用某些功能或不想泄露敏感信息,此功能非常有用。
Related MCP server: RAGFlow MCP Server
工具
工具 | 类别 | 描述 |
| 核 | 加载 Power BI (.pbix) 文件进行分析 |
| 模型 | 列出模型中的所有表 |
| 模型 | 获取有关 Power BI 配置的元数据 |
| 询问 | 显示用于数据转换的所有 M/Power Query 代码 |
| 询问 | 显示所有 M 参数值 |
| 模型 | 获取模型大小(以字节为单位) |
| 询问 | 查看 DAX 计算表 |
| 询问 | 通过按表或度量名称进行筛选来访问 DAX 度量 |
| 询问 | 使用筛选选项访问计算列 DAX 表达式 |
| 结构 | 获取有关数据模型架构和列类型的详细信息 |
| 结构 | 获取有关数据模型关系的详细信息 |
| 数据 | 检索指定表的分页内容 |
| 模型 | 通过可选过滤获取有关模型的统计数据 |
| 模型 | 获取当前 Power BI 模型的全面摘要 |
用法
WSL(推荐)
将服务器配置添加到客户端配置文件中。例如,对于 Claude Desktop:
{
"mcpServers": {
"pbixray": {
"command": "wsl.exe",
"args": [
"bash",
"-c",
"source ~/dev/pbixray-mcp/venv/bin/activate && python ~/dev/pbixray-mcp/src/pbixray_server.py"
]
}
}
}WSL 路径转换(例如 Claude 项目说明)
在 Windows 上使用 Claude Desktop 在 WSL 中使用 PBIXRay MCP 服务器时,加载 PBIX 文件时需要注意路径差异。Windows 路径(例如C:\Users\name\file.pbix )无法在 WSL 中直接访问。请在项目说明中添加“请注意,mcp 服务器正在 WSL 中运行。Windows 路径(例如 C:\Users\name\file.pbix )无法在 WSL 中直接访问。请在引用文件时使用 WSL 路径:Windows:C:\Users\name\Downloads\file.pbix”或类似说明,让您的 AI 助手知道如何在路径之间进行转换。
命令行选项
该服务器支持多个命令行选项:
--disallow [tool_names]:出于安全原因禁用特定工具--max-rows N:设置返回的最大行数(默认值:100)--page-size N:设置分页结果的默认页面大小(默认值:20)
可以根据需要在配置json中添加命令行选项:
{
"mcpServers": {
"pbixray": {
"command": "wsl.exe",
"args": [
"bash",
"-c",
"source ~/dev/pbixray-mcp/venv/bin/activate && python ~/dev/pbixray-mcp/src/pbixray_server.py --max-rows 100 --page-size 50 --disallow get_power_query"
],
"env": {}
}
}
}查询选项
工具支持用于过滤和分页的附加参数:
按名称过滤
get_dax_measures 、 get_dax_columns 、 get_schema等工具支持按特定名称进行过滤:
# Get measures from a specific table
get_dax_measures(table_name="Sales")
# Get a specific measure
get_dax_measures(table_name="Sales", measure_name="Total Sales")大型表格的分页
get_table_contents工具支持分页,可以有效地处理大型表格:
# Get first page of Customer table (default 20 rows per page)
get_table_contents(table_name="Customer")
# Get second page with 50 rows per page
get_table_contents(table_name="Customer", page=2, page_size=50)开发和测试
您可以安装 PBIXRay MCP 服务器:
pip install pbixray-mcp-server开发安装
对于参与该项目的开发人员:
克隆存储库:
git clone https://github.com/username/pbixray-mcp.git cd pbixray-mcp以开发模式安装:
pip install -e .如果从源安装,请创建虚拟环境并安装依赖项:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install mcp pbixray numpy
使用示例文件进行测试
该存储库包含示例文件和测试脚本,以帮助您入门:
# Test with sample AdventureWorks Sales.pbix file in demo/ folder
python tests/test_with_sample.py
# Try the interactive demo
python examples/demo.py
# For isolated tests of specific features
python test_pagination.py
python test_metadata_fix.py测试脚本将帮助您了解如何使用demo/目录中提供的示例 PBIX 文件与服务器交互。
开发模式
要在开发过程中测试服务器,请使用 MCP Inspector:
# Activate your environment first
source venv/bin/activate
# Run the MCP Inspector
mcp dev src/pbixray_server.py这将启动一个交互式会话,您可以在其中调用工具和测试响应。
项目结构
pbixray-mcp/
├── README.md - This file
├── INSTALLATION.md - Detailed installation instructions
├── src/ - Source code
│ ├── __init__.py
│ └── pbixray_server.py
├── tests/ - Test scripts
│ ├── __init__.py
│ ├── conftest.py
│ ├── test_server.py
│ └── test_with_sample.py
├── examples/ - Example scripts and configs
│ ├── demo.py
│ └── config/
├── demo/ - Sample PBIX files
│ ├── README.md
│ └── AdventureWorks Sales.pbix
└── docs/ - Additional documentation
└── ROADMAP.md贡献
非常欢迎贡献!
致谢
许可证(克劳德坚持要添加这些)
This server cannot be deployed
Maintenance
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
Model Context Protocol server for Studex tools, notifications, and profile integrations
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
BGG MCP provides access to the BoardGameGeek API through the Model Context Protocol, enabling retr…
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides a Model Context Protocol interface for HexagonML ModelManager tools, enabling interaction with machine learning model management functionality through natural language.1-
- AlicenseNot gradedqualityDmaintenanceProvides a comprehensive Model Context Protocol interface for RAGFlow, enabling AI models to perform semantic retrieval, manage datasets, and handle document chunks. It supports advanced features like GraphRAG and RAPTOR for sophisticated knowledge base management and natural language querying.MIT
- AlicenseNot gradedqualityCmaintenanceEnables interaction with dbt projects via the Model Context Protocol for data analysis and insights.4MIT
- AlicenseNot gradedqualityDmaintenanceBridges the Model Context Protocol to the Tabular Object Model, enabling natural language inspection, optimization, and authoring of DAX in Power BI Desktop.27MIT