{
  "markdown": "# PowerBI MCP Server\n\n[![PyPI](https://img.shields.io/pypi/v/powerbi-mcp.svg)](https://pypi.org/project/powerbi-mcp/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/powerbi-mcp.svg)](https://pypi.org/project/powerbi-mcp/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n<!-- mcp-name: io.github.gurvinder-dhillon/powerbi-mcp -->\n\nA Model Context Protocol (MCP) server that provides tools for interacting with PowerBI REST APIs. This server enables AI assistants like Claude to query PowerBI workspaces, datasets, and execute DAX queries.\n\n> [!WARNING]\n> **Security Best Practices**\n> - Never commit credentials to version control\n> - Store credentials in `.env` files (add to `.gitignore`)\n> - Rotate client secrets regularly in Azure AD\n> - Use least-privilege access (only grant necessary workspace permissions)\n> - This server has read/write access to PowerBI datasets - use with caution\n\n## ✨ Features\n\n- **Query Your Data**: Run DAX queries to extract insights and analyze your PowerBI data directly through conversation\n- **Discover Workspaces & Datasets**: Explore what data is available across your organization's PowerBI environment\n- **Understand Data Models**: Get detailed schema information to know what tables, columns, and relationships exist\n- **Natural Language to Insights**: Ask questions about your data and get answers without opening PowerBI\n\nSee all [available tools](#-available-tools) below.\n\n## 💡 What Can You Do?\n\n| Scenario | Example Prompt |\n|----------|----------------|\n| Explore available data | \"What workspaces do I have access to?\" |\n| Discover reports | \"What reports are available in my workspace?\" |\n| Understand data schema | \"Show me the schema for dataset [dataset-name]\" |\n| Monitor data freshes | \"When was this dataset last refreshed?\" |\n| Check parameters | \"What parameters does this dataset accept?\" |\n| Query data with DAX | \"Run a DAX query to get top 10 sales by region from [dataset]\" |\n| Analyze data quality | \"What tables are in the Sales dataset?\" |\n| Extract insights | \"Get the list of all measures in the Financial dataset\" |\n\n## 📋 Prerequisites\n\n- **Azure AD Service Principal**: Required for authentication. Follow the [Azure AD Configuration](#-azure-ad-configuration) steps below to set this up.\n\n## 🔐 Azure AD Configuration\n\nBefore installing the server, you need to set up an Azure AD application with PowerBI access.\n\n### Create Azure AD App Registration\n\n1. Go to [Azure Portal](https://portal.azure.com)\n2. Navigate to **Azure Active Directory** > **App registrations**\n3. Click **New registration**\n4. Enter a name (e.g., \"PowerBI MCP Server\")\n5. Click **Register**\n\n### Get Credentials\n\nAfter registration, collect these values:\n\n- **Tenant ID**: Found in app Overview page (Directory ID)\n- **Client ID**: Found in app Overview page (Application ID)\n- **Client Secret**:\n  - Go to **Certificates & secrets**\n  - Click **New client secret**\n  - Add description and set expiry\n  - Copy the secret **Value** (you can only see this once!)\n\n### Enable Service Principal in PowerBI\n\n1. Go to [PowerBI Admin Portal](https://app.powerbi.com/admin-portal)\n2. Navigate to **Tenant settings** > **Developer settings**\n3. Enable **Service principals can use PowerBI APIs**\n4. Add your app to the security group or enable for entire organization\n5. Click **Apply**\n\n> [!NOTE]\n> Service principals can access workspaces where they've been granted explicit permissions (Admin, Member, or Contributor roles).\n\n### Grant Workspace Access\n\nFor each workspace you want to access:\n\n1. Go to the workspace in PowerBI\n2. Click workspace settings (⚙️) > **Access**\n3. Click **Add people or groups**\n4. Search for your app name\n5. Assign role: **Admin**, **Member**, or **Contributor**\n6. Click **Add**\n\n## 📦 Installation\n\n### Method 0: From PyPI (Recommended)\n\nOnce published to PyPI, this is the simplest installation method.\n\nAdd the following to your MCP client configuration file:\n\n**For Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):\n\n```json\n{\n  \"mcpServers\": {\n    \"powerbi-mcp\": {\n      \"command\": \"uvx\",\n      \"args\": [\"powerbi-mcp\"],\n      \"env\": {\n        \"POWERBI_TENANT_ID\": \"your-tenant-id-here\",\n        \"POWERBI_CLIENT_ID\": \"your-client-id-here\",\n        \"POWERBI_CLIENT_SECRET\": \"your-client-secret-here\"\n      }\n    }\n  }\n}\n```\n\n**For Claude Code** (`./.mcp.json` in your project directory):\n\n```json\n{\n  \"mcpServers\": {\n    \"powerbi-mcp\": {\n      \"command\": \"uvx\",\n      \"args\": [\"powerbi-mcp\"],\n      \"env\": {}\n    }\n  }\n}\n```\n\nWhen using Claude Code, create a `.env` file in your project directory (where you run Claude Code from):\n\n```env\nPOWERBI_TENANT_ID=your-tenant-id-here\nPOWERBI_CLIENT_ID=your-client-id-here\nPOWERBI_CLIENT_SECRET=your-client-secret-here\n```\n\n> [!TIP]\n> The `.env` file should be in your working directory, not where the server is installed.\n\n**For OpenCode** (`~/.config/opencode/opencode.json`):\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"mcp\": {\n    \"powerbi-mcp\": {\n      \"type\": \"local\",\n      \"command\": [\"uvx\", \"powerbi-mcp\"],\n      \"enabled\": true,\n      \"env\": {\n        \"POWERBI_TENANT_ID\": \"your-tenant-id-here\",\n        \"POWERBI_CLIENT_ID\": \"your-client-id-here\",\n        \"POWERBI_CLIENT_SECRET\": \"your-client-secret-here\"\n      }\n    }\n  }\n}\n```\n\nAfter adding the configuration, restart your MCP client.\n\n### Method 1: Direct from GitHub (Development)\n\nThis method uses `uvx` to run the server directly from GitHub without cloning the repository.\n\nAdd the following to your MCP client configuration file:\n\n**For Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):\n\n```json\n{\n  \"mcpServers\": {\n    \"powerbi-mcp\": {\n      \"command\": \"uvx\",\n      \"args\": [\n        \"--from\",\n        \"git+https://github.com/gurvinder-dhillon/powerbi-mcp@main\",\n        \"run-server\"\n      ],\n      \"env\": {\n        \"POWERBI_TENANT_ID\": \"your-tenant-id-here\",\n        \"POWERBI_CLIENT_ID\": \"your-client-id-here\",\n        \"POWERBI_CLIENT_SECRET\": \"your-client-secret-here\"\n      }\n    }\n  }\n}\n```\n\n**For Claude Code** (`./.mcp.json` in your project directory):\n\n```json\n{\n  \"mcpServers\": {\n    \"powerbi-mcp\": {\n      \"command\": \"uvx\",\n      \"args\": [\n        \"--from\",\n        \"git+https://github.com/gurvinder-dhillon/powerbi-mcp@main\",\n        \"run-server\"\n      ],\n      \"env\": {}\n    }\n  }\n}\n```\n\nWhen using Claude Code, create a `.env` file in your project directory (where you run Claude Code from):\n\n```env\nPOWERBI_TENANT_ID=your-tenant-id-here\nPOWERBI_CLIENT_ID=your-client-id-here\nPOWERBI_CLIENT_SECRET=your-client-secret-here\n```\n\n> [!TIP]\n> The `.env` file should be in your working directory, not where the server is installed.\n\nThe server will automatically load environment variables from the `.env` file in your current working directory.\n\n**For OpenCode** (`~/.config/opencode/opencode.json`):\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"mcp\": {\n    \"powerbi-mcp\": {\n      \"type\": \"local\",\n      \"command\": [\n        \"uvx\",\n        \"--from\",\n        \"git+https://github.com/gurvinder-dhillon/powerbi-mcp@main\",\n        \"run-server\"\n      ],\n      \"enabled\": true,\n      \"env\": {\n        \"POWERBI_TENANT_ID\": \"your-tenant-id-here\",\n        \"POWERBI_CLIENT_ID\": \"your-client-id-here\",\n        \"POWERBI_CLIENT_SECRET\": \"your-client-secret-here\"\n      }\n    }\n  }\n}\n```\n\nAfter adding the configuration, restart your MCP client.\n\n### Method 2: Local Clone (Contributors)\n\nFor contributors who want to run from a local clone:\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/gurvinder-dhillon/powerbi-mcp.git\ncd powerbi-mcp\n```\n\n2. Install dependencies:\n\n```bash\nuv sync\n```\n\n3. Add to your MCP client configuration:\n\n**For Claude Desktop**:\n\n```json\n{\n  \"mcpServers\": {\n    \"powerbi-mcp-local\": {\n      \"command\": \"uv\",\n      \"args\": [\n        \"--directory\",\n        \"/absolute/path/to/powerbi-mcp\",\n        \"run\",\n        \"run-server\"\n      ],\n      \"env\": {\n        \"POWERBI_TENANT_ID\": \"your-tenant-id-here\",\n        \"POWERBI_CLIENT_ID\": \"your-client-id-here\",\n        \"POWERBI_CLIENT_SECRET\": \"your-client-secret-here\"\n      }\n    }\n  }\n}\n```\n\n**For Claude Code** (`./.mcp.json` in your project directory):\n\n```json\n{\n  \"mcpServers\": {\n    \"powerbi-mcp-local\": {\n      \"command\": \"uv\",\n      \"args\": [\n        \"--directory\",\n        \"/absolute/path/to/powerbi-mcp\",\n        \"run\",\n        \"run-server\"\n      ],\n      \"env\": {}\n    }\n  }\n}\n```\n\n**For OpenCode** (`~/.config/opencode/opencode.json`):\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"mcp\": {\n    \"powerbi-mcp-local\": {\n      \"type\": \"local\",\n      \"command\": [\n        \"uv\",\n        \"--directory\",\n        \"/absolute/path/to/powerbi-mcp\",\n        \"run\",\n        \"run-server\"\n      ],\n      \"enabled\": true,\n      \"env\": {\n        \"POWERBI_TENANT_ID\": \"your-tenant-id-here\",\n        \"POWERBI_CLIENT_ID\": \"your-client-id-here\",\n        \"POWERBI_CLIENT_SECRET\": \"your-client-secret-here\"\n      }\n    }\n  }\n}\n```\n\nReplace `/absolute/path/to/powerbi-mcp` with the actual path to your cloned repository.\n\nWhen using Claude Code or OpenCode, create a `.env` file in your project directory with your credentials (see Method 1 Claude Code section above for the format).\n\n## 🚀 Quick Start\n\nOnce installed, try these steps to get started:\n\n1. **Verify Connection**: Ask Claude \"What PowerBI workspaces do I have access to?\"\n2. **Explore Data**: \"Show me the datasets in workspace [workspace-name]\"\n3. **View Schema**: \"What tables are in dataset [dataset-name]?\"\n4. **Run a Query**: \"Execute this DAX query on [dataset-name]: EVALUATE TOPN(10, Sales)\"\n\n## 🛠️ Available Tools\n\n| Tool | Description | Key Parameters |\n|------|-------------|----------------|\n| `get_workspaces` | List accessible PowerBI workspaces | `top`, `detail` |\n| `get_datasets` | Get datasets from workspace or \"My workspace\" | `workspace_id`, `detail` |\n| `get_dataset` | Get detailed dataset info including schema | `dataset_id`, `workspace_id`, `detail` |\n| `get_reports` | List PowerBI reports in workspace | `workspace_id`, `format`, `detail` |\n| `get_refresh_history` | Get dataset refresh history with status/timestamps | `dataset_id`, `workspace_id`, `top`, `format` |\n| `get_parameters` | List dataset parameters and their current values | `dataset_id`, `workspace_id`, `format`, `detail` |\n| `query_dataset` | Execute DAX queries against dataset | `dataset_id`, `dax_query`, `workspace_id` |\n\n### Tool Details\n\n#### 1. get_workspaces\n\nList PowerBI workspaces accessible to the service principal.\n\n**Parameters:**\n- `top` (optional): Number of workspaces to return (default: 100, max: 5000)\n- `detail` (optional): Level of detail - \"concise\", \"normal\", or \"full\" (default: \"normal\")\n\n#### 2. get_datasets\n\nGet list of datasets from a workspace or \"My workspace\".\n\n**Parameters:**\n- `workspace_id` (optional): Workspace ID (omit for \"My workspace\")\n- `detail` (optional): Level of detail - \"concise\", \"normal\", or \"full\" (default: \"normal\")\n\n#### 3. get_dataset\n\nGet detailed information about a specific dataset including schema and tables.\n\n**Parameters:**\n- `dataset_id` (required): Dataset ID\n- `workspace_id` (optional): Workspace ID (omit for \"My workspace\")\n- `detail` (optional): Level of detail - \"concise\", \"normal\", or \"full\" (default: \"normal\")\n\n#### 4. get_reports\n\nList PowerBI reports in a workspace.\n\n**Parameters:**\n- `workspace_id` (optional): Workspace ID (omit for \"My workspace\")\n- `format` (optional): Response format - \"markdown\" or \"json\" (default: \"markdown\")\n- `detail` (optional): Level of detail - \"concise\" or \"normal\" (default: \"concise\")\n\n#### 5. get_refresh_history\n\nGet refresh history for a dataset showing recent refresh operations.\n\n**Parameters:**\n- `dataset_id` (required): Dataset ID\n- `workspace_id` (optional): Workspace ID (omit for \"My workspace\")\n- `top` (optional): Number of refresh records to return (default: 5, max: 60)\n- `format` (optional): Response format - \"markdown\" or \"json\" (default: \"markdown\")\n\n#### 6. get_parameters\n\nGet parameters defined in a dataset.\n\n**Parameters:**\n- `dataset_id` (required): Dataset ID\n- `workspace_id` (optional): Workspace ID (omit for \"My workspace\")\n- `format` (optional): Response format - \"markdown\" or \"json\" (default: \"markdown\")\n- `detail` (optional): Level of detail - \"concise\" or \"normal\" (default: \"normal\")\n\n**Note:** Not supported for datasets with SQL, Oracle, Teradata, SAP HANA DirectQuery connections or datasets modified via XMLA endpoint.\n\n#### 7. query_dataset\n\nExecute DAX queries against a dataset.\n\n**Parameters:**\n- `dataset_id` (required): Dataset ID\n- `dax_query` (required): DAX query (must start with \"EVALUATE\")\n- `workspace_id` (optional): Workspace ID (omit for \"My workspace\")\n\n### DAX Query Examples\n\n**Basic Table Scan:**\n```dax\nEVALUATE\n'Sales'\n```\n\n**Top N with Sorting:**\n```dax\nEVALUATE\nTOPN(10, 'Sales', [Amount], DESC)\n```\n\n**Filtered Results:**\n```dax\nEVALUATE\nFILTER('Sales', [Year] = 2024)\n```\n\n**Calculated Columns:**\n```dax\nEVALUATE\nADDCOLUMNS(\n    'Sales',\n    \"Profit\", [Revenue] - [Cost]\n)\n```\n\n**Aggregated Summary:**\n```dax\nEVALUATE\nSUMMARIZE(\n    'Sales',\n    'Product'[Category],\n    \"Total Sales\", SUM('Sales'[Amount])\n)\n```\n\n## ⚠️ Troubleshooting\n\n### Authentication Errors\n\n**Error: \"Authentication failed\"**\n- Verify your `POWERBI_TENANT_ID`, `POWERBI_CLIENT_ID`, and `POWERBI_CLIENT_SECRET` are correct\n- Check that the client secret hasn't expired in Azure AD\n- Ensure the service principal is enabled in PowerBI Admin Portal\n\n### Permission Errors\n\n**Error: \"403 Forbidden\" or \"Access denied\"**\n- Verify the service principal has been granted access to the workspace\n- Check that the workspace role is Admin, Member, or Contributor (Viewer is not sufficient for API access)\n- Confirm \"Service principals can use PowerBI APIs\" is enabled in PowerBI Admin Portal\n\n### Connection Issues\n\n**Server not appearing in MCP client**\n- Restart your MCP client after adding the configuration\n- Check the configuration file syntax (JSON must be valid)\n- For local clone, verify the absolute path is correct\n\n**Tools not working**\n- Ensure credentials are configured\n- Check the MCP client logs for detailed error messages\n- For Claude Code, verify `.env` file is in the current working directory\n\n## 📚 Resources\n\n- [PowerBI REST API Reference](https://learn.microsoft.com/en-us/rest/api/power-bi/)\n- [Model Context Protocol](https://modelcontextprotocol.io/)\n- [DAX Guide](https://dax.guide/)\n- [Azure AD App Registration](https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app)\n\n## 💬 Feedback and Support\n\n- **Issues**: Report bugs or request features via [GitHub Issues](https://github.com/gurvinder-dhillon/powerbi-mcp/issues)\n- **Discussions**: Ask questions in [GitHub Discussions](https://github.com/gurvinder-dhillon/powerbi-mcp/discussions)\n- **Pull Requests**: Contributions welcome! See [DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md)\n\n## 🤝 Contributing\n\nSee [DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md) for information about developing and contributing to this project.\n\n## License\n\nThis project is licensed under the MIT License.\n",
  "bytes": 15263,
  "sha": "81406aee036469dfcb28beae58b1f486d8866dcc8adbc50c12044ffdef257b06",
  "repo_slug": "gurvinder-dhillon/powerbi-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_gurvinder_dhillon_powerbi_mcp_787507cd/readme"
}