Sandbox
@jonaolden/pbixray-mcp-server

MCP server for Power BI model inspection

This repo turns PBIXRay into an MCP server so agents can inspect Power BI .pbix files from their own tools. It exposes actions for loading a file, listing tables, reading metadata, viewing Power Query and DAX, checking schema and relationships, and paging through table contents.

43 stars13 forksPythonUpdated 1y ago
Who it's for

Builders who want their agent to read and explore Power BI model files during analysis or development.

What it delivers

You can ask an agent to inspect a .pbix file instead of opening Power BI and rechecking the model by hand.

What it does

Load PBIX files

Opens a Power BI .pbix file for analysis before other tools run.

Explore model structure

Lists tables, gets metadata, checks model size, and returns a model summary or statistics.

Inspect query logic

Shows Power Query M code, M parameters, DAX calculated tables, measures, and calculated columns.

Read schema and relationships

Returns column types, schema details, and table relationships from the model.

Page through table contents

Fetches rows from a table with pagination and configurable page size.

Disable tools for safety

Supports `--disallow [tool_names]` to turn off selected tools in the MCP server config.

How to get it

  1. 1Clone the repository
    git clone https://github.com/username/pbixray-mcp.git
    cd pbixray-mcp
  2. 2Install in development mode
    pip install -e .
  3. 3If 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

README

MseeP.ai Security Assessment Badge

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

  • Loading and analyzing PBIX files
  • Data model exploration
    • Listing tables in the model
    • Retrieving model metadata
    • Checking model size
    • Getting model statistics
    • Getting comprehensive model summary
  • Query language access
    • Viewing Power Query (M) code
    • Accessing M Parameters
    • Exploring DAX calculated tables
    • Viewing DAX measures
    • Examining DAX calculated columns
  • Data structure analysis
    • Retrieving schema information
    • Analyzing table relationships
    • 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

ToolCategoryDescription
load_pbix_fileCoreLoad a Power BI (.pbix) file for analysis
get_tablesModelList all tables in the model
get_metadataModelGet metadata about the Power BI configuration
get_power_queryQueryDisplay all M/Power Query code used for data transformation
get_m_parametersQueryDisplay all M Parameters values
get_model_sizeModelGet the model size in bytes
get_dax_tablesQueryView DAX calculated tables
get_dax_measuresQueryAccess DAX measures with filtering by table or measure name
get_dax_columnsQueryAccess calculated column DAX expressions with filtering options
get_schemaStructureGet details about the data model schema and column types
get_relationshipsStructureGet the details about the data model relationships
get_table_contentsDataRetrieve the contents of a specified table with pagination
get_statisticsModelGet statistics about the model with optional filtering
get_model_summaryModelGet 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:

  1. Clone the repository:

    git clone https://github.com/username/pbixray-mcp.git
    cd pbixray-mcp
    
  2. Install in development mode:

    pip install -e .
    
  3. 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)

MIT License

Files in the repo

Repository payload19 top-level entries
  • .github
  • demo
  • docs
  • examples
  • src
  • tests
  • .gitignore
  • CONTRIBUTING.md
  • debug_metadata.py
  • INSTALLATION.md
  • LICENSE
  • pyproject.toml
  • pytest.ini
  • README.md
  • requirements.txt
  • run_server_auto_load.sh
  • run_server.sh
  • setup.py
  • test_pagination.py

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface

86k

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k