Skip to main content
Glama

powerbi-mcp

Local Power BI MCP server — no tenant, no workspace, no admin.

Two things it does:

  • Read .pbix files without opening them (via pbixray): tables, columns, measures, relationships, Power Query and decoded rows. Works on .pbix, Analysis Services .abf and PowerPivot .xlsx.

  • Generate .pbip projects (the TMDL text format Power BI Desktop saves itself): build a semantic model from CSV or Excel files, add DAX measures and relationships, lay out report pages, then open the .pbip in Power BI Desktop and refresh.

Built for course-scale work: an instructor (or an AI agent) can hand out ready-made models and inspect submitted files, with no Power BI Service access at all. Everything runs locally; the server never touches the network beyond its own loopback port.

Quickstart

git clone https://github.com/veenetul/powerbi-mcp.git
cd powerbi-mcp
uv sync
uv run demo_local.py    # end-to-end: CSV star schema -> validated .pbip

Open the result (exports/CourseDemo/CourseDemo.pbip) in Power BI Desktop (File > Open report > Browse reports), press Refresh, and the data loads.

Related MCP server: pbi-mcp

Tools (20)

Tool

What it does

pbix_overview

model size, tables, rough row counts, object counts

pbix_schema

all columns with data types

pbix_measures

all DAX measures with expressions

pbix_relationships

all relationships (from/to, cardinality, active)

pbix_power_query

all M expressions

pbix_table_data

decoded rows of one table (max 500/call)

create_pbip_project

new project skeleton (<name>.pbip + report + model)

add_csv_table

new table loaded from a CSV, types inferred

list_excel_sheets

sheets of an .xlsx: rows, columns, headers

add_excel_table

new table loaded from one .xlsx sheet, types from Excel

add_measure

DAX measure with optional format string

add_relationship

relate tables (many side → one side)

add_date_table

calculated calendar table over a date column, marked as date table

add_page

add a report page, returns page id

add_visual

add a visual (card, slicer, donutChart, filledMap, stackedBarChart, …) with fields + pixel position

list_report

pages and visuals of a project

remove_visual / remove_page

delete a visual / page

get_pbip_summary

tables/columns/measures/relationships of a project

validate_pbip

structural checks; catches what would stop Desktop opening

List them all without a client: uv run list_tools.py.

Run the server

uv run powerbi-mcp      # stdio (what MCP clients spawn)
uv run powerbi-mcp-http # streamable HTTP on http://127.0.0.1:8003/mcp

Connect from an editor/agent

  • VS Code: .vscode/mcp.json → {"servers": {"powerbi": {"type": "stdio", "command": "uv", "args": ["run", "powerbi-mcp", "--directory", "<repo>"]}}}, then use the tools in Copilot agent mode.

  • Vibe / Claude-style clients: register with stdio transport, command uv run powerbi-mcp in the repo folder, or point a streamable-HTTP client at http://127.0.0.1:8003/mcp.

Sandbox

All file reads and writes are restricted to allowed roots (semicolon-separated):

  • MCP_POWERBI_ALLOWED_READ_ROOTS — default: the working directory

  • MCP_POWERBI_ALLOWED_WRITE_ROOTS — default: the working directory

Set both explicitly when you want the server confined to one data folder.

Layout produced

<name>/
├── <name>.pbip
├── .gitignore
├── <name>.Report/
│   ├── .platform
│   ├── definition.pbir
│   └── definition/
│       ├── report.json
│       ├── version.json
│       └── pages/pages.json + pages/<id>/page.json
└── <name>.SemanticModel/
    ├── .platform
    ├── .pbi/editorSettings.json
    ├── definition.pbism
    └── definition/
        ├── database.tmdl
        ├── model.tmdl
        ├── relationships.tmdl
        └── tables/<Table>.tmdl

