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 ๐
๐ฅ 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.
Related MCP server: Power BI MCP Server
โจ 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
git clone https://github.com/yourusername/powerbi-mcp-server.git cd powerbi-mcp-serverInstall dependencies
pip install -r requirements.txtConfigure environment variables
cp .env.example .env # Edit .env with your credentialsTest the connection
python quickstart.py
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
{
"mcpServers": {
"powerbi": {
"command": "python",
"args": ["C:/path/to/powerbi-mcp-server/src/server.py"],
"env": {
"PYTHONPATH": "C:/path/to/powerbi-mcp-server",
"OPENAI_API_KEY": "your-openai-api-key"
}
}
}
}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:
docker build -t powerbi-mcp .Run the server:
docker run -it --rm -e OPENAI_API_KEY=<key> powerbi-mcpThe container listens on port 8000 by default. Override the host or port using
environment variables or command-line arguments:
docker run -it --rm -e OPENAI_API_KEY=<key> -p 7000:7000 powerbi-mcp \
python src/server.py --host 0.0.0.0 --port 7000The 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=valueDocker 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
Connect to Power BI dataset at powerbi://api.powerbi.com/v1.0/myorg/YourWorkspaceExplore Your Data
What tables are available?
Show me the structure of the Sales tableAsk Questions
What are the total sales by product category?
Show me the trend of revenue over the last 12 months
Which store has the highest gross margin?Execute Custom DAX
Execute DAX: EVALUATE SUMMARIZE(Sales, Product[Category], "Total", SUM(Sales[Amount]))๐ง Configuration
Required Credentials
Power BI XMLA Endpoint
Format:
powerbi://api.powerbi.com/v1.0/myorg/WorkspaceNameEnable 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):
# OpenAI Configuration (optional)
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-4o-mini # Defaults to gpt-4o-mini
# Optional: Default Power BI Credentials
# These values are used when the `connect_powerbi` action does not supply
# tenant_id, client_id or client_secret.
DEFAULT_TENANT_ID=your_tenant_id
DEFAULT_CLIENT_ID=your_client_id
DEFAULT_CLIENT_SECRET=your_client_secret
# Logging
LOG_LEVEL=INFO๐๏ธ Architecture
powerbi-mcp-server/
โโโ src/
โ โโโ server.py # Main MCP server implementation
โโโ docs/ # Documentation
โโโ examples/ # Example queries and use cases
โโโ tests/ # Test suite
โโโ .env.example # Environment variables template
โโโ requirements.txt # Python dependencies
โโโ quickstart.py # Quick test script
โโโ README.md # This fileKey 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
.envfiles and keep them in.gitignoreUse 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:
python -m pytest tests/Test specific functionality:
python tests/test_connector.py
python tests/test_server_process.pyIntegration 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
cp .env.example .env # Edit .env file and set: ENABLE_INTEGRATION_TESTS=trueSet test dataset configuration
# Test Power BI Dataset Configuration TEST_XMLA_ENDPOINT=powerbi://api.powerbi.com/v1.0/myorg/YourTestWorkspace TEST_TENANT_ID=your_tenant_id TEST_CLIENT_ID=your_client_id TEST_CLIENT_SECRET=your_client_secret TEST_INITIAL_CATALOG=YourTestDatasetName # Optional: Expected test data for validation TEST_EXPECTED_TABLE=Sales TEST_EXPECTED_COLUMN=Amount TEST_DAX_QUERY=EVALUATE TOPN(1, Sales) TEST_MIN_TABLES_COUNT=1Run integration tests
# Interactive runner with safety checks python run_integration_tests.py # Or directly with pytest python -m pytest tests/test_integration.py -v # Run with auto-confirmation (CI/CD) python run_integration_tests.py --yes
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
# Check environment compatibility
python scripts/check_test_environment.py
# Run unit tests
python -m pytest tests/ -k "not test_integration" -v
# Run integration tests (requires .env configuration)
python -m pytest tests/test_integration.py -vTest 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
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
Connect AI assistants to Preset to explore data, charts, and dashboards in authorized workspaces.
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.
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 AI assistants to programmatically manage Power BI workspaces, reports, and dashboards while executing DAX queries and triggering dataset refreshes. It supports secure OAuth2 authentication for operations like report exporting, workspace management, and real-time push dataset updates.4-
- AlicenseBqualityDmaintenanceEnables AI assistants to interact with Microsoft Fabric and Power BI services through the Model Context Protocol. Users can manage workspaces, execute DAX queries, refresh datasets, and create Fabric notebooks using natural language.69 npm2MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to query PowerBI workspaces, datasets, and execute DAX queries through the PowerBI REST API.7MIT