A Model Context Protocol (MCP) server that enables Claude to interact with Power BI Desktop through the XMLA endpoint using Analysis Services.
This MCP server allows Claude to:
- Query Power BI data models and metadata
- Execute DAX queries
- Retrieve table schemas, columns, and relationships
- Access measures and model information
- All without leaving the Claude interface
- Model Discovery: Get information about active Power BI models
- Schema Exploration: Browse tables, columns, and their properties
- DAX Execution: Run DAX queries directly against your Power BI model
- Measures: Retrieve all measures with their expressions
- Relationships: View model relationships and their properties
- Auto-Detection: Automatically finds the Power BI Desktop XMLA port
- Windows OS (Power BI Desktop is Windows-only)
- Power BI Desktop installed and running with a report open
- Python 3.8+
- pythonnet package for .NET interoperability
git clone <your-repo-url>
cd Claude-Power-BI-Integrationpython -m venv venvWindows:
venv\Scripts\activateLinux/Mac:
source venv/bin/activatepip install mcp pythonnetAdd the following configuration to your Claude Desktop config file:
Location: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"powerbi": {
"command": "C:\\Path\\To\\Your\\venv\\Scripts\\python.exe",
"args": [
"C:\\Path\\To\\Your\\powerbi_mcp_server.py"
]
}
}
}Example Configuration:
{
"mcpServers": {
"powerbi": {
"command": "D:\\Job Preparation\\Personnel Work\\Python - Technology\\VS Code Python Code\\Claude-Power BI-Intergration\\venv\\Scripts\\python.exe",
"args": [
"D:\\Job Preparation\\Personnel Work\\Python - Technology\\VS Code Python Code\\Claude-Power BI-Intergration\\powerbi_mcp_server.py"
]
}
}
}Important: Replace the paths with your actual project paths. Use double backslashes (\\) or forward slashes (/) in JSON.
-
Python executable path:
where python # Or if in virtual environment venv\Scripts\python.exe
-
Script path:
- Navigate to your project folder
- Copy the full path to
powerbi_mcp_server.py
Ensure Power BI Desktop is running with a report/model open.
After updating the configuration, restart Claude Desktop to load the MCP server.
In Claude, you can ask:
"Can you connect to my Power BI model?"
Claude will use the MCP server to connect and retrieve model information.
The MCP server provides the following tools to Claude:
| Tool | Description |
|---|---|
get_powerbi_models |
Get all Power BI models in the active report |
get_model_tables |
List all tables in the model |
get_table_columns |
Get columns from a specific table |
execute_dax_query |
Execute DAX queries against the model |
get_measures |
Retrieve all measures (optionally filtered by table) |
get_relationships |
Get all relationships in the model |
get_report_pages |
Get report pages (limited - requires COM) |
get_page_visuals |
Get visuals from a page (limited - requires COM) |
Once configured, you can ask Claude:
- "Show me all tables in my Power BI model"
- "What columns are in the Sales table?"
- "Execute this DAX query: EVALUATE TOPN(10, Sales)"
- "What measures are defined in the model?"
- "Show me the relationships between tables"
- "Calculate total sales by year using DAX"
- Port Detection: The server automatically finds the local Analysis Services port used by Power BI Desktop
- XMLA Connection: Connects using the MSOLAP provider through OleDB
- DMV Queries: Uses Dynamic Management Views (DMVs) to retrieve metadata
- DAX Execution: Executes DAX queries and returns results to Claude
Solution:
- Ensure Power BI Desktop is running
- Open a report/model in Power BI Desktop
- The XMLA endpoint is only active when a model is loaded
Solution:
pip install pythonnetSolution:
- Verify the JSON configuration is valid (use a JSON validator)
- Check that paths use double backslashes or forward slashes
- Restart Claude Desktop completely
- Check Claude Desktop logs:
%APPDATA%\Claude\logs
Solution:
- Ensure you have the Microsoft OLE DB Provider for Analysis Services installed
- This comes with Power BI Desktop but may need repair/reinstall
- Try running Claude Desktop as Administrator
- Windows Only: Power BI Desktop and XMLA endpoints are Windows-specific
- Local Only: Connects only to local Power BI Desktop instances
- Report Pages/Visuals: Limited access to report-level objects (requires Power BI COM interface)
- No Data Modification: Read-only access to the model
Claude Desktop
↓
MCP Server (Python)
↓
pythonnet → .NET OleDb
↓
MSOLAP Provider
↓
Power BI Desktop (XMLA Endpoint)
- All connections are local (localhost)
- Uses Windows Integrated Security (SSPI)
- No external network access required
- No API keys or credentials needed
Contributions are welcome! Please feel free to submit issues or pull requests.
[Add your license here]
- Power BI XMLA Endpoint Documentation
- DAX Query Language
- Model Context Protocol
- Analysis Services DMVs
For issues or questions:
- Check the Troubleshooting section
- Review Power BI Desktop logs
- Check Claude Desktop logs in
%APPDATA%\Claude\logs - Open an issue on GitHub
Note: This is a community project and is not officially supported by Microsoft or Anthropic.