PBIXRay MCP server

Provides a bridge to analyze Power BI (.pbix) files through a Python-based interface, enabling data model exploration, language querying, and structure analysis with pagination and filtering capabilities.
Back to servers
Setup instructions
Provider
jonaolden
Release date
Mar 26, 2025
Language
Python
Stats
24 stars

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.

Installation

Using pip

You can install the PBIXRay MCP Server directly using pip:

pip install pbixray-mcp-server

Running in WSL (Recommended)

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"
      ]
    }
  }
}

Path Conversion for WSL

When using WSL with Claude Desktop on Windows, you'll need to convert file paths:

  • Windows path: C:\Users\name\Downloads\file.pbix
  • WSL path: /mnt/c/Users/name/Downloads/file.pbix

Configuration Options

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": {}
    }
  }
}

Available 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)

Using the MCP Server

Available Tools

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

Basic Usage Examples

First, load a PowerBI file for analysis:

load_pbix_file(file_path="/mnt/c/Users/name/Downloads/example.pbix")

Exploring the Data Model

List all tables in the model:

get_tables()

Get a comprehensive summary of the model:

get_model_summary()

Examine table relationships:

get_relationships()

Accessing Table Data

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)

Working with DAX

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")

Analyzing PowerQuery/M Code

View all Power Query (M) code:

get_power_query()

See M parameters:

get_m_parameters()

Filtering Options

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"])

Testing the Server

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

How to install this MCP server

For Claude Code

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.

For Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.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

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later