loading…
Search for a command to run...
loading…
Enables exploring Microsoft Fabric / Power BI workspaces and semantic models, and executing ad-hoc DAX queries.
Enables exploring Microsoft Fabric / Power BI workspaces and semantic models, and executing ad-hoc DAX queries.
CodeQL Ask DeepWiki MIT License
Model Context Protocol (MCP) server for exploring Microsoft Fabric / Power BI workspaces and semantic models, and for executing ad‑hoc DAX queries.
🔐 Now with OAuth/Entra ID support! Seamlessly integrates with LibreChat and other OAuth-enabled clients using JWT validation and On-Behalf-Of flow.
| Tool | Purpose |
|---|---|
powerbi_list_workspaces() |
List workspaces the signed-in user can access. |
get_workspace_id(workspace_name) |
Get the workspace ID for a given workspace name. |
list_datasets_in_workspace(workspace_id) |
Enumerate datasets in a workspace. |
get_dataset_details(workspace_id, dataset_id) |
Retrieve dataset (semantic model) metadata and definition via Fabric. |
execute_dax_query(workspace_id, dataset_id, dax_query) |
Run a DAX query against a dataset using the Execute Queries API. |
This project uses Ruff for linting and formatting, and ty for type checking.
Install development dependencies:
uv sync --extra dev
Run Ruff linting:
uv run ruff check .
Run ty type checking:
uv run ty check mcp_for_powerbi/
uv sync
# Azure AD Configuration
PORT=3001
TENANT_ID=your-tenant-id
AUDIENCE=your-api-app-id
OBO_CLIENT_ID=your-obo-client-id
OBO_CLIENT_SECRET=your-obo-client-secret
# Authorization
REQUIRED_SCOPES=mcp.access
REQUIRED_ROLES=mcp.user
# Logging
LOG_LEVEL=info
python -m mcp_for_powerbi.server_http
Server starts on http://localhost:3001/mcp
Note: STDIO mode now requires OAuth integration. The server expects the Authorization header to be passed via the MCP client.
Run the server:
uv run mcp-for-powerbi
Both HTTP and STDIO modes now use Entra ID OAuth2 with:
mcpServers:
mcp-server-for-powerbi:
type: streamable-http
url: http://localhost:3001/mcp
requiresOAuth: true
oauth:
authorization_url: https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize
token_url: https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token
client_id: <client-id>
client_secret: <client-secret>
scope: "api://<api-app-id>/mcp.access openid profile offline_access"
redirect_uri: http://localhost:3080/api/mcp/mcp-server-for-powerbi/oauth/callback
{
"mcpServers": {
"mcp-for-powerbi": {
"name": "mcp-for-powerbi",
"type": "stdio",
"isActive": true,
"registryUrl": "",
"command": "uv",
"args": [
"run",
"--directory",
"<your_directory>/mcp-server-for-powerbi",
"mcp-for-powerbi"
]
}
}
}
Note: MCP client must pass OAuth token via Authorization header.
## Docker Deployment to Azure
- Login to Azure CLI and ACR
```bash
az login
az acr login --name <acr-name>
docker build -t <acr-name>.azurecr.io/mcp-server-for-powerbi .
docker run -it --rm -p 8080:8080 \
-e TENANT_ID=<tenant-id> \
-e AUDIENCE=<api-app-id> \
-e OBO_CLIENT_ID=<obo-client-id> \
-e OBO_CLIENT_SECRET=<obo-secret> \
<acr-name>.azurecr.io/mcp-server-for-powerbi
docker push <acr-name>.azurecr.io/mcp-server-for-powerbi
The server raises structured MCP tool errors with detailed suggestions:
Missing Authorization – OAuth token not provided in Authorization header.TokenExpired – obtain a fresh token (user tokens are short‑lived).Unauthorized (401) – token is invalid or lacks required permissions.Forbidden (403) – user lacks permission to the workspace or dataset.NotFound (404) – invalid workspace_id or dataset_id.BadRequest (400) – invalid parameters or DAX syntax errors.TooManyRequests (429) – rate limit exceeded (120 requests per minute).Timeout – network / API slowness (default timeout 30s).Each error includes:
This project is built on FastMCP v2 and draws inspiration from the following repositories:
Their approaches to semantic model surfacing and Power BI integration helped shape the tool design here.
This project is licensed under the MIT License. See the LICENSE file for details.
This project is an independent, open‑source MCP server for Microsoft Power BI. It is not affiliated with, endorsed by, or sponsored by Microsoft. “Power BI” is a trademark of Microsoft Corporation.
Выполни в терминале:
claude mcp add mcp-server-for-power-bi -- npx Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development