Typical workflow

  1. Put source data (CSV or .xlsx) somewhere the sandbox allows. list_excel_sheets shows what is inside an .xlsx.

  2. Ask an MCP client: "create a Power BI project called X, add the orders sheet as table Orders, sellers as Sellers, relate them, add a Total measure, add a card showing Total".

  3. validate_pbip passes.

  4. Open <X>/<X>.pbip in Power BI Desktop, press Refresh, build visuals.

  5. Save As .pbix if that is the deliverable; afterwards pbix_overview / pbix_relationships can read the saved file back to verify it.

Updating a project

  • Incremental: call the MCP tools (add_measure, add_visual, …) or edit the TMDL/JSON files in VS Code while Desktop has the project open — Desktop shows an "Apply external changes" banner; click Apply. Run validate_pbip after structural changes.

  • Full rebuild: close Power BI Desktop first (it locks the folder), then rerun the script that generated the project.

Notes

  • The CSV path is baked into each table's M partition. Move the CSV and you must fix the partition.

  • pbix_measures returns whatever the file's metadata database contains; some older or odd files store no measures there.

  • Visual fields are DAX-style Table[Field]; positions are pixels on a 1280x720 page.

Requirements

Python 3.13 (uv sync downloads it if missing; pbixray ships wheels for 3.13), Power BI Desktop for the last mile (opening the .pbip). Works offline; pbixray decodes the DataModel locally.

License

MIT — see LICENSE.

Available Tools

20 tools
add_csv_tableAdd Csv TableA

Add a table to a project, loaded from a CSV via Power Query. Types are inferred from the CSV. pbip_path may be the .pbip file or the project folder. Refresh in Power BI Desktop loads the data.

Inputs: csv_path (required), pbip_path (required), table_name (required), encoding, +1 more. Returns: object

add_date_tableAdd Date TableA

Add a calculated calendar table (CALENDAR over MIN..MAX of date_column, e.g. 'Tilaukset[Tilauspäivämäärä]'), marked as date table, with Vuosi/Kuukausi/Kuukauden nimi/Neljännes/Vuosineljännes columns. Then relate it with add_relationship.

Inputs: pbip_path (required), date_column (required), table_name. Returns: object

add_excel_tableAdd Excel TableB

Add a table to a project, loaded from one sheet of an .xlsx file (types come from the Excel column types). sheet='' = first sheet.

Inputs: pbip_path (required), xlsx_path (required), table_name (required), sheet. Returns: object

add_measureAdd MeasureC

Add a DAX measure to a table of a project. Example: dax='SUM(Sales[NetAmount])', format_string='"$"#,##0.00'.

Inputs: dax (required), pbip_path (required), table_name (required), measure_name (required), +1 more. Returns: object

add_pageAdd PageB

Add a report page to a project. Returns the page_id for add_visual.

Inputs: pbip_path (required), display_name (required), width, height. Returns: object

add_relationshipAdd RelationshipC

Relate two tables in a project. from_column = MANY side, to_column = ONE side, DAX style like 'Sales[StoreId]'.

Inputs: pbip_path (required), to_column (required), from_column (required), cross_filter. Returns: object

add_visualAdd VisualA

Add a visual to a page. visual_type: card, slicer, donutChart, pieChart, filledMap, map, barChart / columnChart (stacked; "stackedBarChart" is accepted as an alias), clusteredBarChart, clusteredColumnChart, textbox, table, matrix. fields maps roles to fields, e.g. {"Y": "Tilaukset[Myynnin arvo]", "Category": "Kunnat[Kommun]", "Series": "Tilaukset[Tuoteryhmä]"}. Roles: card/slicer=Values; donut/pie=Category+Y; bar/column charts= Category+Series+Y; filledMap/map=Category(+Y/Size); textbox: options {"text": "..."}. x/y/width/height are pixels on a 1280x720 page. legend: "Top"|"Bottom"|"Left"|"Right". title: show header. options: extra PBIR objects merged into the visual.

Inputs: page (required), pbip_path (required), visual_type (required), x, +8 more. Returns: object

create_pbip_projectCreate Pbip ProjectA

