Connects to Power BI datasets via ADOMD.NET client libraries to execute DAX queries and retrieve data
Uses GPT-4o-mini for AI-powered DAX query generation to translate natural language questions into DAX queries for Power BI
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: Metabase MCP Server
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:
Root Cause Analysis:
Power BI stores data in two separate layers:
When 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 |
Reference: 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
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 (6 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 |
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:
Installation
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
Configure Claude Desktop
Add to %APPDATA%\Claude\claude_desktop_config.json:
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
Safe Bulk Rename with PBIP (✅ Correct Way)
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)
Use repair tools only if a rename was done outside the MCP server (e.g., via TOM API or Power BI Desktop UI).
RLS Testing
Project Structure
Limitations
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