Introduction: What problem does pbi-cli solve?
If you have been following the wave of AI-powered developer tooling over the past year, you know that coding agents like Claude Code are starting to reshape how we write and maintain data models. But connecting those agents to Power BI has always been awkward copy-paste DAX into a chat window, screenshot a visual, or wrestle with MCP server JSON configs that require a running sidecar process.
pbi-cli (by MinaSaad1 on GitHub) changes the equation. It gives Claude Code a set of structured, token-efficient skills so that it can directly read and write Power BI semantic models and PBIR report files with no MCP server, no external binary, and sub-second execution.
The core idea: Install once, run three commands, then simply ask Claude in plain English: "Add a measure for Rolling 12-Month Revenue to the Sales table" and it does it.
The project ships 488 automated tests, DAX execution, visual CRUD operations, a REPL with tab-completion, and bundled Microsoft Analysis Services DLLs so you never chase down dependencies.
Architecture Overview
pbi-cli operates on two distinct layers that map neatly to the PBIP project structure:
- Semantic model layer Direct in-process .NET interop from Python to Power BI Desktop via TOM/ADOMD. No MCP server, no external binaries, sub-second execution.
- Report layer Reads and writes PBIR (Enhanced Report Format) JSON files directly. No connection needed. Works with .pbip projects.
Rather than spinning up an MCP server or calling a REST API, pbi-cli uses Python's .NET interop to talk to Power BI Desktop's Analysis Services instance in-process. Bundled inside the Python package (pbi_cli/dlls/) are the Microsoft Analysis Services client assemblies (AMO + ADOMD.NET).
For the report side, no live connection is needed. PBIR stores each visual as an individual visual.json file inside a predictable folder structure. pbi-cli reads and writes these directly works offline, works in CI/CD.
Installation & First-Time Setup
Requirements: Windows with Python 3.10+, and Power BI Desktop must be running with a .pbix file open before connecting. macOS/Linux not supported (TOM DLLs are Windows-only).
pipx install pbi-cli-tool pbi-cli skills install pbi connect
After those three commands, Claude Code discovers all 12 Power BI skills and you can start prompting immediately.
PATH note: pip install on Windows often places the pbi command outside your PATH. Use pipx to avoid this entirely.
Let Claude Handle the Whole Setup
"Clone https://github.com/MinaSaad1/pbi-cli, install it with pipx, run pbi-cli skills install, then connect to Power BI Desktop."
The 12 Power BI Skills for Claude Code
When you run pbi-cli skills install, it writes skill files into Claude Code's context directory. Each skill teaches Claude a different domain area — you never need to memorize CLI syntax.
Measurecreate, edit, list, and document DAX measuresTablemanage tables in the semantic modelColumnwork with column properties and data typesRelationshipcreate and modify relationshipsDax-executerun EVALUATE queries against the live modelVisual-addadd new visuals to PBIR report pagesVisual-get / visual-listinspect existing visualsVisual-updatemodify visual propertiesVisual-bind / visual-bulk-bindbind fields to visualsVisual-bulk-update / visual-bulk-deletebatch operations across pagesVisual-wherefilter visuals by property for targeted editsConnectmanage named connections to Desktop instances
Working with Semantic Models via TOM
Creating and Documenting Measures
"Create a measure called [Rolling 12M Revenue] in the Sales table. Use DATESINPERIOD to sum [Revenue Amount] over the trailing 12 months from the last date in context."
Bulk-Documenting a Model
"Add descriptions to all measures in the Sales table explaining what each one calculates. Use plain English, no jargon."
Claude will introspect the table, generate descriptions, and call pbi measure update for each one in a loop.
Running DAX Queries Inline
Token-efficient by design: pbi-cli only fetches the metadata Claude needs for each task, keeping token usage low even for large models.
pbi dax execute "EVALUATE TOPN(5, Sales, [Revenue Amount], DESC)"
Authoring PBIR Reports with Natural Language
The report layer requires no live connection it works purely on .pbip project files on disk. Ideal for CI/CD pipelines, automated formatting passes, or batch visual migrations.
Practical Report Prompts
Add a visual:
"Add a clustered bar chart to the Overview page showing Revenue by Region."
Bulk formatting:
"Set all card visual title font sizes to 14 across the entire report."
Bulk rebind:
"Rebind all visuals on the Sales page that reference OldMeasureName to NewMeasureName."
Cleanup:
"Find and delete any visuals that have no field bindings."
The Interactive REPL
For hands-on exploration without Claude Code, pbi-cli ships an interactive REPL with tab completion and a dynamic prompt showing your active connection.
$ pbi repl pbi> connect --data-source localhost:54321 Connected: localhost-54321 pbi(localhost-54321)> measure list pbi(localhost-54321)> dax execute "EVALUATE TOPN(5, Sales)" pbi(localhost-54321)> exit
History is stored in ~/.pbi-cli/repl_history. Tab completion works for all commands and flags.
pbi-cli vs MCP Servers — What to Choose?
| Aspect | MCP server approach | pbi-cli approach |
|---|---|---|
| Process model | Requires a running sidecar process | In-process .NET interop — no sidecar |
| Setup | JSON config file required | One-time skills install command |
| Latency | Network hop adds overhead | Sub-second execution |
| Offline use | Depends on server availability | PBIR editing works fully offline |
| Multi-agent | Works with any MCP-compatible client | Built specifically for Claude Code |
If you live in Claude Code and want the lowest-friction path, pbi-cli wins. If you need to share the integration across GitHub Copilot, Cursor, and Claude Desktop, powerbi-modeling-mcp or the power-bi-agentic-development marketplace are worth exploring alongside it.
Pro Tips & Real-World Prompts
1. Be specific about names
Quote exact table and measure names. Instead of "add a YTD measure", say "add a measure called [YTD Revenue] to the Sales table using TOTALYTD over [Revenue Amount]".
2. Verify with DAX after creating measures
"Create [YTD Revenue] as described, then run a DAX query to verify it returns a non-zero value for the current year."
3. Use REPL for exploration, Claude Code for authoring
Use measure list, table list, column list --table Sales in the REPL to map your model then switch to Claude Code for editing.
4. Source control your .pbip files
Every pbi-cli change is a clean git diff. Combine with a pre-commit hook running pbi measure list to validate the model after each edit.
5. Bulk operations save the most time
Tasks like "rename all measures starting with 'Calc_'" or "set every visual to font size 12" that take an hour in the Desktop UI — take seconds with pbi-cli.
Wrapping Up
pbi-cli takes a thoughtfully engineered approach to the AI agent + Power BI problem. By skipping the MCP sidecar and going directly in-process via .NET TOM, it achieves sub-second latency that makes agentic workflows feel genuinely responsive. The 12-skill structure gives Claude Code focused, domain-specific knowledge rather than a firehose of generic docs.
The project is new, so expect rough edges — particularly when Desktop isn't running or a PBIP project uses non-standard folder layouts. But the fundamentals are solid, the test coverage is real (488 tests), and the MIT license means the community can build on it.
Try it now:
pipx install pbi-cli-tool pbi-cli skills install pbi connect
Then ask Claude Code: "List all measures in my model and identify any that have no description." Results in under 10 seconds.
Useful Links
Have you tried pbi-cli? Share your experience in the comments below!