Create a new Power BI project skeleton that opens in Power BI Desktop. Makes <parent_dir>// containing the .pbip, an empty report and an empty semantic model. Follow up with add_csv_table / add_measure / add_relationship, then validate_pbip.

Inputs: name (required), parent_dir (required), culture. Returns: object

get_pbip_summaryGet Pbip SummaryC

Tables, columns, measures, relationships and CSV sources of a project.

Inputs: pbip_path (required). Returns: object

list_excel_sheetsList Excel SheetsC

Sheets of an .xlsx file with row/column counts and headers.

Inputs: xlsx_path (required). Returns: object

list_reportList ReportC

Pages and visuals of a project (name, type, position, fields).

Inputs: pbip_path (required). Returns: object

pbix_measuresPbix MeasuresC

Every DAX measure in a .pbix: home table, name, expression.

Inputs: path (required). Returns: object

pbix_overviewPbix OverviewA

Inspect a .pbix (also .abf / PowerPivot .xlsx) without opening it: model size, tables, rough row counts, and counts of columns, measures and relationships. Start here when looking at a Power BI file.

Inputs: path (required). Returns: object

pbix_power_queryPbix Power QueryB

All Power Query (M) expressions of a .pbix, one per table.

Inputs: path (required). Returns: object

pbix_relationshipsPbix RelationshipsB

All relationships of a .pbix model: from/to table and column, cardinality, active.

Inputs: path (required). Returns: object

pbix_schemaPbix SchemaC

All columns of a .pbix model (table, column, data type). Optional table filter.

Inputs: path (required), table. Returns: object

pbix_table_dataPbix Table DataC

Decoded rows of one table in a .pbix (max 500 rows per call).

Inputs: path (required), table (required), max_rows. Returns: object

remove_pageRemove PageA

Delete a whole page (id or display name). Cannot remove the last page.

Inputs: page (required), pbip_path (required). Returns: object

remove_visualRemove VisualC

Delete a visual from a page by name.

Inputs: name (required), page (required), pbip_path (required). Returns: object

validate_pbipValidate PbipB

Structural validation of a project (required files, JSON, table refs, relationship columns, duplicate lineage tags). Empty issues = valid.

Inputs: pbip_path (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 20 tools

    Disambiguation4/5

    The set splits cleanly into .pbip authoring tools (add_*, remove_*, create_pbip_project, validate_pbip) and .pbix inspection tools (pbix_*), and descriptions make the file-format distinction explicit. The only mild overlaps are get_pbip_summary vs list_report vs pbix_overview, which are separated by target artifact, and add_date_table vs add_measure, which the description clarifies.

    Naming Consistency4/5

    Most tools follow a readable verb_noun snake_case pattern (add_measure, remove_page, list_report, validate_pbip). The pbix_* family uses a noun-first namespace prefix instead, and pbix_overview is a noun-style tool where others are verbs, but it functions as a coherent grouping convention rather than chaos.

    Tool Count4/5

    20 tools is slightly above the comfortable band, but the surface covers two genuinely distinct workflows (authoring .pbip projects and introspecting .pbix binaries), and each tool maps to a concrete operation. Very few tools look redundant or filler-ish, so the count is defensible.

    Completeness3/5

    Creation is well covered (project, tables, measures, relationships, date table, pages, visuals) plus validation and inspection, but the surface is add-heavy: there is no remove/update for measures, tables, or relationships, and no way to edit an existing visual. An agent that makes a modeling mistake has to fall back to manual file edits, which is a notable lifecycle gap.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables local Power BI project (.pbip) automation, including model (TMDL) and report (PBIR) layer manipulation, without cloud dependencies. Provides 56 tools for building, editing, and validating reports and measures through natural language prompts.
      13
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables querying open Power BI Desktop models locally, including discovering instances, listing tables and measures, and running DAX queries without cloud login or publishing.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables local authoring and editing of .pbip projects by exposing semantic model (TMDL) and report layout (JSON) operations, including measure updates, visual property queries, cross-layer renames, and structural validation, without cloud authentication.
      20
      GPL 3.0