Power BI MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Power BI MCP Server
Disclaimer: This is an independent, community-developed tool and is not affiliated with, endorsed by, or connected to Microsoft Corporation or Anthropic.
Overview
Power BI MCP Server bridges the gap between AI assistants and Microsoft Power BI, enabling seamless interaction with semantic models through the Model Context Protocol. Whether you're working with local .pbix files or cloud-hosted datasets, this server provides a unified interface for querying data, managing models, and performing bulk operations—all while maintaining enterprise-grade security.
Key Capabilities
Capability | Description |
Dual Connectivity | Connect to both Power BI Desktop (local) and Power BI Service (cloud) |
Natural Language Queries | Execute DAX queries through conversational AI |
Bulk Operations | Rename tables, columns, and measures across your model |
Security First | PII detection, audit logging, and configurable access policies |
RLS Testing | Test Row-Level Security roles during development |
Safe Refactoring | PBIP-based editing preserves report visual integrity |
Related MCP server: powerbi-ai-mcp
The V1 to V2 Journey: Challenges & Solutions
The Challenge: Bulk Renames Breaking Reports
In V1, we successfully connected to Power BI Service via XMLA endpoints. V2 introduced Power BI Desktop connectivity and write operations using Microsoft's Tabular Object Model (TOM). However, we encountered a critical limitation:
Problem: Renaming a table via TOM breaks all report visuals referencing that table.Root Cause Analysis:
Power BI stores data in two separate layers:
+------------------------+ +------------------------+
| Semantic Model | | Report Definition |
| (Model Layer) | | (Report Layer) |
+------------------------+ +------------------------+
| - Tables | | - Visual bindings |
| - Columns | | - Slicers & filters |
| - Measures | | - Bookmarks |
| - Relationships | | - Field references |
| - DAX expressions | | - Formatting |
+------------------------+ +------------------------+
| |
v v
TOM can modify TOM CANNOT modifyWhen you rename a table using TOM, it updates:
The table name in the model
DAX expressions in measures (with our auto-update logic)
Relationship references
But it cannot update:
Visual field bindings in
report.jsonSlicer configurations
Bookmark references
This causes visuals to show errors like "Can't find column 'OldTableName'[Column]".
The Solution: PBIP File-Based Editing
We researched Microsoft's own approach and discovered that even their tools face this limitation. The solution lies in the Power BI Project (PBIP) format—a text-based representation of both the model and report.
Two Report Formats Supported:
Format | Structure | Default |
PBIR-Legacy | Single | Until Jan 2026 |
PBIR-Enhanced | Individual | From Jan 2026 |
MyReport.pbip
├── MyReport.SemanticModel/
│ ├── definition.tmdl <- Model definitions (text)
│ └── definition/
│ ├── tables/*.tmdl <- Table definitions
│ ├── cultures/*.tmdl <- Linguistic schema (Q&A)
│ └── relationships.tmdl
└── MyReport.Report/
├── report.json <- PBIR-Legacy: All visuals here
├── definition.pbir
└── definition/ <- PBIR-Enhanced structure
├── report.json <- Report-level settings only
└── pages/
└── [page_id]/
└── visuals/
└── [visual_id]/
└── visual.json <- Individual visual definitionReference: Data Goblins - Programmatically Modify Reports
Our Implementation:
We built a dedicated PBIP Connector that:
Parses PBIP Structure - Locates all TMDL files and
report.jsonUpdates Model Layer - Regex-based find-replace in TMDL files for:
Table definitions (
table OldName→table NewName)DAX references (
'OldTable'[Column]→'NewTable'[Column])
Updates Report Layer - JSON manipulation in
report.jsonfor:Entity bindings (
"Entity": "OldTable"→"Entity": "NewTable")Query references (
"OldTable.Column"→"NewTable.Column")Native reference names
Result: Tables, columns, and measures can be renamed without breaking a single visual.
Lessons Learned
Challenge | Solution |
TOM can't modify report layer | PBIP file-based editing |
DAX references not auto-updating | Regex-based expression rewriting |
No visibility into rename impact |
|
Complex PBIP structure | Dedicated connector with path discovery |
Architecture
┌──────────────────────────────────────────────────────────────┐
│ AI Assistant │
│ (Claude Desktop / Claude Code) │
└─────────────────────────────┬────────────────────────────────┘
│ MCP Protocol
▼
┌──────────────────────────────────────────────────────────────┐
│ Power BI MCP Server │
│ (36 Tools) │
├──────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Security │ │ Audit │ │ Access Policies │ │
│ │ (PII Mask) │ │ Logger │ │ (Block/Mask) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
├──────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
│ │ Desktop │ │ XMLA │ │ PBIP │ │
│ │ Connector │ │ Connector │ │ Connector │ │
│ │ (ADOMD) │ │ (Cloud) │ │ (File Editing) │ │
│ └──────┬──────┘ └──────┬──────┘ └──────────┬──────────┘ │
│ │ │ │ │
│ ┌──────┴──────┐ ┌──────┴──────┐ ┌──────────┴──────────┐ │
│ │ TOM │ │ REST API │ │ TMDL + JSON │ │
│ │ Connector │ │ Connector │ │ Parser │ │
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
└──────────────────────────────────────────────────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Power BI │ │ Power BI │ │ PBIP │
│ Desktop │ │ Service │ │ Files │
│ (localhost) │ │ (Cloud) │ │ (.pbip) │
└─────────────┘ └─────────────┘ └─────────────┘Available Tools
Desktop Operations (7 tools)
Tool | Description |
| Auto-discover running Power BI Desktop instances |
| Connect to a specific instance with optional RLS role |
| List all tables in the connected model |
| List columns for a specific table |
| List all measures with their expressions |
| Execute DAX queries with security processing |
| Get comprehensive model metadata |
Cloud Operations (8 tools)
Tool | Description |
| List accessible Power BI Service workspaces |
| List datasets in a workspace |
| List tables via XMLA endpoint |
| List columns for a table |
| Execute DAX queries against cloud datasets |
| Get model info using INFO.VIEW functions |
| Clear and reconnect XMLA connector for a specific workspace/dataset |
| Clear all cached XMLA cloud connectors |
Security & Compliance (2 tools)
Tool | Description |
| View current security configuration |
| Query recent audit log entries |
Row-Level Security (3 tools)
Tool | Description |
| List RLS roles defined in the model |
| Activate an RLS role for testing |
| Get current RLS status |
Model Modification via TOM (7 tools)
⚠️ WARNING: TOM-based rename tools are DEPRECATED for renaming operations!
The
batch_rename_*TOM tools only update the in-memory model and DO NOT update report visuals. This causes broken visuals after rename. Use PBIP tools instead for all rename operations.
Tool | Description |
| Analyze impact before renaming |
| ⚠️ DEPRECATED - Use |
| ⚠️ DEPRECATED - Use |
| ⚠️ DEPRECATED - Use |
| Bulk update measure expressions |
| Create a new DAX measure |
| Delete an existing measure |
PBIP Safe Editing (5 tools) ✅ RECOMMENDED
This is the correct way to rename tables, columns, and measures!
PBIP tools update everything: TMDL files, DAX expressions (with proper quoting), report visuals, and Q&A schema. Close Power BI Desktop before using, then reopen after.
Tool | Description |
| Load a PBIP project for editing |
| Get project structure information (detects PBIR format) |
| ✅ Comprehensive rename: updates TMDL + DAX quoting + visual.json + cultures (all automatic) |
| ✅ Rename columns (model + report layer, both PBIR formats) |
| ✅ Rename measures (model + report layer, both PBIR formats) |
PBIP Diagnostics (4 tools)
Tool | Description |
| Fix visual references after TOM/API rename (when rename was done outside PBIP tools) |
| Fix any remaining unquoted table names in DAX expressions |
| Scan project for broken references - compare model vs visuals |
| Validate TMDL syntax, find quoting issues, invalid references |
Note: DAX quoting and visual updates are now automatically handled by
pbip_rename_tables. The repair tools are only needed when renames were done outside of PBIP (e.g., via TOM API or Power BI Desktop).
Security Features
PII Detection & Auto-Masking
Sensitive data is automatically detected and masked before being returned to the AI:
Pattern | Example | Masked Output |
SSN |
|
|
Credit Card |
|
|
|
| |
Phone |
|
|
Query Audit Logging
Every query is logged with:
Timestamp and unique query fingerprint
Row count and execution duration
PII detection results
Policy violation flags
Logs support compliance requirements (GDPR, HIPAA, SOC2).
Configurable Access Policies
Define granular policies in config/policies.yaml:
tables:
- name: Customers
columns:
- name: SSN
action: block # Never return
- name: Email
action: mask # Apply PII masking
- name: Revenue
action: allow # Return as-isInstallation
Prerequisites
For Desktop Connectivity:
Windows 10/11
Power BI Desktop installed
Python 3.10+
ADOMD.NET (included with Power BI Desktop or SSMS)
For Cloud Connectivity (Optional):
Azure AD App Registration with
Dataset.Read.AllandWorkspace.Read.AllPremium Per User (PPU) or Premium Capacity workspace
XMLA endpoint enabled
Quick Start
# Clone the repository
git clone https://github.com/sulaiman013/powerbi-mcp.git
cd powerbi-mcp-v2
# Install dependencies
pip install -r requirements.txt
# (Optional) Configure cloud credentials
cp .env.example .env
# Edit .env with your Azure AD credentialsConfigure Claude Desktop
Add to %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"powerbi": {
"command": "python",
"args": ["C:/path/to/powerbi-mcp-v2/src/server.py"],
"env": {
"PYTHONPATH": "C:/path/to/powerbi-mcp-v2/src"
}
}
}
}Restart Claude Desktop to activate.
Usage Examples
⚠️ IMPORTANT: How to Rename Tables/Columns/Measures
DO NOT use TOM-based tools (batch_rename_tables, batch_rename_columns, batch_rename_measures) for renaming. They break report visuals!
ALWAYS use PBIP tools:
Close Power BI Desktop (if open)
pbip_load_project- Load the .pbip filepbip_rename_tables/pbip_rename_columns/pbip_rename_measures- Do the renameReopen Power BI Desktop to see changes
Basic Desktop Workflow
User: "Discover Power BI Desktop instances"
User: "Connect to Power BI Desktop"
User: "What tables are in my model?"
User: "Run DAX: EVALUATE TOPN(10, Sales)"Cloud Post-Publish Refresh Workflow (Recommended for Automation)
When a semantic model is republished, you can proactively refresh cloud XMLA connections:
User: "Refresh cloud connection for workspace 'Finance' and dataset 'Sales Model'"
User: "Run DAX: EVALUATE TOPN(1, Sales)"For automation platforms (for example n8n), trigger refresh_cloud_connection after publish and use clear_cloud_cache as a broad fallback before restarting the MCP process.
Safe Bulk Rename with PBIP (✅ Correct Way)
User: "Load PBIP project from C:/Projects/SalesReport"
User: "Rename tables: Salesforce_Data to Leads Sales Data"What happens automatically:
Table declaration updated:
table Salesforce_Data→table 'Leads Sales Data'DAX references quoted:
Salesforce_Data[Amount]→'Leads Sales Data'[Amount]Function calls fixed:
COUNTROWS(Salesforce_Data)→COUNTROWS('Leads Sales Data')Visual files updated: All
"Entity": "Salesforce_Data"→"Entity": "Leads Sales Data"Cultures/Q&A updated: All
"ConceptualEntity"references fixed
Diagnose Issues (When Needed)
User: "Load PBIP project from C:/Projects/SalesReport"
User: "Scan for broken references"
# Shows: Tables in model vs tables referenced in visuals
User: "Validate project"
# Shows: Any TMDL syntax errors or quoting issuesUse repair tools only if a rename was done outside the MCP server (e.g., via TOM API or Power BI Desktop UI).
RLS Testing
User: "List RLS roles in my model"
User: "Set RLS role to 'Sales_East'"
User: "Run DAX: EVALUATE Sales" # Results filtered by role
User: "Clear RLS role"Project Structure
powerbi-mcp-v2/
├── src/
│ ├── server.py # MCP server (32 tools)
│ ├── powerbi_desktop_connector.py # Desktop + RLS
│ ├── powerbi_xmla_connector.py # Cloud XMLA
│ ├── powerbi_rest_connector.py # REST API
│ ├── powerbi_tom_connector.py # TOM write operations
│ ├── powerbi_pbip_connector.py # PBIP file editing
│ └── security/
│ ├── pii_detector.py # PII detection
│ ├── audit_logger.py # Audit logging
│ ├── access_policy.py # Policy engine
│ └── security_layer.py # Unified security
├── config/
│ └── policies.yaml # Access policies
├── logs/
│ └── audit.log # Query audit log
├── .env.example
├── requirements.txt
└── README.mdLimitations
Limitation | Workaround |
Windows only | Required for ADOMD.NET and Power BI Desktop |
TOM renames break visuals | Use PBIP tools for safe bulk renames |
Cloud requires Premium | XMLA endpoints need PPU/Premium workspace |
Roadmap
Completed (V2)
Power BI Desktop connectivity
Cloud XMLA integration
Security layer (PII, audit, policies)
RLS testing support
TOM write operations
PBIP safe editing
Planned (V3)
Open Source LLM Support - Integration with Ollama, LM Studio, and other local LLMs
Air-Gapped Deployment - Full offline capability for secure enterprise environments
Docker Containerization - One-command deployment with
docker-composeSelf-Hosted Architecture - Run entirely on-premise without external dependencies
Relationship management (create/delete)
VertiPaq Analyzer integration
Auto-generated model documentation
Cross-platform support exploration
Author
Sulaiman Ahmed Data Analytics Engineer & Microsoft Certified Professional
Passionate about bridging the gap between AI and enterprise data platforms. This project combines expertise in Power BI semantic modeling, Python development, and the emerging Model Context Protocol ecosystem.
Contributing
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Model Context Protocol by Anthropic
Microsoft's TOM and TMDL documentation
The Power BI community for insights on PBIP format
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Forge designed Power BI projects (.pbip) from your agent, bound to your own semantic model.
Company and industrial data for AI assistants: datasets, SQL, dashboards, alarms, with approvals.
Governed BI MCP. Ask questions of live company data and list workspace sources via OAuth.
- DNS-DATA RemoteDeprecatedcom.dns-data
Connect AI assistants to authorized Windows and macOS devices for files, commands, and management.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to interact with Power BI datasets through natural language, allowing users to query data, generate DAX, and get insights without leaving their AI assistant.127MIT
- FlicenseNot gradedqualityDmaintenanceEnables controlling Power BI with AI through natural language commands for creating DAX measures, explaining metrics, suggesting KPIs, and organizing models.-
- FlicenseNot gradedqualityBmaintenanceEnables AI assistants to read and modify Power BI Desktop files programmatically, including querying models, creating measures, and managing relationships through natural language.257-
- AlicenseAqualityBmaintenanceEnables an AI assistant to analyze live Power BI Desktop models and files, and to safely apply approved, reversible edits to copies of Power BI files one change at a time.33MIT