Power BI MCP Servers

Integrate with Power BI using a local server for offline .pbix file analysis and an Azure server for querying live datasets.

šŸ”„ Power BI MCP Servers

Dual Power BI integration for Claude Desktop - Local .pbix analysis + Live Azure API queries

MIT License Node.js Python

✨ Features

This repository provides two complementary MCP servers for comprehensive Power BI integration:

šŸ  Local Analysis Server (pbixray-mcp-server)

  • Analyze local .pbix files without cloud connection
  • Extract DAX measures, Power Query M code, relationships
  • Explore data model structure and table contents
  • Perfect for offline analysis and documentation

ā˜ļø Azure Live API Server (powerbi-azure-mcp)

  • Query live Power BI datasets via REST API
  • Execute DAX queries in real-time
  • List workspaces, datasets, and table schemas
  • Authenticate with Azure service principal

šŸš€ Quick Start

Prerequisites

  • Claude Desktop installed
  • Node.js 18+ and Python 3.8+
  • Azure service principal with Power BI permissions (for live API)

Installation

  1. Clone this repository:

    git clone https://github.com/anix-lynch/powerbi-mcp-servers.git
    cd powerbi-mcp-servers
    
  2. Setup Local Server:

    cd pbixray-mcp-server
    python -m venv venv
    source venv/bin/activate  # Windows: venv\Scripts\activate
    pip install mcp pbixray numpy "mcp[cli]"
    
  3. Setup Azure Server:

    cd ../powerbi-azure-mcp
    npm install
    cp .env.example .env
    # Edit .env with your Azure credentials
    
  4. Configure Claude Desktop: Add to your MCP configuration:

    {
      "mcpServers": {
        "powerbi-local": {
          "command": "bash",
          "args": ["-c", "source ~/path/to/pbixray-mcp-server/venv/bin/activate && python ~/path/to/pbixray-mcp-server/src/pbixray_server.py --max-rows 100"]
        },
        "powerbi-azure": {
          "command": "node",
          "args": ["/path/to/powerbi-azure-mcp/src/server.mjs"]
        }
      }
    }
    

šŸŽ® Usage Examples

Local File Analysis

"Load this PBIX file: /Users/username/Downloads/sales-report.pbix"
"What tables are in this model?"
"Show me all DAX measures from the Sales table"
"Get the Power Query M code"

Live Azure Queries

"Test my Power BI connection"
"List all my Power BI workspaces"
"Execute this DAX query: EVALUATE Sales"
"Show me table schema for dataset [dataset-id]"

šŸ”§ Configuration

Azure Setup

Create a service principal with these permissions:

  • Dataset.Read.All
  • Workspace.ReadWrite.All

Environment Variables

AZURE_CLIENT_ID=your-app-id
AZURE_CLIENT_SECRET=your-client-secret  
AZURE_TENANT_ID=your-tenant-id

šŸ“ Project Structure

powerbi-mcp-servers/
ā”œā”€ā”€ pbixray-mcp-server/          # Local .pbix analysis
│   ā”œā”€ā”€ src/pbixray_server.py    # Python MCP server
│   ā”œā”€ā”€ demo/                    # Sample files
│   └── requirements.txt
ā”œā”€ā”€ powerbi-azure-mcp/           # Live Azure API
│   ā”œā”€ā”€ src/server.mjs           # Node.js MCP server  
│   ā”œā”€ā”€ package.json
│   └── .env.example
└── docs/                        # Documentation

šŸŽÆ Available Tools

Local Server Tools

  • load_pbix_file - Load Power BI file for analysis
  • get_tables - List all tables in the model
  • get_dax_measures - Access DAX measures with filtering
  • get_power_query - Display M/Power Query code
  • get_relationships - Get data model relationships
  • get_table_contents - Retrieve table data with pagination

Azure Server Tools

  • test_connection - Test Azure authentication
  • list_workspaces - List accessible workspaces
  • list_datasets - Browse datasets in workspace
  • execute_dax_query - Run DAX queries against live data
  • get_dataset_tables - Explore table schemas
  • get_dataset_info - Get dataset metadata

šŸ¤ Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

šŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

šŸ™ Credits


Built with ā¤ļø for the Claude + Power BI community

Related Servers