PBIXRay MCP Server
Enables LLMs to analyze and interact with Power BI (.pbix) files through PBIXRay capabilities. Provides access to data models, DAX measures, Power Query code, table relationships, and data contents with configurable tools and pagination support.
README
Info!
those interested in this project might also be interested in this follow-up project, tabular-mcp, which allows running DAX queries against a local PowerBI model. support is highly appreciated !
PBIXRay MCP Server
A Model Context Protocol (MCP) server for PBIXRay.
This MCP server exposes the capabilities of PBIXRay as tools and resources for LLM clients to interact with Power BI (.pbix) files.
Features
- [x] Loading and analyzing PBIX files
- [x] Data model exploration
- [x] Listing tables in the model
- [x] Retrieving model metadata
- [x] Checking model size
- [x] Getting model statistics
- [x] Getting comprehensive model summary
- [x] Query language access
- [x] Viewing Power Query (M) code
- [x] Accessing M Parameters
- [x] Exploring DAX calculated tables
- [x] Viewing DAX measures
- [x] Examining DAX calculated columns
- [x] Data structure analysis
- [x] Retrieving schema information
- [x] Analyzing table relationships
- [x] Accessing table contents with pagination
The list of tools is configurable, so you can choose which tools you want to make available to the MCP client. This is useful if you don't use certain functionality or if you don't want to expose sensitive information.
Tools
| Tool | Category | Description |
|---|---|---|
load_pbix_file |
Core | Load a Power BI (.pbix) file for analysis |
get_tables |
Model | List all tables in the model |
get_metadata |
Model | Get metadata about the Power BI configuration |
get_power_query |
Query | Display all M/Power Query code used for data transformation |
get_m_parameters |
Query | Display all M Parameters values |
get_model_size |
Model | Get the model size in bytes |
get_dax_tables |
Query | View DAX calculated tables |
get_dax_measures |
Query | Access DAX measures with filtering by table or measure name |
get_dax_columns |
Query | Access calculated column DAX expressions with filtering options |
get_schema |
Structure | Get details about the data model schema and column types |
get_relationships |
Structure | Get the details about the data model relationships |
get_table_contents |
Data | Retrieve the contents of a specified table with pagination |
get_statistics |
Model | Get statistics about the model with optional filtering |
get_model_summary |
Model | Get a comprehensive summary of the current Power BI model |
Usage
WSL (Recommended)
Add the server configuration to your client configuration file. For example, for 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 Path conversion (Claude Project instructions for instance)
When using the PBIXRay MCP Server in WSL with Claude Desktop on Windows, you need to be aware of path differences when loading PBIX files.
Windows paths (like C:\Users\name\file.pbix) cannot be directly accessed in WSL. Let your AI assistant know how to convert between pats by adding
"Note that mcp server is running in wsl. Windows paths (like C:\Users\name\file.pbix) cannot be directly accessed in WSL. Instead, use WSL paths when referencing files:
Windows: C:\Users\name\Downloads\file.pbix"
WSL: /mnt/c/Users/name/Downloads/file.pbix" to project instructions or similar.
Command Line Options
The server supports several command line options:
--disallow [tool_names]: Disable specific tools for security reasons--max-rows N: Set maximum number of rows returned (default: 100)--page-size N: Set default page size for paginated results (default: 20)
Command-line options can be added as needed in config 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": {}
}
}
}
Query Options
Tools support additional parameters for filtering and pagination:
Filtering by Name
Tools like get_dax_measures, get_dax_columns, get_schema and others support filtering by specific names:
# 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")
Pagination for Large Tables
The get_table_contents tool supports pagination to handle large tables efficiently:
# 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)
Development and testing
You can install PBIXRay MCP Server:
pip install pbixray-mcp-server
Development Installation
For developers working on the project:
-
Clone the repository:
git clone https://github.com/username/pbixray-mcp.git cd pbixray-mcp -
Install in development mode:
pip install -e . -
If installing from source, create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install mcp pbixray numpy
Testing with Sample Files
The repository includes sample files and test scripts to help you get started:
# 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
The test scripts will help you understand how to interact with the server using the sample PBIX files provided in the demo/ directory.
Development Mode
To test the server during development, use the MCP Inspector:
# Activate your environment first
source venv/bin/activate
# Run the MCP Inspector
mcp dev src/pbixray_server.py
This starts an interactive session where you can call tools and test responses.
Project Structure
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
Contributions
Contributions are much welcomed!
Credits
- Hugoberry - Original PBIXRay library
- rusiaaman - WCGW (This MCP was fully written by Claude using wcgw)
License (claude insists on adding these)
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
