Get the FREE Ultimate OpenClaw Setup Guide →

Power-BI-Custom -with-Python--Claude-AI-Integration

The MCP server connects Claude AI to Power BI Desktop, enabling AI-driven querying and analysis of Power BI models. It lets users explore data, run DAX queries, and retrieve metadata seamlessly within Claude. The integration runs locally on Windows, using Python and .NET for smooth communication.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio dheerajkumar97-power-bi-custom-mcp-server-with-python--claude-ai-integration python powerbi_mcp_server.py

How to use

This MCP server enables Claude to interact with a running Power BI Desktop instance via the XMLA endpoint. It leverages Python and pythonnet to connect to Power BI Desktop, discover models, browse schemas, execute DAX queries, and retrieve measures and relationships. Claude can ask it to list models, inspect tables and columns, run DAX against the active model, and fetch metadata such as measures and relationships. The server auto-detects the local Analysis Services port used by Power BI Desktop and communicates through the XMLA protocol using the MSOLAP provider under the hood. Typical workflows include exploring a model before building prompts or validating results directly from Claude.

Available capabilities include:

  • get_powerbi_models: enumerate active Power BI models in the running instance
  • get_model_tables: list all tables in the current model
  • get_table_columns: fetch columns for a specified table
  • execute_dax_query: run DAX queries against the model and return results
  • get_measures: retrieve all measures (optionally filtered by table)
  • get_relationships: view model relationships and properties
  • get_report_pages / get_page_visuals: access report pages and visuals (limited, COM-based)

To use it, ensure Power BI Desktop is running with a report opened, then configure Claude to point at the MCP server. Claude will issue requests through the MCP server to retrieve metadata or run DAX, returning results back into the chat for you to continue analysis.

How to install

Prerequisites:

  • Windows OS with Power BI Desktop installed and running
  • Python 3.8+
  • Virtual environment (optional but recommended)

Step-by-step installation:

  1. Clone the repository
git clone <your-repo-url>
cd Claude-Power-BI-Integration
  1. Create a virtual environment (optional but recommended)
python -m venv venv
  1. Activate the virtual environment Windows:
venv\Scripts\activate

Linux/macOS:

source venv/bin/activate
  1. Install dependencies
pip install mcp pythonnet
  1. Ensure you have a Power BI Desktop instance running with a model opened. The MCP server script (powerbi_mcp_server.py) should be present in the repository you cloned. You can run it directly after configuration.

  2. Configure Claude Desktop to load the MCP server (see Configuration section below). Restart Claude Desktop after updating the config.

Additional notes

Tips and notes:

  • The MCP server runs locally and uses Windows Integrated Security; no external credentials are typically required.
  • If Claude cannot connect, verify that Power BI Desktop is running and a model/report is loaded so the XMLA endpoint is active.
  • The port detection is automatic; ensure no firewall rules block local localhost communications.
  • For troubleshooting Python dependencies, ensure pythonnet is installed in the active environment: pip install pythonnet.
  • When editing Claude Desktop's JSON config, use double backslashes in Windows paths or switch to forward slashes to avoid JSON parsing issues.
  • Optional: run the MCP server inside a properly named script path to simplify Claude configuration (e.g., place powerbi_mcp_server.py in a known directory and reference its absolute path in the config).
  • If you modify the MCP server code, restart Claude Desktop to pick up changes.

Related MCP Servers

Sponsor this space

Reach thousands of developers