Skip to content

MCP

Model Context Protocol gives Copilot tools that are not just text editing. In this lab, MCP lets an agent inspect or edit a Power BI model through supported tools instead of guessing from file text only.

The repo has two MCP files:

FileUse
.vscode/mcp.jsonLocal VS Code workspace MCP.
config/cloud-agent-mcp.template.jsonTemplate for GitHub repository MCP settings used by cloud agent and code review.
.vscode/mcp.json
{
// MCP servers for the Contoso Pharmacy lab. No secrets or tenant details belong in this file.
// Versions are pinned; update them deliberately and re-run Lab 04 after an update.
"servers": {
// Power BI Modeling MCP: connects to the model open in Power BI Desktop, or to the PBIP folder.
// If you installed the Power BI Modeling MCP VS Code extension instead, disable this entry so
// the tools don't appear twice.
"powerbi-modeling-mcp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@microsoft/powerbi-modeling-mcp@0.5.0-beta.13", "--start"]
},
// Optional. Fabric MCP: Microsoft Fabric documentation and item definitions. Its docs tools
// work without a Fabric tenant. Start it from the MCP view only if you want it.
"fabric-mcp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@microsoft/fabric-mcp@1.4.0", "server", "start", "--mode", "all"]
}
}
}

The primary server is powerbi-modeling-mcp. It runs npx with @microsoft/powerbi-modeling-mcp@0.5.0-beta.13 and starts the MCP server. It can work with the PBIP folder and, on Windows, the model open in Power BI Desktop.

The optional fabric-mcp server runs @microsoft/fabric-mcp@1.4.0. The config says to start it from the MCP view only when you want it. Its docs tools can work without a tenant, but workspace operations need Fabric access.

Power BI Modeling MCP can inspect a PBIP project and connect to an open Power BI Desktop model. Use it when you need model structure, measures, relationships, or Desktop-backed semantic model operations.

Local prerequisites:

  • Windows.
  • Power BI Desktop installed.
  • The PBIP open in Desktop when you need live model operations.
  • Workspace trust accepted in VS Code.
  • MCP tool approval accepted for the specific tool call.

Fabric MCP is for tenant and workspace operations. It is not required for this lab. The core lab validates locally from files and generated CSVs, so learners do not need a Fabric tenant.

If you enable Fabric MCP, keep secrets out of source. Use environment variables, VS Code inputs, or the GitHub MCP secret flow.

config/cloud-agent-mcp.template.json
{
"$comment": "Template for Copilot cloud agent MCP configuration. Paste the mcpServers object into your repository's Settings > Copilot > Coding agent > MCP configuration. It contains no secrets. The cloud agent runs on Linux without Power BI Desktop. Power BI Modeling MCP ships a Linux build and can open a PBIP folder, but this lab hasn't verified that on the cloud agent, so it's read-only here and the cloud agent labs don't depend on it.",
"mcpServers": {
"powerbi-modeling-mcp": {
"type": "local",
"command": "npx",
"args": [
"-y",
"@microsoft/powerbi-modeling-mcp@0.5.0-beta.13",
"--start",
"--readonly"
],
"tools": [
"*"
]
},
"fabric-mcp": {
"type": "local",
"command": "npx",
"args": [
"-y",
"@microsoft/fabric-mcp@1.4.0",
"server",
"start",
"--mode",
"all"
],
"tools": [
"*"
]
}
}
}

GitHub repository MCP settings use a root mcpServers object. For cloud agent and code review, copy the template into the repository MCP settings UI and adjust only values your organization allows.

Cloud code review tools should be read-only. Do not give review tools write access to production services.

Use ${input:name} in .vscode/mcp.json when a value should be requested locally.

{
"inputs": [
{ "id": "fabricTenantId", "type": "promptString", "description": "Fabric tenant ID" }
]
}

Expect two prompts:

  1. Workspace trust or MCP server trust. You are allowing VS Code or GitHub to start the server.
  2. Tool approval. You are allowing a specific tool call.

Approve narrowly. If an MCP server can write, review the arguments before approving.

TaskBest path
Rename columns and add descriptions in TMDLFile edits plus validation are usually enough.
Inspect live model metadata from DesktopPower BI Modeling MCP.
Compare Desktop state to PBIP filesPower BI Modeling MCP plus validation scripts.
Work with Fabric workspace assetsFabric MCP, only with a tenant and approved auth.
Cloud PR reviewRepository MCP settings, read-only tools only.