powerbi-mcp 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- powerbi_mcp-0.1.0.dist-info/METADATA +540 -0
- powerbi_mcp-0.1.0.dist-info/RECORD +18 -0
- powerbi_mcp-0.1.0.dist-info/WHEEL +4 -0
- powerbi_mcp-0.1.0.dist-info/entry_points.txt +2 -0
- powerbi_mcp-0.1.0.dist-info/licenses/LICENSE +21 -0
- src/__init__.py +13 -0
- src/auth.py +136 -0
- src/client.py +259 -0
- src/constants.py +26 -0
- src/exceptions.py +96 -0
- src/formatters.py +367 -0
- src/models.py +85 -0
- src/server.py +90 -0
- src/tools/__init__.py +15 -0
- src/tools/datasets.py +355 -0
- src/tools/queries.py +125 -0
- src/tools/workspaces.py +185 -0
- src/validation.py +40 -0
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: powerbi-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Model Context Protocol server for PowerBI REST API integration
|
|
5
|
+
Project-URL: Homepage, https://github.com/gurvinder-dhillon/powerbi-mcp
|
|
6
|
+
Project-URL: Documentation, https://github.com/gurvinder-dhillon/powerbi-mcp#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/gurvinder-dhillon/powerbi-mcp
|
|
8
|
+
Project-URL: Issues, https://github.com/gurvinder-dhillon/powerbi-mcp/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/gurvinder-dhillon/powerbi-mcp/releases
|
|
10
|
+
Author: Gurvinder Dhillon
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: api,mcp,model-context-protocol,power-bi,powerbi
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: httpx>=0.28.1
|
|
23
|
+
Requires-Dist: mcp>=1.26.0
|
|
24
|
+
Requires-Dist: pydantic>=2.12.5
|
|
25
|
+
Requires-Dist: python-dotenv>=1.2.1
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# PowerBI MCP Server
|
|
29
|
+
|
|
30
|
+
[](https://pypi.org/project/powerbi-mcp/)
|
|
31
|
+
[](https://pypi.org/project/powerbi-mcp/)
|
|
32
|
+
[](https://opensource.org/licenses/MIT)
|
|
33
|
+
|
|
34
|
+
A 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.
|
|
35
|
+
|
|
36
|
+
> [!WARNING]
|
|
37
|
+
> **Security Best Practices**
|
|
38
|
+
> - Never commit credentials to version control
|
|
39
|
+
> - Store credentials in `.env` files (add to `.gitignore`)
|
|
40
|
+
> - Rotate client secrets regularly in Azure AD
|
|
41
|
+
> - Use least-privilege access (only grant necessary workspace permissions)
|
|
42
|
+
> - This server has read/write access to PowerBI datasets - use with caution
|
|
43
|
+
|
|
44
|
+
## ✨ Features
|
|
45
|
+
|
|
46
|
+
- **Query Your Data**: Run DAX queries to extract insights and analyze your PowerBI data directly through conversation
|
|
47
|
+
- **Discover Workspaces & Datasets**: Explore what data is available across your organization's PowerBI environment
|
|
48
|
+
- **Understand Data Models**: Get detailed schema information to know what tables, columns, and relationships exist
|
|
49
|
+
- **Natural Language to Insights**: Ask questions about your data and get answers without opening PowerBI
|
|
50
|
+
|
|
51
|
+
See all [available tools](#-available-tools) below.
|
|
52
|
+
|
|
53
|
+
## 💡 What Can You Do?
|
|
54
|
+
|
|
55
|
+
| Scenario | Example Prompt |
|
|
56
|
+
|----------|----------------|
|
|
57
|
+
| Explore available data | "What workspaces do I have access to?" |
|
|
58
|
+
| Discover reports | "What reports are available in my workspace?" |
|
|
59
|
+
| Understand data schema | "Show me the schema for dataset [dataset-name]" |
|
|
60
|
+
| Monitor data freshes | "When was this dataset last refreshed?" |
|
|
61
|
+
| Check parameters | "What parameters does this dataset accept?" |
|
|
62
|
+
| Query data with DAX | "Run a DAX query to get top 10 sales by region from [dataset]" |
|
|
63
|
+
| Analyze data quality | "What tables are in the Sales dataset?" |
|
|
64
|
+
| Extract insights | "Get the list of all measures in the Financial dataset" |
|
|
65
|
+
|
|
66
|
+
## 📋 Prerequisites
|
|
67
|
+
|
|
68
|
+
- **Azure AD Service Principal**: Required for authentication. Follow the [Azure AD Configuration](#-azure-ad-configuration) steps below to set this up.
|
|
69
|
+
|
|
70
|
+
## 🔐 Azure AD Configuration
|
|
71
|
+
|
|
72
|
+
Before installing the server, you need to set up an Azure AD application with PowerBI access.
|
|
73
|
+
|
|
74
|
+
### Create Azure AD App Registration
|
|
75
|
+
|
|
76
|
+
1. Go to [Azure Portal](https://portal.azure.com)
|
|
77
|
+
2. Navigate to **Azure Active Directory** > **App registrations**
|
|
78
|
+
3. Click **New registration**
|
|
79
|
+
4. Enter a name (e.g., "PowerBI MCP Server")
|
|
80
|
+
5. Click **Register**
|
|
81
|
+
|
|
82
|
+
### Get Credentials
|
|
83
|
+
|
|
84
|
+
After registration, collect these values:
|
|
85
|
+
|
|
86
|
+
- **Tenant ID**: Found in app Overview page (Directory ID)
|
|
87
|
+
- **Client ID**: Found in app Overview page (Application ID)
|
|
88
|
+
- **Client Secret**:
|
|
89
|
+
- Go to **Certificates & secrets**
|
|
90
|
+
- Click **New client secret**
|
|
91
|
+
- Add description and set expiry
|
|
92
|
+
- Copy the secret **Value** (you can only see this once!)
|
|
93
|
+
|
|
94
|
+
### Enable Service Principal in PowerBI
|
|
95
|
+
|
|
96
|
+
1. Go to [PowerBI Admin Portal](https://app.powerbi.com/admin-portal)
|
|
97
|
+
2. Navigate to **Tenant settings** > **Developer settings**
|
|
98
|
+
3. Enable **Service principals can use PowerBI APIs**
|
|
99
|
+
4. Add your app to the security group or enable for entire organization
|
|
100
|
+
5. Click **Apply**
|
|
101
|
+
|
|
102
|
+
> [!NOTE]
|
|
103
|
+
> Service principals can access workspaces where they've been granted explicit permissions (Admin, Member, or Contributor roles).
|
|
104
|
+
|
|
105
|
+
### Grant Workspace Access
|
|
106
|
+
|
|
107
|
+
For each workspace you want to access:
|
|
108
|
+
|
|
109
|
+
1. Go to the workspace in PowerBI
|
|
110
|
+
2. Click workspace settings (⚙️) > **Access**
|
|
111
|
+
3. Click **Add people or groups**
|
|
112
|
+
4. Search for your app name
|
|
113
|
+
5. Assign role: **Admin**, **Member**, or **Contributor**
|
|
114
|
+
6. Click **Add**
|
|
115
|
+
|
|
116
|
+
## 📦 Installation
|
|
117
|
+
|
|
118
|
+
### Method 0: From PyPI (Recommended)
|
|
119
|
+
|
|
120
|
+
Once published to PyPI, this is the simplest installation method.
|
|
121
|
+
|
|
122
|
+
Add the following to your MCP client configuration file:
|
|
123
|
+
|
|
124
|
+
**For Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"powerbi-mcp": {
|
|
130
|
+
"command": "uvx",
|
|
131
|
+
"args": ["powerbi-mcp"],
|
|
132
|
+
"env": {
|
|
133
|
+
"POWERBI_TENANT_ID": "your-tenant-id-here",
|
|
134
|
+
"POWERBI_CLIENT_ID": "your-client-id-here",
|
|
135
|
+
"POWERBI_CLIENT_SECRET": "your-client-secret-here"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**For Claude Code** (`./.mcp.json` in your project directory):
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"powerbi-mcp": {
|
|
148
|
+
"command": "uvx",
|
|
149
|
+
"args": ["powerbi-mcp"],
|
|
150
|
+
"env": {}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
When using Claude Code, create a `.env` file in your project directory (where you run Claude Code from):
|
|
157
|
+
|
|
158
|
+
```env
|
|
159
|
+
POWERBI_TENANT_ID=your-tenant-id-here
|
|
160
|
+
POWERBI_CLIENT_ID=your-client-id-here
|
|
161
|
+
POWERBI_CLIENT_SECRET=your-client-secret-here
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
> [!TIP]
|
|
165
|
+
> The `.env` file should be in your working directory, not where the server is installed.
|
|
166
|
+
|
|
167
|
+
**For OpenCode** (`~/.config/opencode/opencode.json`):
|
|
168
|
+
|
|
169
|
+
```json
|
|
170
|
+
{
|
|
171
|
+
"$schema": "https://opencode.ai/config.json",
|
|
172
|
+
"mcp": {
|
|
173
|
+
"powerbi-mcp": {
|
|
174
|
+
"type": "local",
|
|
175
|
+
"command": ["uvx", "powerbi-mcp"],
|
|
176
|
+
"enabled": true,
|
|
177
|
+
"env": {
|
|
178
|
+
"POWERBI_TENANT_ID": "your-tenant-id-here",
|
|
179
|
+
"POWERBI_CLIENT_ID": "your-client-id-here",
|
|
180
|
+
"POWERBI_CLIENT_SECRET": "your-client-secret-here"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
After adding the configuration, restart your MCP client.
|
|
188
|
+
|
|
189
|
+
### Method 1: Direct from GitHub (Development)
|
|
190
|
+
|
|
191
|
+
This method uses `uvx` to run the server directly from GitHub without cloning the repository.
|
|
192
|
+
|
|
193
|
+
Add the following to your MCP client configuration file:
|
|
194
|
+
|
|
195
|
+
**For Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
196
|
+
|
|
197
|
+
```json
|
|
198
|
+
{
|
|
199
|
+
"mcpServers": {
|
|
200
|
+
"powerbi-mcp": {
|
|
201
|
+
"command": "uvx",
|
|
202
|
+
"args": [
|
|
203
|
+
"--from",
|
|
204
|
+
"git+https://github.com/gurvinder-dhillon/powerbi-mcp@main",
|
|
205
|
+
"run-server"
|
|
206
|
+
],
|
|
207
|
+
"env": {
|
|
208
|
+
"POWERBI_TENANT_ID": "your-tenant-id-here",
|
|
209
|
+
"POWERBI_CLIENT_ID": "your-client-id-here",
|
|
210
|
+
"POWERBI_CLIENT_SECRET": "your-client-secret-here"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**For Claude Code** (`./.mcp.json` in your project directory):
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"mcpServers": {
|
|
222
|
+
"powerbi-mcp": {
|
|
223
|
+
"command": "uvx",
|
|
224
|
+
"args": [
|
|
225
|
+
"--from",
|
|
226
|
+
"git+https://github.com/gurvinder-dhillon/powerbi-mcp@main",
|
|
227
|
+
"run-server"
|
|
228
|
+
],
|
|
229
|
+
"env": {}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
When using Claude Code, create a `.env` file in your project directory (where you run Claude Code from):
|
|
236
|
+
|
|
237
|
+
```env
|
|
238
|
+
POWERBI_TENANT_ID=your-tenant-id-here
|
|
239
|
+
POWERBI_CLIENT_ID=your-client-id-here
|
|
240
|
+
POWERBI_CLIENT_SECRET=your-client-secret-here
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
> [!TIP]
|
|
244
|
+
> The `.env` file should be in your working directory, not where the server is installed.
|
|
245
|
+
|
|
246
|
+
The server will automatically load environment variables from the `.env` file in your current working directory.
|
|
247
|
+
|
|
248
|
+
**For OpenCode** (`~/.config/opencode/opencode.json`):
|
|
249
|
+
|
|
250
|
+
```json
|
|
251
|
+
{
|
|
252
|
+
"$schema": "https://opencode.ai/config.json",
|
|
253
|
+
"mcp": {
|
|
254
|
+
"powerbi-mcp": {
|
|
255
|
+
"type": "local",
|
|
256
|
+
"command": [
|
|
257
|
+
"uvx",
|
|
258
|
+
"--from",
|
|
259
|
+
"git+https://github.com/gurvinder-dhillon/powerbi-mcp@main",
|
|
260
|
+
"run-server"
|
|
261
|
+
],
|
|
262
|
+
"enabled": true,
|
|
263
|
+
"env": {
|
|
264
|
+
"POWERBI_TENANT_ID": "your-tenant-id-here",
|
|
265
|
+
"POWERBI_CLIENT_ID": "your-client-id-here",
|
|
266
|
+
"POWERBI_CLIENT_SECRET": "your-client-secret-here"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
After adding the configuration, restart your MCP client.
|
|
274
|
+
|
|
275
|
+
### Method 2: Local Clone (Contributors)
|
|
276
|
+
|
|
277
|
+
For contributors who want to run from a local clone:
|
|
278
|
+
|
|
279
|
+
1. Clone the repository:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
git clone https://github.com/gurvinder-dhillon/powerbi-mcp.git
|
|
283
|
+
cd powerbi-mcp
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
2. Install dependencies:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
uv sync
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
3. Add to your MCP client configuration:
|
|
293
|
+
|
|
294
|
+
**For Claude Desktop**:
|
|
295
|
+
|
|
296
|
+
```json
|
|
297
|
+
{
|
|
298
|
+
"mcpServers": {
|
|
299
|
+
"powerbi-mcp-local": {
|
|
300
|
+
"command": "uv",
|
|
301
|
+
"args": [
|
|
302
|
+
"--directory",
|
|
303
|
+
"/absolute/path/to/powerbi-mcp",
|
|
304
|
+
"run",
|
|
305
|
+
"run-server"
|
|
306
|
+
],
|
|
307
|
+
"env": {
|
|
308
|
+
"POWERBI_TENANT_ID": "your-tenant-id-here",
|
|
309
|
+
"POWERBI_CLIENT_ID": "your-client-id-here",
|
|
310
|
+
"POWERBI_CLIENT_SECRET": "your-client-secret-here"
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**For Claude Code** (`./.mcp.json` in your project directory):
|
|
318
|
+
|
|
319
|
+
```json
|
|
320
|
+
{
|
|
321
|
+
"mcpServers": {
|
|
322
|
+
"powerbi-mcp-local": {
|
|
323
|
+
"command": "uv",
|
|
324
|
+
"args": [
|
|
325
|
+
"--directory",
|
|
326
|
+
"/absolute/path/to/powerbi-mcp",
|
|
327
|
+
"run",
|
|
328
|
+
"run-server"
|
|
329
|
+
],
|
|
330
|
+
"env": {}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**For OpenCode** (`~/.config/opencode/opencode.json`):
|
|
337
|
+
|
|
338
|
+
```json
|
|
339
|
+
{
|
|
340
|
+
"$schema": "https://opencode.ai/config.json",
|
|
341
|
+
"mcp": {
|
|
342
|
+
"powerbi-mcp-local": {
|
|
343
|
+
"type": "local",
|
|
344
|
+
"command": [
|
|
345
|
+
"uv",
|
|
346
|
+
"--directory",
|
|
347
|
+
"/absolute/path/to/powerbi-mcp",
|
|
348
|
+
"run",
|
|
349
|
+
"run-server"
|
|
350
|
+
],
|
|
351
|
+
"enabled": true,
|
|
352
|
+
"env": {
|
|
353
|
+
"POWERBI_TENANT_ID": "your-tenant-id-here",
|
|
354
|
+
"POWERBI_CLIENT_ID": "your-client-id-here",
|
|
355
|
+
"POWERBI_CLIENT_SECRET": "your-client-secret-here"
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Replace `/absolute/path/to/powerbi-mcp` with the actual path to your cloned repository.
|
|
363
|
+
|
|
364
|
+
When 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).
|
|
365
|
+
|
|
366
|
+
## 🚀 Quick Start
|
|
367
|
+
|
|
368
|
+
Once installed, try these steps to get started:
|
|
369
|
+
|
|
370
|
+
1. **Verify Connection**: Ask Claude "What PowerBI workspaces do I have access to?"
|
|
371
|
+
2. **Explore Data**: "Show me the datasets in workspace [workspace-name]"
|
|
372
|
+
3. **View Schema**: "What tables are in dataset [dataset-name]?"
|
|
373
|
+
4. **Run a Query**: "Execute this DAX query on [dataset-name]: EVALUATE TOPN(10, Sales)"
|
|
374
|
+
|
|
375
|
+
## 🛠️ Available Tools
|
|
376
|
+
|
|
377
|
+
| Tool | Description | Key Parameters |
|
|
378
|
+
|------|-------------|----------------|
|
|
379
|
+
| `get_workspaces` | List accessible PowerBI workspaces | `top`, `detail` |
|
|
380
|
+
| `get_datasets` | Get datasets from workspace or "My workspace" | `workspace_id`, `detail` |
|
|
381
|
+
| `get_dataset` | Get detailed dataset info including schema | `dataset_id`, `workspace_id`, `detail` |
|
|
382
|
+
| `get_reports` | List PowerBI reports in workspace | `workspace_id`, `format`, `detail` |
|
|
383
|
+
| `get_refresh_history` | Get dataset refresh history with status/timestamps | `dataset_id`, `workspace_id`, `top`, `format` |
|
|
384
|
+
| `get_parameters` | List dataset parameters and their current values | `dataset_id`, `workspace_id`, `format`, `detail` |
|
|
385
|
+
| `query_dataset` | Execute DAX queries against dataset | `dataset_id`, `dax_query`, `workspace_id` |
|
|
386
|
+
|
|
387
|
+
### Tool Details
|
|
388
|
+
|
|
389
|
+
#### 1. get_workspaces
|
|
390
|
+
|
|
391
|
+
List PowerBI workspaces accessible to the service principal.
|
|
392
|
+
|
|
393
|
+
**Parameters:**
|
|
394
|
+
- `top` (optional): Number of workspaces to return (default: 100, max: 5000)
|
|
395
|
+
- `detail` (optional): Level of detail - "concise", "normal", or "full" (default: "normal")
|
|
396
|
+
|
|
397
|
+
#### 2. get_datasets
|
|
398
|
+
|
|
399
|
+
Get list of datasets from a workspace or "My workspace".
|
|
400
|
+
|
|
401
|
+
**Parameters:**
|
|
402
|
+
- `workspace_id` (optional): Workspace ID (omit for "My workspace")
|
|
403
|
+
- `detail` (optional): Level of detail - "concise", "normal", or "full" (default: "normal")
|
|
404
|
+
|
|
405
|
+
#### 3. get_dataset
|
|
406
|
+
|
|
407
|
+
Get detailed information about a specific dataset including schema and tables.
|
|
408
|
+
|
|
409
|
+
**Parameters:**
|
|
410
|
+
- `dataset_id` (required): Dataset ID
|
|
411
|
+
- `workspace_id` (optional): Workspace ID (omit for "My workspace")
|
|
412
|
+
- `detail` (optional): Level of detail - "concise", "normal", or "full" (default: "normal")
|
|
413
|
+
|
|
414
|
+
#### 4. get_reports
|
|
415
|
+
|
|
416
|
+
List PowerBI reports in a workspace.
|
|
417
|
+
|
|
418
|
+
**Parameters:**
|
|
419
|
+
- `workspace_id` (optional): Workspace ID (omit for "My workspace")
|
|
420
|
+
- `format` (optional): Response format - "markdown" or "json" (default: "markdown")
|
|
421
|
+
- `detail` (optional): Level of detail - "concise" or "normal" (default: "concise")
|
|
422
|
+
|
|
423
|
+
#### 5. get_refresh_history
|
|
424
|
+
|
|
425
|
+
Get refresh history for a dataset showing recent refresh operations.
|
|
426
|
+
|
|
427
|
+
**Parameters:**
|
|
428
|
+
- `dataset_id` (required): Dataset ID
|
|
429
|
+
- `workspace_id` (optional): Workspace ID (omit for "My workspace")
|
|
430
|
+
- `top` (optional): Number of refresh records to return (default: 5, max: 60)
|
|
431
|
+
- `format` (optional): Response format - "markdown" or "json" (default: "markdown")
|
|
432
|
+
|
|
433
|
+
#### 6. get_parameters
|
|
434
|
+
|
|
435
|
+
Get parameters defined in a dataset.
|
|
436
|
+
|
|
437
|
+
**Parameters:**
|
|
438
|
+
- `dataset_id` (required): Dataset ID
|
|
439
|
+
- `workspace_id` (optional): Workspace ID (omit for "My workspace")
|
|
440
|
+
- `format` (optional): Response format - "markdown" or "json" (default: "markdown")
|
|
441
|
+
- `detail` (optional): Level of detail - "concise" or "normal" (default: "normal")
|
|
442
|
+
|
|
443
|
+
**Note:** Not supported for datasets with SQL, Oracle, Teradata, SAP HANA DirectQuery connections or datasets modified via XMLA endpoint.
|
|
444
|
+
|
|
445
|
+
#### 7. query_dataset
|
|
446
|
+
|
|
447
|
+
Execute DAX queries against a dataset.
|
|
448
|
+
|
|
449
|
+
**Parameters:**
|
|
450
|
+
- `dataset_id` (required): Dataset ID
|
|
451
|
+
- `dax_query` (required): DAX query (must start with "EVALUATE")
|
|
452
|
+
- `workspace_id` (optional): Workspace ID (omit for "My workspace")
|
|
453
|
+
|
|
454
|
+
### DAX Query Examples
|
|
455
|
+
|
|
456
|
+
**Basic Table Scan:**
|
|
457
|
+
```dax
|
|
458
|
+
EVALUATE
|
|
459
|
+
'Sales'
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
**Top N with Sorting:**
|
|
463
|
+
```dax
|
|
464
|
+
EVALUATE
|
|
465
|
+
TOPN(10, 'Sales', [Amount], DESC)
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
**Filtered Results:**
|
|
469
|
+
```dax
|
|
470
|
+
EVALUATE
|
|
471
|
+
FILTER('Sales', [Year] = 2024)
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
**Calculated Columns:**
|
|
475
|
+
```dax
|
|
476
|
+
EVALUATE
|
|
477
|
+
ADDCOLUMNS(
|
|
478
|
+
'Sales',
|
|
479
|
+
"Profit", [Revenue] - [Cost]
|
|
480
|
+
)
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
**Aggregated Summary:**
|
|
484
|
+
```dax
|
|
485
|
+
EVALUATE
|
|
486
|
+
SUMMARIZE(
|
|
487
|
+
'Sales',
|
|
488
|
+
'Product'[Category],
|
|
489
|
+
"Total Sales", SUM('Sales'[Amount])
|
|
490
|
+
)
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
## ⚠️ Troubleshooting
|
|
494
|
+
|
|
495
|
+
### Authentication Errors
|
|
496
|
+
|
|
497
|
+
**Error: "Authentication failed"**
|
|
498
|
+
- Verify your `POWERBI_TENANT_ID`, `POWERBI_CLIENT_ID`, and `POWERBI_CLIENT_SECRET` are correct
|
|
499
|
+
- Check that the client secret hasn't expired in Azure AD
|
|
500
|
+
- Ensure the service principal is enabled in PowerBI Admin Portal
|
|
501
|
+
|
|
502
|
+
### Permission Errors
|
|
503
|
+
|
|
504
|
+
**Error: "403 Forbidden" or "Access denied"**
|
|
505
|
+
- Verify the service principal has been granted access to the workspace
|
|
506
|
+
- Check that the workspace role is Admin, Member, or Contributor (Viewer is not sufficient for API access)
|
|
507
|
+
- Confirm "Service principals can use PowerBI APIs" is enabled in PowerBI Admin Portal
|
|
508
|
+
|
|
509
|
+
### Connection Issues
|
|
510
|
+
|
|
511
|
+
**Server not appearing in MCP client**
|
|
512
|
+
- Restart your MCP client after adding the configuration
|
|
513
|
+
- Check the configuration file syntax (JSON must be valid)
|
|
514
|
+
- For local clone, verify the absolute path is correct
|
|
515
|
+
|
|
516
|
+
**Tools not working**
|
|
517
|
+
- Ensure credentials are configured
|
|
518
|
+
- Check the MCP client logs for detailed error messages
|
|
519
|
+
- For Claude Code, verify `.env` file is in the current working directory
|
|
520
|
+
|
|
521
|
+
## 📚 Resources
|
|
522
|
+
|
|
523
|
+
- [PowerBI REST API Reference](https://learn.microsoft.com/en-us/rest/api/power-bi/)
|
|
524
|
+
- [Model Context Protocol](https://modelcontextprotocol.io/)
|
|
525
|
+
- [DAX Guide](https://dax.guide/)
|
|
526
|
+
- [Azure AD App Registration](https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app)
|
|
527
|
+
|
|
528
|
+
## 💬 Feedback and Support
|
|
529
|
+
|
|
530
|
+
- **Issues**: Report bugs or request features via [GitHub Issues](https://github.com/gurvinder-dhillon/powerbi-mcp/issues)
|
|
531
|
+
- **Discussions**: Ask questions in [GitHub Discussions](https://github.com/gurvinder-dhillon/powerbi-mcp/discussions)
|
|
532
|
+
- **Pull Requests**: Contributions welcome! See [DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md)
|
|
533
|
+
|
|
534
|
+
## 🤝 Contributing
|
|
535
|
+
|
|
536
|
+
See [DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md) for information about developing and contributing to this project.
|
|
537
|
+
|
|
538
|
+
## License
|
|
539
|
+
|
|
540
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
src/__init__.py,sha256=no4tpy-S1K5M_xvHAr2n1tfztf5sCPswk4vyFKNcKJo,270
|
|
2
|
+
src/auth.py,sha256=s95zUp1jQuhLIboif04pr7mYj0yc1HXsr0w5ohtgUzM,5189
|
|
3
|
+
src/client.py,sha256=LIjN9HLkLBTRkAiUgZG1m7oHJatTOxq9Yzcp6raGvlA,8454
|
|
4
|
+
src/constants.py,sha256=4AR_jHXIA-VDU7YS9seLhXJUFO76gGWMYHAK4-CgRjs,642
|
|
5
|
+
src/exceptions.py,sha256=PsFYsc0yYOc-hyMFqy4XzzEsxfRy7xKWoAv2VN-bFqI,3251
|
|
6
|
+
src/formatters.py,sha256=azdquj54MXtb8JqsU7VTb_N0RhZNBw6KOGrQp7AdDZ0,11579
|
|
7
|
+
src/models.py,sha256=xGI0SR8rn-vERCTgDXrmDJDDFZooU-rPsKOD1BpGUEs,3153
|
|
8
|
+
src/server.py,sha256=oe8xUUceRCkyWCZ-izmOSYNpY7ZxJvYOYpOMH-4SzLI,2310
|
|
9
|
+
src/validation.py,sha256=xPkSJRUXIcWJkjAuEwbyTH5g0mNllldX_j5oEy_Twpc,1077
|
|
10
|
+
src/tools/__init__.py,sha256=LgJrvd39cfZKSniIzikaZ2lWBdRGN6fxXLwy0mGUfEw,314
|
|
11
|
+
src/tools/datasets.py,sha256=StzZVYJ2lKcOMpjxHp3gSWId8Nr0_WXzcwEpsbvXw6s,13325
|
|
12
|
+
src/tools/queries.py,sha256=pcIpMiWsKWOI-hlxRNO4I22PKCgAxnRYQcEwmQR34mE,4631
|
|
13
|
+
src/tools/workspaces.py,sha256=kwdyFZoJ0Z9Uin2ZlIcRNzPIWYIBc5V0DkqQxTSh5og,6930
|
|
14
|
+
powerbi_mcp-0.1.0.dist-info/METADATA,sha256=Pu1dhmxyv3hjOvXcJDhR9AXWFgQDvbFBhRT-t7hdM8o,16397
|
|
15
|
+
powerbi_mcp-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
16
|
+
powerbi_mcp-0.1.0.dist-info/entry_points.txt,sha256=1JZP7VRLto88RhiWIvOiMJH99HFjlTxjbORHeP30zW8,47
|
|
17
|
+
powerbi_mcp-0.1.0.dist-info/licenses/LICENSE,sha256=5Pz2wuZa8pAiI4JjSlZaWU9HFycvgBDcuOh3OpjSpOY,1074
|
|
18
|
+
powerbi_mcp-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gurvinder Dhillon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
src/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""
|
|
2
|
+
PowerBI MCP Server
|
|
3
|
+
|
|
4
|
+
A Model Context Protocol server for interacting with PowerBI REST API.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__version__ = "0.1.0"
|
|
8
|
+
__author__ = "PowerBI MCP Contributors"
|
|
9
|
+
__description__ = "MCP server for PowerBI REST API integration"
|
|
10
|
+
|
|
11
|
+
from .server import mcp
|
|
12
|
+
|
|
13
|
+
__all__ = ["mcp"]
|