This MCP server for PBIXRay exposes PowerBI (.pbix) file analysis capabilities to LLM clients through the Model Context Protocol, allowing AI assistants to explore data models, query languages, and data structures within PowerBI files.
You can install the PBIXRay MCP Server directly using pip:
pip install pbixray-mcp-server
For Claude Desktop users, add the server configuration to your client configuration file:
{
"mcpServers": {
"pbixray": {
"command": "wsl.exe",
"args": [
"bash",
"-c",
"source ~/dev/pbixray-mcp/venv/bin/activate && python ~/dev/pbixray-mcp/src/pbixray_server.py"
]
}
}
}
When using WSL with Claude Desktop on Windows, you'll need to convert file paths:
C:\Users\name\Downloads\file.pbix
/mnt/c/Users/name/Downloads/file.pbix
The server supports several command-line options that can be added to your configuration:
{
"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": {}
}
}
}
--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)The server provides the following tools for analyzing PowerBI files:
Tool | Description |
---|---|
load_pbix_file |
Load a Power BI (.pbix) file for analysis |
get_tables |
List all tables in the model |
get_metadata |
Get metadata about the Power BI configuration |
get_power_query |
Display all M/Power Query code used for data transformation |
get_m_parameters |
Display all M Parameters values |
get_model_size |
Get the model size in bytes |
get_dax_tables |
View DAX calculated tables |
get_dax_measures |
Access DAX measures with filtering by table or measure name |
get_dax_columns |
Access calculated column DAX expressions with filtering options |
get_schema |
Get details about the data model schema and column types |
get_relationships |
Get the details about the data model relationships |
get_table_contents |
Retrieve the contents of a specified table with pagination |
get_statistics |
Get statistics about the model with optional filtering |
get_model_summary |
Get a comprehensive summary of the current Power BI model |
First, load a PowerBI file for analysis:
load_pbix_file(file_path="/mnt/c/Users/name/Downloads/example.pbix")
List all tables in the model:
get_tables()
Get a comprehensive summary of the model:
get_model_summary()
Examine table relationships:
get_relationships()
View table contents with pagination:
# Get first page of data (default 20 rows)
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)
View DAX measures:
# Get all measures
get_dax_measures()
# Filter by table
get_dax_measures(table_name="Sales")
# Get a specific measure
get_dax_measures(table_name="Sales", measure_name="Total Sales")
Explore calculated columns:
get_dax_columns(table_name="Products")
View all Power Query (M) code:
get_power_query()
See M parameters:
get_m_parameters()
Many tools support filtering by name:
# Get schema for a specific table
get_schema(table_name="Sales")
# Get statistics for specific tables
get_statistics(table_names=["Sales", "Products"])
For development testing, use the MCP Inspector:
# Activate your environment first
source venv/bin/activate
# Run the MCP Inspector
mcp dev src/pbixray_server.py
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "pbixray" '{"command":"wsl.exe","args":["bash","-c","source ~/dev/pbixray-mcp/venv/bin/activate && python ~/dev/pbixray-mcp/src/pbixray_server.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"pbixray": {
"command": "wsl.exe",
"args": [
"bash",
"-c",
"source ~/dev/pbixray-mcp/venv/bin/activate && python ~/dev/pbixray-mcp/src/pbixray_server.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"pbixray": {
"command": "wsl.exe",
"args": [
"bash",
"-c",
"source ~/dev/pbixray-mcp/venv/bin/activate && python ~/dev/pbixray-mcp/src/pbixray_server.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect