MCP server to give llms such as Claude, GitHub Copilot etc full PowerBI model context (from input .pbix) through tools based on PBIXRay python package.

What is jonaolden pbixray mcp server

MseeP.ai Security Assessment Badge

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

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:

  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

Leave a Comment

Frequently Asked Questions

What is MCP?

MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.

What are MCP Servers?

MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.

How do MCP Servers work?

MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.

Are MCP Servers secure?

Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.

Related MCP Servers

chrisdoc hevy mcp avatar

chrisdoc hevy mcp

mcp
sylphlab pdf reader mcp avatar

sylphlab pdf reader mcp

An MCP server built with Node.js/TypeScript that allows AI agents to securely read PDF files (local or URL) and extract text, metadata, or page counts. Uses pdf-parse.

pdf-parsetypescriptnodejs
aashari mcp server atlassian bitbucket avatar

aashari mcp server atlassian bitbucket

Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.

atlassianrepositorymcp
aashari mcp server atlassian confluence avatar

aashari mcp server atlassian confluence

Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP interface.

atlassianmcpconfluence
prisma prisma avatar

prisma prisma

Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

cockroachdbgomcp
Zzzccs123 mcp sentry avatar

Zzzccs123 mcp sentry

mcp sentry for typescript sdk

mcptypescript
zhuzhoulin dify mcp server avatar

zhuzhoulin dify mcp server

mcp
zhongmingyuan mcp my mac avatar

zhongmingyuan mcp my mac

mcp
zhixiaoqiang desktop image manager mcp avatar

zhixiaoqiang desktop image manager mcp

MCP ๆœๅŠกๅ™จ๏ผŒ็”จไบŽ็ฎก็†ๆกŒ้ขๅ›พ็‰‡ใ€ๆŸฅ็œ‹่ฏฆๆƒ…ใ€ๅŽ‹็ผฉใ€็งปๅŠจ็ญ‰๏ผˆๅฎŒๅ…จ่ฎฉTraeๅฎž็Žฐ๏ผ‰

mcp
zhixiaoqiang antd components mcp avatar

zhixiaoqiang antd components mcp

An MCP service for Ant Design components query | ไธ€ไธชๅ‡ๅฐ‘ Ant Design ็ป„ไปถไปฃ็ ็”Ÿๆˆๅนป่ง‰็š„ MCP ๆœๅŠก๏ผŒๅŒ…ๅซ็ณป็ปŸๆ็คบ่ฏใ€็ป„ไปถๆ–‡ๆกฃใ€API ๆ–‡ๆกฃใ€ไปฃ็ ็คบไพ‹ๅ’Œๆ›ดๆ–ฐๆ—ฅๅฟ—ๆŸฅ่ฏข

designantdapi

Submit Your MCP Server

Share your MCP server with the community

Submit Now