# Horizun PBI MCP [![CI](https://github.com/HorizunGroup/horizun-pbi-mcp/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/HorizunGroup/horizun-pbi-mcp/actions/workflows/ci.yml) [![PyPI](https://img.shields.io/pypi/v/horizun-pbi-mcp?cacheSeconds=3600)](https://pypi.org/project/horizun-pbi-mcp/) [![Python](https://img.shields.io/pypi/pyversions/horizun-pbi-mcp?cacheSeconds=3600)](https://pypi.org/project/horizun-pbi-mcp/) [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE) **Build and fix Power BI reports by describing what you want.** An MCP server that lets an AI assistant work on your Power BI Desktop models and `.pbip` projects: it runs read-only DAX, edits measures, tables and relationships, writes report pages, and re-reads every change to check it landed. It runs on your own Windows machine; there is no server of ours in the middle. ![How it works](https://raw.githubusercontent.com/HorizunGroup/horizun-pbi-mcp/main/docs/assets/como-funciona.png) **v2.2.1** · 140 tools · Windows · ChatGPT Desktop · Claude Desktop (free tiers work) · Claude Code · Codex New to the project? Start with [what it is, when to use it, and what it does not do](docs/POWER_BI_MCP.md). ## Requirements - Windows 10 or 11. - Power BI Desktop (free; this project does not install it). Without it the `.pbip` tools still work, but live DAX, refresh, capture and render checks do not. - One MCP client: ChatGPT Desktop or Claude Desktop (free tiers), Claude Code or Codex. No OpenAI or Anthropic API key and no paid plan. - Python 3.10 or newer. The ChatGPT one-paste installer and the Claude Desktop `.mcpb` provide it; for the Claude Code and Codex plugins install it first (`winget install -e --id Python.Python.3.12 --scope user`). ## Install No repository clone, DLL download or JSON editing is required. 1. Install the plugin with the line for your client below (Claude Code and Codex need Python first). 2. Restart the client. The first start sets up the runtime (a few minutes, no admin rights). Ask *"Is the Power BI MCP ready?"*: the assistant calls `pbi_install_status`. When it says `ready`, restart once more. 3. Confirm the 140 `pbi_*` tools appear, then try the first minute below. ### ChatGPT Desktop Run the verified one-paste installer from [`docs/INSTALL.md`](docs/INSTALL.md), restart ChatGPT Desktop, then open **Plugins → Personal** and install **Horizun PBI MCP**. No OpenAI API key is required. ### Claude Desktop Download the `.mcpb` from the [latest release](https://github.com/HorizunGroup/horizun-pbi-mcp/releases/latest) and double-click it. It will say the extension is **not verified by Anthropic**, as it does for any extension installed outside its directory, and let you continue. ### Claude Code ```powershell claude plugin marketplace add HorizunGroup/horizun-pbi-mcp claude plugin install horizun-pbi-mcp@horizun ``` ### Codex ```powershell codex plugin marketplace add HorizunGroup/horizun-pbi-mcp ``` Then open `/plugins`, pick the **Horizun** marketplace and install `horizun-pbi-mcp`. ## Your first minute 1. Open Power BI Desktop with any report. 2. Ask: *"List the Power BI models that are open and connect to the first one."* 3. Ask: *"Run a read-only DAX query that counts the rows in each table."* If step 2 lists your model, the connection works. ## Things worth asking for - *Create a year-over-year sales growth measure, format it as a percentage and validate it.* - *Audit this PBIP project and explain the highest-risk issues before changing anything.* - *This measure returns blank for December. Find out why.* - *Build a page with KPI cards, a monthly trend and a table by region, then check the layout.* - *Visuals broke after a column rename. Find them and propose a mapping to fix them.* - *Convert this .pbix to a .pbip project and validate the result.* - *Document every measure in the model and export it to Excel.* ## What it provides | Area | Capabilities | |---|---| | Live model | Discover Desktop sessions, run DAX, inspect metadata, refresh, and manage measures through TOM | | Semantic model | Read and edit TMDL tables, columns, measures, relationships and calculation groups; list roles | | Report authoring | Create pages and visuals, clone templates, arrange layouts, apply themes, bookmarks and interactions | | Conversion | Convert `.pbix` to `.pbip`, migrate supported structures and validate the result | | Quality | Audit models and reports, document schemas, detect broken references and normalize report structures | | Delivery | Export verified PDF, Excel and HTML artifacts; ingest SharePoint data read-only | See the [tool catalog](docs/TOOL_CATALOG.md) for all 140 tools and their risk classifications. ## Security and privacy **Runs locally.** The server is a process on your PC, under your Windows user. It talks to Power BI Desktop's engine on `localhost` and needs no account. There is no telemetry: its logs go to stderr or local files, with DAX, expressions and row data reduced to their size and secrets masked. **What leaves the PC.** - During setup or repair: the installer from this repository's GitHub release, Python packages from PyPI against a hash-locked requirements file, the Microsoft Analysis Services DLLs from NuGet and the PBIR JSON schemas from Microsoft. Each of these is pinned by version and checked by SHA-256 before use. If Python, Git or Node.js are missing, the installer gets them with winget, which applies its own checks. - At run time, only the two optional SharePoint tools reach the network: Microsoft Graph and the Microsoft Entra sign-in endpoint. They download files; they never upload your content. A refresh makes Power BI Desktop itself query the report's data sources, as it does when you click Refresh. - Whatever a tool returns goes to the AI client you connected, and from there to its model provider under that client's terms. **What it may change.** - Project files only inside the active project directory. Backups, recovery journals, exports and logs go to the server's own data folder (`%LOCALAPPDATA%\horizun-pbi-mcp` when installed). - Every project write is backed up first and re-read afterwards. Project files are not written while Power BI Desktop may have the project open. - Destructive tools require `confirm=true`. DAX runs read-only; anything the classifier does not recognize is refused. **Credentials.** None are stored or passed as tool parameters. The SharePoint tools read their app credentials from environment variables, and a generated Power Query with a credential embedded in it is refused. Details: [security model](docs/SECURITY.md) and [recovery guide](docs/RECOVERY.md). Report vulnerabilities privately as described in [SECURITY.md](SECURITY.md). ## Known limits - Power BI does not expose pages or visuals through its live local endpoint, so those are edited in PBIR files while Desktop is safely closed. - `mode="both"` is disabled for dual live/disk writes: Desktop being open and a PBIP project being safe to edit are mutually exclusive states. - The server does not publish to or refresh the Power BI Service. - Three PBIR schemas referenced by Power BI are not published by Microsoft; affected writes fail closed instead of guessing. - Report-file authoring needs a `.pbip` project with PBIR enabled. Node.js 20+ is only needed for the optional Microsoft PBIR validator. ## Small local models For Ollama models such as Qwen 3 4B/8B, set `HORIZUN_PBI_MCP_PROFILE=local` in the MCP server's environment and restart. You get 22 core tools with short replies; `pbi_find_tool` still finds the rest; set the profile to `full` and restart to use them. Details: [local profile](docs/TOOL_CATALOG.md#local-profile). ## Documentation | Document | Purpose | |---|---| | [Installation](docs/INSTALL.md) | Setup, repair, offline installation and MCP client registration | | [Tutorial](docs/TUTORIAL.md) | First connection through report authoring | | [Power BI MCP overview](docs/POWER_BI_MCP.md) | Use cases, boundaries, safety and first workflow | | [Tool catalog](docs/TOOL_CATALOG.md) | All tools, grouped by capability and risk | | [Architecture](docs/ARCHITECTURE.md) | Components, boundaries and invariants | | [Security](docs/SECURITY.md) | Threat model and operational guarantees | | [Validation](docs/VALIDATION.md) | TMDL/PBIR validation layers and known limits | | [Migration guide](docs/MIGRACION_1x_A_2.0.md) | Breaking changes from 1.x to 2.0 | | [Contributing](CONTRIBUTING.md) | Development workflow and pull-request requirements | ## Development ```powershell git clone https://github.com/HorizunGroup/horizun-pbi-mcp.git cd horizun-pbi-mcp python -m pip install -e . python scripts/fetch_libs.py python scripts/fetch_pbir_schemas.py python scripts/doctor.py ``` Before opening a pull request, run `python -m pytest -q`, `python scripts/doctor.py` and `python -m tests.contract_utils`. The MCP contract is frozen and checked against `tests/golden/tools_v1.json`. Real `.pbix`, `.pbip`, credentials, DLLs, outputs and backups are never committed. See [AGENTS.md](AGENTS.md) for the repository invariants. ## Learn to direct it Horizun Hub runs a Spanish-language course on using this MCP: [Opera agentes en Power BI](https://horizunhub.com/academia/power-bi-con-ia/?utm_source=github&utm_medium=readme&utm_campaign=horizun-pbi-mcp), with a verifiable certificate. New to agents? Level 1 of [Opera agentes de IA desde cero](https://horizunhub.com/academia/agentes-ia-desde-cero/?utm_source=github&utm_medium=readme&utm_campaign=horizun-pbi-mcp) is free with an account. ## Editions This repository is the Community edition, free under Apache 2.0. A Pro edition is available through Horizun Suite at [horizunhub.com](https://horizunhub.com). ## License Apache License 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE). ## MCP Registry Registry name: ``` mcp-name: io.github.HorizunGroup/horizun-pbi-mcp ```