DP

dheerajkumar97/power-bi-custom-mcp-server-with-python--claude-ai-integration

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

12 stars 6 forks 质量 61 趋势 19

The MCP server connects Claude AI to Power BI Desktop, enabling AI-driven querying and analysis of Power BI models.

概览

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 - : Get information about active Power BI models - : Browse tables, columns, and their properties - : Run DAX queries directly against your Power BI model - : Retrieve all measures with their expressions - : View model relationships and their properties - : Automatically finds the Power BI Desktop XMLA port - (Power BI Desktop is Windows-only) - installed and running with a report open - - package for .NET interoperability Add the following configuration to your Claude Desktop config file: %APPDATA%\Claude\claude_desktop_config.json Replace the paths with your actual project paths.

README

以下为原文 README 节选,完整内容请查看原文。

Power BI Desktop MCP Server

A Model Context Protocol (MCP) server that enables Claude to interact with Power BI Desktop through the XMLA endpoint using Analysis Services.

Overview

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

Features

  • 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

Prerequisites

  • 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

Installation

1. Clone or Download the Repository

git clone 
cd Claude-Power-BI-Integration

2. Create a Virtual Environment

python -m venv venv

3. Activate the Virtual Environment

Windows:

venv\Scripts\activate

Linux/Mac:

source venv/bin/activate

4. Install Dependencies

pip install mcp pythonnet

Configuration

Claude Desktop Configuration

Add 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.

Finding Your Paths

  1. Python executable path:

    where python
    # Or if in virtual environment
    venv\Scripts\python.exe
    
  2. Script path:

    • Navigate to your project folder
    • Copy the full path to powerbi_mcp_server.py

Usage

1. Start Power BI Desktop

Ensure Power BI Desktop is running with a report/model open.

2. Restart Claude Desktop

After updating the configuration, restart Claude Desktop to load the MCP server.

3. Verify Connection

In Claude, you can ask:

"Can you connect to my Power BI model?"
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "powerbi": { "command": "C:\\Path\\To\\Your\\venv\\Scripts\\python.exe", "args": [ "C:\\Path\\To\\Your\\powerbi_mcp_server.py" ] } } }