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
Prerequisites
- Python 3.8 or higher
- 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
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. Environment variables mirror those in
.env.example
; pass them with -e VAR=value
or provide a .env
file in the
build context.
📖 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
- Format:
- 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
Run the test suite:
Test specific functionality:
🤝 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
🐛 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 -1732PythonMIT 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 -56JavaScript
- AsecurityAlicenseAqualityAI assistants to query and analyze Azure Data Explorer databases through standardized interfaces.Last updated -445PythonMIT 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 -JavaScript