Install
$ agentstack add mcp-d0nk3yhm-pbix-mcp ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
pbix-mcp
[](https://github.com/d0nk3yhm/pbix-mcp/actions/workflows/ci.yml) [](https://pypi.org/project/pbix-mcp/) [](https://pypi.org/project/pbix-mcp/) [](https://www.python.org/downloads/) [](https://opensource.org/licenses/MIT)
An MCP server for creating, reading, writing, and evaluating Power BI .pbix and .pbit files — no Power BI Desktop required. The entire PBIX binary format has been independently reversed and reimplemented in pure Python — no templates, no skeletons, no Microsoft binaries. Generated files open in PBI Desktop with full interactivity: view data, add measures, create visuals, and refresh — verified with PBI Desktop March 2026.
Exposes 101 tools covering report creation (all 6 data types, cross-table relationships, CSV/SQLite/SQL Server/MySQL/PostgreSQL/Excel/JSON/Azure SQL data sources, DirectQuery, and DAX measures), layout editing, visual management, bookmarks, custom visuals, field parameters, calculation groups, TMDL export, incremental refresh, DAX evaluation (156 functions), RLS security, and binary format internals.
See [CHANGELOG.md](CHANGELOG.md) for version history.
Try It
Generate a complete 3-page Northwind Analytics Dashboard in under a second:
pip install pbix-mcp
python examples/create_showcase.py
Creates a PBIX with 6 tables, 5 relationships (including chained cross-table lookups), 4 DAX measures, 3 pages, and 14 visuals. Open showcase_northwind.pbix in Power BI Desktop — everything works: slicers, cross-filtering, drill-through.
Quick Start
git clone https://github.com/d0nk3yhm/pbix-mcp.git
cd pbix-mcp
pip install -e .
Claude Desktop / Claude Code
Add to your MCP config file:
| Platform | Config file | |----------|------------| | Claude Desktop (macOS) | ~/Library/Application Support/Claude/claude_desktop_config.json | | Claude Desktop (Windows) | %APPDATA%\Claude\claude_desktop_config.json | | Claude Code | ~/.claude/settings.json (Linux/macOS) or %USERPROFILE%\.claude\settings.json (Windows) |
{
"mcpServers": {
"powerbi-editor": {
"command": "pbix-mcp-server"
}
}
}
> Windows note: If pbix-mcp-server is not on PATH, use the full Python path: > ``json > { > "mcpServers": { > "powerbi-editor": { > "command": "python", > "args": ["-m", "pbix_mcp.cli"] > } > } > } > ``
Codex Desktop (OpenAI)
pip install git+https://github.com/d0nk3yhm/pbix-mcp.git- Open Codex Desktop → Settings → MCP → Add Server
- Configure:
- Name:
powerbi-editor - Command:
pbix-mcp-server - Arguments: (leave empty)
Generic MCP (stdio)
pbix-mcp-server
# With debug logging:
pbix-mcp-server --log-level debug
Format Reversal Status
Every layer of the PBIX binary format has been independently reversed and reimplemented. No templates, skeletons, or Microsoft binaries are used.
| Layer | Status | Implementation | |-------|--------|----------------| | PBIX ZIP shell | Reversed | Version, ContentTypes, DiagramLayout, Settings, Metadata — generated constants | | Report/Layout JSON | Reversed | Pages, visuals, data bindings, filters — _build_layout() | | ABF binary container | Reversed | 72-byte signature, BackupLogHeader, VirtualDirectory, BackupLog — build_abf_clean() | | XMLA Load document (db.xml) | Reversed | 28 xmlns namespaces, CompatibilityLevel=1550, TabularMetadata — generate_db_xml() | | CryptKey.bin | Constant | 144-byte RSA key BLOB (Microsoft crypto format; GUID-independent constant) | | Metadata SQLite | Reversed | 68 system tables matching PBI March 2026 schema — create_empty_metadata_db() | | VertiPaq column storage | Reversed | IDF (bit-packed), IDFMETA (segment stats), dictionary (Long/Real/String), HIDX (hash index) | | H$ attribute hierarchies | Reversed | NoSplit POSTOID + IDTOPOS for all cardinalities | | R$ relationship indexes | Reversed | NoSplit INDEX encoding with +3 DATAIDOFFSET padding and 1-based row indices (verified byte-exact against PBI Desktop ground truth) | | XPress9 compression | Reversed | Custom compress/decompress with reversed chunk framing, headers, and multi-thread format; core algorithm via xpress9-python (MIT) |
The only non-generated artifact is the 144-byte CryptKey constant. This is a Microsoft RSA key BLOB that requires rskeymgmt infrastructure to generate. The key is GUID-independent — any valid key works with any database ID. Random bytes produce PFE_INVALID_CRYPT_KEY.
Stability
| Feature | Status | Notes | |---------|--------|-------| | PBIX creation | Stable | Multi-table with all 6 data types, relationships, H$ hierarchies, and measures. Generated files support full PBI Desktop editing (add measures, columns, visuals) | | Cross-table relationships | Stable | R$ system tables with NoSplit INDEX encoding (+3 padding, 1-based row indices); cross-table visuals, RELATED(), and cross-table filtering verified byte-exact against PBI Desktop ground truth | | Refreshable CSV sources | Stable | source_csv parameter creates M expressions referencing external CSV files; click Refresh in PBI Desktop to re-import | | SQLite database sources | Stable | source_db with ODBC driver; data imported at build, Refresh re-reads from DB | | SQL Server / MySQL / PostgreSQL database sources | Stable | source_db Import and DirectQuery for all. MySQL DQ requires MariaDB ODBC 3.1 (type: 'mariadb') | | Excel data sources | Stable | source_db with type: 'excel' — Import mode | | JSON/API data sources | Stable | source_db with type: 'json' — Import mode from REST APIs and JSON files | | Azure SQL data sources | Stable | source_db with type: 'azuresql' — Import and DirectQuery | | Data source switching | Stable | pbix_update_data_source — lightweight connection string change without full DataModel rebuild. Switch between SQL Server, PostgreSQL, MySQL, CSV, Excel, JSON, SQLite, Azure SQL. Switch Import/DirectQuery mode. Verified with live MSSQL→PostgreSQL→CSV roundtrip | | DirectQuery mode | Stable | mode='directquery' with SQL Server, PostgreSQL, and MySQL (via MariaDB ODBC 3.1) — live database queries, no refresh needed | | VertiPaq table data write | Stable | Create and roundtrip (settabledata, updatetablerows, replacevalue) via full builder rebuild | | Data export | Stable | pbix_export_table_csv, pbix_export_all_tables_csv — export any table(s) to CSV, all rows, proper quoting, ISO dates | | Data search & query | Stable | pbix_find_value across tables, pbix_query_table SQL-like WHERE/AND/OR/LIKE/IN/ORDER BY, pbix_table_stats profiling, pbix_data_diff row-level file comparison | | Roundtrip DataModel modify | Stable | Add/remove tables, relationships, measures on existing files. Metadata-only changes (measures, RLS, column properties) use binary splice for PBI Desktop files; structural changes use full builder rebuild | | H$ attribute hierarchies | Stable | NoSplit POSTOID + IDTOPOS for all cardinalities; MaterializationType=0 | | Report layout read/write | Stable | Pages, visuals, filters, positions, bookmarks | | Visual add/remove | Stable | Cards, charts, shapes/buttons, images (auto-embed local files via sourcePath), textboxes, slicers — with full data bindings, bounds clamping, and ResourcePackageItem image references | | Visual formatting | Stable | pbix_format_visual — human-readable API for titles, backgrounds, borders, drop shadows, padding, spacing, data labels, legend, axis, colors, table alternating row colors (backColorPrimary/Secondary, fontColorPrimary/Secondary), grid line colors, and 25+ more categories. Per-series/category dataColors with auto-generated selectors. Ground truth validated against PBI Desktop | | Color extraction & recolor | Stable | pbix_extract_colors scans themes + all visuals. pbix_recolor replaces hex + ThemeDataColor refs, auto-extends palette, injects per-series/category chart colors, generates themed table rows, strips borders and pie/donut backgrounds, hides card titles (shows categoryLabels), fixes text contrast (WCAG 2.0) including theme foreground, chart axis/legend/labels, table rows, and card calloutValue | | Visual property editing | Stable | Dot-path and full JSON | | DAX measure CRUD | Stable | Add, modify, remove via binary splice (PBI Desktop files) or full builder rebuild. Sequential adds supported with automatic MAXID tracking | | DAX evaluation (156 functions) | Stable API | Best-effort semantic parity — stable API, practical evaluation for common DAX patterns; see accuracy notes below | | Metadata SQL read/write | Stable | Full SQLite access to tables, columns, relationships | | Default slicer filter extraction | Stable | Legacy Layout JSON and PBIR format | | Table data read | Stable | Native VertiPaq decoder — all materialized tables (no external dependencies) | | Calculated table evaluation | Stable | DATATABLE, GENERATESERIES, CALENDAR, field parameters | | XPress9 decompress/recompress | Stable | Byte-exact round-trip verified | | ABF archive manipulation | Stable | List, extract, replace internal files | | DataMashup (M code) editing | Stable | Read/write Power Query expressions | | File save/repack | Stable | Auto-backup on overwrite, SecurityBindings auto-removed, optional MSIP sensitivity label stripping | | Calculated column evaluation | Beta | Per-row DAX expression evaluation; tested with synthetic data | | Password extraction | Beta | Regex scan of DAX measures for embedded passwords | | Row-Level Security (RLS) | Stable | Read, write, and evaluate RLS roles. set_rls_role uses binary splice — roles persist across save/reopen. MAXID-based ID allocation. Verified on PBI Desktop files | | Bookmark creation | Beta | Create/remove bookmarks with page targeting and visual visibility state | | Field Parameters | Stable | Create field parameter tables via pbix_datamodel_add_field_parameter — uses full DataModel rebuild for VertiPaq storage | | Calculation Groups | Stable | Create calculation groups via pbix_datamodel_add_calculation_group — table with CalculationItem DAX expressions, Partition Type=7, DiscourageImplicitMeasures enforced | | TMDL Export | Stable | Export data model as Git-friendly TMDL text files via pbix_export_tmdl. Validated with Adventure Works DW 2020 — correct partition types, CrossFilteringBehavior, model properties, shared expressions | | PBIP Export | Stable | Convert PBIX to PBIP (Power BI Project) folder structure via pbix_export_pbip — full TMDL semantic model + report layout + static resources, ready for Git | | Perspectives | Stable | Create/list/remove perspectives via pbix_add_perspective, pbix_get_perspectives, pbix_remove_perspective | | User Hierarchies | Stable | Create/list/remove drill-down hierarchies via pbix_add_hierarchy, pbix_get_hierarchies, pbix_remove_hierarchy. Works with builder-created and PBI Desktop files | | Cultures & Translations | Stable | Add cultures, translate table/column/measure names via pbix_add_culture, pbix_add_translations, pbix_get_cultures, pbix_remove_culture | | Partition Management | Partial | List/remove partitions via pbix_get_partitions, pbix_remove_partition. pbix_add_partition blocked for PBIX (needs PartitionStorage in VertiPaq), works for PBIP/TMDL export | | Sensitivity Labels | Stable | Strip MSIP sensitivity labels via pbix_save(strip_sensitivity_label=True) | | Custom Visuals | Beta | Import .pbiviz packages via pbix_add_custom_visual, place with pbix_add_visual | | Incremental Refresh | Stable | pbix_set_incremental_refresh / pbix_get_incremental_refresh — configure archive/refresh windows with change detection. Requires data source (sourcecsv/source_db); embedded-only files cannot use incremental refresh (same as PBI Desktop) | | Report diff (pbix_diff) | Stable | Compare two PBIX files — tables, columns, measures, relationships, pages/visuals, data sources, theme colors. Shows added/removed/changed | | Report documentation (pbix_document) | Stable | Auto-generate full report documentation (markdown + .docx) — tables, columns, measures, relationships, data sources, pages/visuals, RLS roles, theme colors | | Performance analysis (pbix_performance) | Stable | Flags oversized tables, empty tables, wide schemas, high-cardinality strings, complex measures, inactive/bidirectional relationships, orphaned tables | | Diagnostic tool (pbix_doctor) | Stable | 17-point comprehensive diagnostic — data sources, storage modes, columns, relationships, measures, RLS, VertiPaq row counts, table/storage consistency, referential integrity, Expression/DataMashup consistency, MAXID |
Known Limitations
- DAX engine is best-effort — designed for practical evaluation, not semantic parity with Analysis Services. Unsupported functions return
Nonewith status"unsupported", circular references raiseDAXEvaluationError. See [docs/supported-dax.md](docs/supported-dax.md) for full details. - PBIR format — PBI Desktop (March 2026) has rendering bugs with PBIR decomposed format. PBIP export uses legacy report format (version 1.0) which works reliably.
- 1 out of 204 tested measures returns BLANK (requires per-employee RANKX visual row context)
- Performance — tables >100K rows trigger a warning; the DAX engine operates on in-memory Python data
- Opening existing DirectQuery files — layout, measures, and metadata editing work; DAX evaluation and table reads return clear errors since data lives in the remote source (this is inherent to DirectQuery — the data isn't in the file)
- Creating DirectQuery files — fully working with SQL Server (LocalDB), PostgreSQL 16, and MySQL 9.6 (via MariaDB adapter); requires a running database server and initial data snapshot
- CryptKey.bin — the 144-byte RSA key BLOB cannot be generated without Microsoft's crypto infrastructure (
rskeymgmt). A known-valid GUID-independent constant is used. - Embedded VertiPaq data — verified working with 11 tables, 72 columns, 13 relationships, 121K+ rows (Adventure Works DW 2020) and 6 tables, 36 columns, 5 relationships, 25 rows, 3 pages, 14 visuals (Northwind showcase)
- RLE encoding — disabled in the VertiPaq encoder (pure bitpack used). Slightly less space-efficient but correct
- Adding partitions to PBIX —
pbix_add_partitionis blocked for PBIX files (needs PartitionStorage in VertiPaq). Works for PBIP/TMDL export. Reading and removing existing partitions works. - Full DataModel rebuild —
set_table_data,update_table_rows,add/remove_relationship,remove_tabletrigger a full DataModel rebuild via the builder pipeline. Most other tools (add_measure,modify_measure,modify_column,set_rls_role,add_perspective,add_culture,add_translations,update_data_source, etc.) use a lightweight metadata-only path.
Tools (101)
Create & File Management (5)
pbix_create · pbix_open · pbix_save · pbix_close · pbix_list_open
Report Layout & Visuals (21)
pbix_add_visual · pbix_remove_visual · pbix_format_visual · pbix_get_pages · pbix_add_page · pbix_remove_page · pbix_get_page_visuals · pbix_get_visual_detail · pbix_get_visual_positions · pbix_set_visual_property · pbix_update_visual_json · pbix_get_layout_raw · pbix_set_layout_raw · pbix_get_filters · pbix_set_filters · pbix_get_default_filters · pbix_get_settings · pbix_set_settings · pbix_get_bookmarks · pbix_add_bookmark · pbix_remove_bookmark
DAX Engine (4)
pbix_evaluate_dax · pbix_evaluate_dax_per_dimension · pbix_evaluate_calculated_columns · pbix_clear_dax_cache
DataModel Read (16)
`pbix
…
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: d0nk3yhm
- Source: d0nk3yhm/pbix-mcp
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.