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 🚀
🎥 Live Demo
Transform your Power BI experience - ask questions in natural language and get instant insights from your data.
A Model Context Protocol (MCP) server that enables AI assistants to interact with Power BI datasets through natural language. Query your data, generate DAX, and get insights without leaving your AI assistant.
✨ Features
🔗 Direct Power BI Connection - Connect to any Power BI dataset via XMLA endpoints
💬 Natural Language Queries - Ask questions in plain English, get DAX queries and results
📊 Automatic DAX Generation - AI-powered DAX query generation using GPT-4o-mini
🔍 Table Discovery - Automatically explore tables, columns, and measures
⚡ Optimized Performance - Async operations and intelligent caching
🛡️ Secure Authentication - Service Principal authentication with Azure AD
📈 Smart Suggestions - Get relevant question suggestions based on your data
🎥 Demo
Ask questions like "What are total sales by region?" and get instant insights from your Power BI data.
🚀 Quick Start
System Requirements & Platform Compatibility
Platform | Python | .NET Runtime | ADOMD.NET | Status |
Windows | 3.10+ | ✅ Built-in | ✅ Available | ✅ Full Support |
Linux | 3.10+ | ✅ Available | ⚠️ Docker only | ✅ Docker Support |
macOS | 3.10+ | ✅ Available | ❌ Not available | ❌ Not supported |
Note: For Linux systems, use Docker to run the server with all dependencies included.
Prerequisites
Python 3.10 or higher (3.8+ may work but not officially supported)
Windows with ADOMD.NET or Docker on Linux (container includes the runtime)
SQL Server Management Studio (SSMS) or ADOMD.NET client libraries (Windows only)
Power BI Pro/Premium with XMLA endpoint enabled
Azure AD Service Principal with access to your Power BI dataset
OpenAI API key (optional for natural language features)
Installation
Clone the repository
Install dependencies
Configure environment variables
Test the connection
Configure with Claude Desktop
Add to your Claude Desktop configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Docker
⚠️ Important: Docker containers do NOT use .env
files. The .env
file is excluded
from the Docker build context for security. You must provide environment variables via
docker run -e
, Docker Compose, or your cloud platform.
Build the container image:
Run the server:
The container listens on port 8000
by default. Override the host or port using
environment variables or command-line arguments:
The server exposes a Server-Sent Events endpoint at /sse
. Clients should
connect to this endpoint and then POST JSON-RPC messages to the path provided in
the initial endpoint
event (typically /messages/
).
The container includes the .NET runtime required by pythonnet
and pyadomd
.
It sets PYTHONNET_RUNTIME=coreclr
and DOTNET_ROOT=/usr/share/dotnet
so the
.NET runtime is detected automatically.
Important: The Docker container does NOT use .env
files. Any .env
file in your
local directory will be excluded from the Docker image via .dockerignore
for security reasons.
Instead, provide environment variables using:
docker run -e VARIABLE=value
Docker Compose environment variables
Cloud platform environment variable injection
The available environment variables mirror those in .env.example
.
📖 Usage
Once configured, you can interact with your Power BI data through Claude:
Connect to Your Dataset
Explore Your Data
Ask Questions
Execute Custom DAX
🔧 Configuration
Required Credentials
Power BI XMLA Endpoint
Format:
powerbi://api.powerbi.com/v1.0/myorg/WorkspaceName
Enable in Power BI Admin Portal → Workspace Settings
Azure AD Service Principal
Create in Azure Portal → App Registrations
Grant access in Power BI Workspace → Access settings
OpenAI API Key (optional)
Needed only for natural language features
Endpoints that rely on GPT models are hidden if this key is not set
Get from OpenAI Platform
Model used:
gpt-4o-mini
(200x cheaper than GPT-4)
Environment Variables
Create a .env
file (OpenAI settings are optional):
🏗️ Architecture
Key Components
PowerBIConnector - Handles XMLA connections and DAX execution
DataAnalyzer - AI-powered query generation and interpretation
PowerBIMCPServer - MCP protocol implementation
🔐 Security Best Practices
Never commit credentials - Use
.env
files and keep them in.gitignore
Use Service Principals - Avoid personal credentials
Minimal permissions - Grant only necessary access to datasets
Rotate secrets regularly - Update Service Principal secrets periodically
Use secure connections - Always use HTTPS/TLS
🧪 Testing
Unit Tests
Run the standard test suite:
Test specific functionality:
Integration Tests
Real integration tests with Power BI datasets are available but disabled by default. These tests connect to actual Power BI services and may consume API quota.
Enable Integration Tests:
Configure test environment
Set test dataset configuration
Run integration tests
Integration Test Coverage:
✅ Power BI dataset connection
✅ Table discovery and schema retrieval
✅ DAX query execution
✅ Sample data retrieval
✅ MCP tool interface testing
✅ Natural language query generation (with OpenAI)
✅ AI-powered suggestions (with OpenAI)
⚠️ Warning: Integration tests connect to real Power BI datasets and may consume:
XMLA endpoint usage quota
OpenAI API tokens
Network bandwidth
Only run integration tests in dedicated test environments.
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Fork the repository
Create your feature branch (
git checkout -b feature/AmazingFeature
)Commit your changes (
git commit -m 'Add some AmazingFeature'
)Push to the branch (
git push origin feature/AmazingFeature
)Open a Pull Request
📊 Performance
Connection time: 2-3 seconds
Query execution: 1-5 seconds depending on complexity
Token usage: ~500-2000 tokens per query with GPT-4o-mini
Cost: ~$0.02-0.06 per day for typical usage
🧪 Testing
Running Tests
Test Environment Requirements
Python 3.10+ (recommended)
All dependencies from requirements.txt
For integration tests: valid Power BI connection credentials
Platform-Specific Testing
Windows: Full test suite supported
Linux: Unit tests only (use Docker for integration tests)
macOS: Unit tests only (limited support)
🐛 Troubleshooting
Common Issues
ADOMD.NET not found
For Windows, install SQL Server Management Studio (SSMS)
On Linux, use the provided Docker image which bundles the cross-platform ADOMD.NET runtime
Connection fails
Verify XMLA endpoint is enabled in Power BI
Check Service Principal has workspace access
Ensure dataset name matches exactly
Timeout errors
Increase timeout in Claude Desktop config
Check network connectivity to Power BI
See TROUBLESHOOTING.md for detailed solutions.
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
Anthropic for the MCP specification
Microsoft for Power BI and ADOMD.NET
OpenAI for GPT models
The MCP community for inspiration and support
📬 Support
📧 Email: sulaimanahmed013@gmail.com
💬 Issues: GitHub Issues
📚 Docs: Full Documentation
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables 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.
Related MCP Servers
- AsecurityAlicenseAqualityAllows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.Last updated -859MIT License
- -securityFlicense-qualityEnables AI assistants to interact with Metabase databases and dashboards, allowing users to list and execute queries, access data visualizations, and interact with database resources through natural language.Last updated -67
- AsecurityAlicenseAqualityAI assistants to query and analyze Azure Data Explorer databases through standardized interfaces.Last updated -448MIT License
- -securityFlicense-qualityEnables AI assistants to interact with Metabase, providing access to dashboards, questions, databases, and tools for executing queries and viewing data through natural language.Last updated -