Maga do BI Technology and Innovation Get in touch

POWER BI

How to connect Codex to Power BI Desktop using MCP

By Karine Batista · · 4 min read

Install Microsoft’s MCP extension, locate the executable, and set up the Power BI Desktop connection directly in Codex.

Article cover 003

Hello, apprentices! 🧙

Have you ever come across impressive examples of what MCP and artificial intelligence can do, wanted to try them yourself, and then wondered: “Okay, but where do I start?”

That is exactly what we will explore today! In this tutorial, we will connect Codex to Power BI Desktop using MCP, from the initial setup through confirming the connection to the model.

We will use Microsoft’s official MCP server, which allows Codex to interact with the semantic model open in Power BI Desktop. We will go step by step so you can understand how it works and start exploring the integration yourself.

1. Prerequisites

  • Power BI Desktop, with a file open and its model loaded.
  • Codex, signed in to your account.
  • Visual Studio Code (VS Code) installed. We will install Microsoft’s extension in the next step.

2. Install the extension in VS Code

Open VS Code and select the Extensions icon in the left sidebar. You can also use Ctrl + Shift + X.

Search for Power BI. Select Power BI Authoring MCP Server, published by Microsoft, and click Install. Check the name and publisher to make sure you have the right extension.

Microsoft’s Power BI Authoring MCP Server extension in VS Code, with the Install button.

Figure 1 — In Extensions, find Microsoft’s Power BI Authoring MCP Server and click Install.

Wait for installation to finish. On the extension’s page, check for the Installed status. The Disable and Uninstall buttons also indicate that it is installed. If VS Code asks, click Reload.

The extension page in VS Code showing that installation is complete.

Figure 2 — Extension installed. We can now locate the executable Codex will use.

3. Copy the MCP executable path

Open File Explorer and paste this into the address bar:

%USERPROFILE%\.vscode\extensions

Find the powerbi-modeling-mcp extension folder. In this example, its name starts with analysis-services.powerbi-modeling-mcp-, followed by the version and platform. The name may vary with the installed version.

Open the server folder and find powerbi-modeling-mcp.exe. Right-click it and choose Copy as path. If you do not see that option, look under Show more options.

Keep this path in a local text file: you will use it in the command field in the next step.

The extension’s server folder, with powerbi-modeling-mcp.exe highlighted in purple.

Figure 3 — Find the executable highlighted in purple in the server folder.

4. Add the MCP server in Codex

In Codex, open Settings and search for MCPs. Select the matching option.

Codex settings with MCPs highlighted in purple.

Figure 4 — Open MCPs in Codex settings.

Click Add → Add MCP server.

The Add menu in Codex with the Add MCP server option.

Figure 5 — Select Add MCP server.

In the Connect to a custom MCP form, fill in the fields below.

The custom MCP form in Codex with Name, STDIO, and launch command fields.

Figure 6 — MCP server setup form in Codex.

  • Name: powerbi.
  • Type: STDIO.
  • Launch command: paste the full path to powerbi-modeling-mcp.exe from step 3, without quotation marks. Use the path on your own computer.
  • Arguments: enter only --readwrite.

In version 1.0.0, used in this tutorial, --readwrite starts the server and allows it to read and write to the model.

Leave Environment variables, Environment variable forwarding, and Working directory empty. When ~/code appears only as a placeholder, you do not need to enter it.

The powerbi MCP setup in Codex with the --readwrite argument, cropped at the sides.

Figure 7 — Name powerbi, STDIO type, executable path, and --readwrite argument.

Check the fields and click Save.

5. Restart Codex and connect to Power BI

Close and reopen Codex to load the configuration. Keep your Power BI Desktop file open.

In the conversation, send:

Connect to the open Power BI instance.

If more than one Power BI Desktop file is open, specify the one you want to use.

Approve tool execution requests when needed, and wait for confirmation that the connection to the correct model has been established.

Codex confirming its connection to the Tutorial_MCP file open in Power BI Desktop.

Figure 8 — Connection confirmed to the Tutorial_MCP file open in Power BI Desktop.

All set! The connection is configured.

6. References

Until our next adventure!

Karine Batista