foundry-copilot-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@foundry-copilot-mcp Ask the agent to summarize last month's sales trends"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
foundry-copilot-mcp
Bring a Microsoft Foundry agent — and your Power BI semantic models — into GitHub Copilot Chat, over MCP.
Your agent already works in the Foundry playground. Your analysts already live in VS Code. This is the ~400 lines of glue in between, written to be read: three bridges, each one small enough to hold in your head.
Everything runs as the signed-in user, never a service principal. That is a design decision, not an omission — see Security.
The three bridges
1. A Foundry agent as a Copilot tool
The whole bridge, minus error handling:
project = AIProjectClient(endpoint=PROJECT_ENDPOINT, credential=DefaultAzureCredential())
client = project.get_openai_client(agent_name=AGENT_NAME) # pre-bound to your agent
reply = client.responses.create(input=prompt).output_textNo model name, no system prompt on the client. The instructions, tools and model deployment stay server-side in Foundry, so you change the agent in the portal and every user picks it up on their next message — no redeploy, no version drift across machines.
2. An MCP server that is also an MCP client
Plenty of people write MCP servers. Far fewer write a client — and that is where the interesting architecture lives. This server launches Microsoft's official Power BI modeling MCP server as a child process, speaks JSON-RPC to it over stdio, and re-exposes the result as one opinionated tool.
You get to add policy at the boundary: the child is launched --read-only by default, so no chain of LLM calls can quietly mutate a production model.
StdioMcpClient is generic — point it at any MCP server, not just this one.
3. Fabric GUIDs → names
The modeling server connects by name. What the user has in front of them is a Fabric URL full of GUIDs. So we resolve them against the Fabric REST API instead of asking people to go hunting for display names.
Related MCP server: powerbi-mcp
Tools exposed to Copilot
Tool | What it does | Writes? |
| Puts a question to your Foundry agent | no |
| Connects to a semantic model and summarises it | no |
| Shows the current DAX of one measure | no |
| Rewrites a measure | yes — needs |
| Turns the GUIDs in a Fabric URL into names | no |
Getting started
Requirements: Python 3.11+, VS Code with GitHub Copilot, az login done. Node.js only if you want the Power BI tools (it runs the official server via npx).
git clone https://github.com/Nambu89/foundry-copilot-mcp
cd foundry-copilot-mcp
python -m venv .venv
.venv/Scripts/activate # macOS/Linux: source .venv/bin/activate
pip install -r requirements.txt
cp .vscode/mcp.json.sample .vscode/mcp.json # then fill in your endpoint and agent nameCheck the Foundry connection before you trust it — and definitely before you demo it:
python -m foundry_mcp.server --selftest "Hello, who are you?"Then open VS Code, switch Copilot Chat to Agent mode, and the tools show up. Ask it something like "ask the agent what it can do" or "inspect the model in samples/sample-model".
No Foundry project yet? The Power BI and TMDL parts work standalone, and samples/sample-model is a small semantic model you can point them at.
Security
Four decisions worth copying into whatever you build:
The user's identity, not a service principal. DefaultAzureCredential and the modeling server's interactive sign-in mean every read runs as the person asking. Row-level security therefore applies. Wire a service principal in and RLS is silently bypassed — users see rows they should not, with no error to warn you. That is the quietest data leak on this list.
Read-only by default. The one writing tool (update_measure_dax) needs an explicit confirm=True, and shows the current and proposed DAX first so a human can compare them.
Validation stays with the engine. Measure updates go through the official server's measure_operations/Update, so the tabular engine rejects invalid DAX. Hand-patching TMDL text would happily write a broken model.
No secrets in the repo. Configuration is environment variables in .vscode/mcp.json, which is gitignored. Only .vscode/mcp.json.sample is tracked.
Tests
pytest21 tests, no network, no Azure, no Node.js — including fake MCP servers that exercise the real JSON-RPC framing, the notification handling and the timeout.
Talk
This repo backs a talk on connecting Microsoft Foundry agents to Copilot Chat over MCP. Slides and video will be linked here after the conference.
Licence
MIT — see LICENSE.
Available Tools
5 toolsask_agent_toolA
Ask the Microsoft Foundry agent a question and return its answer.
Use this for anything the agent is specialised in — its instructions, knowledge and tools all live server-side in Foundry, so you do not need to know how it works. Pass the user's request in plain language.
Do NOT use this to read a Power BI model: inspect_model does that directly and faster.
Inputs: prompt (required). Returns: result
inspect_modelA
Connect to a Power BI semantic model and summarise what is in it.
Accepts either a Fabric workspace and semantic model (by display name OR by the GUIDs from
the Fabric URL), or the path to a local PBIP / .SemanticModel folder.
Read-only: it never modifies the model. Authentication is the user's own, so their
permissions and row-level security apply. Run this before show_measure.
Inputs: model, folder, workspace. Returns: result
resolve_fabric_idsA
Turn the GUIDs in a Fabric URL into the display names the tools need.
Use when the user pastes a Fabric Studio link instead of typing names.
Inputs: workspace_id (required), model_id. Returns: result
show_measureA
Show the current DAX expression of one measure, and the table it belongs to.
Call inspect_model first. Accepts Table[Measure], [Measure] or just the measure name,
so you can paste a reference straight from an analysis report.
Inputs: measure (required), model_label. Returns: result
update_measure_daxA
Write a new DAX expression for a measure. MODIFIES THE MODEL.
Read-only is the default everywhere else in this server; this is the one exception, and it is
opt-in twice over: the caller must pass confirm=True, and the user needs write access
(Contributor plus a read/write XMLA endpoint). Always show the user the current expression
with show_measure and get their agreement before calling this.
The tabular engine validates the DAX, so an invalid expression is rejected rather than saved.
Inputs: measure (required), new_expression (required), confirm, model_label. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clear role: agent questions, model inspection, measure lookup, measure update, and ID resolution. The only potential ambiguity is ask_agent_tool could be used for model tasks, but its description explicitly directs direct inspection to inspect_model.
All tools follow a consistent verb_first snake_case pattern (ask_, inspect_, show_, update_, resolve_). Names clearly indicate action and target.
5 tools is ideal for a focused server—enough to cover core operations without bloat.
Covers inspect and update workflows for measures, but lacks create/delete measure operations. The agent can fill gaps, but as a direct tool surface it is slightly incomplete.
Related MCP Connectors
Forge designed Power BI projects (.pbip) from your agent, bound to your own semantic model.
Governed BI MCP. Ask questions of live company data and list workspace sources via OAuth.
Official Microsoft MCP Server to query Microsoft Entra data using natural language
GitHub Copilot MCP: code, repo, PR, workflow tools for AI assistants.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to interact with Microsoft Fabric and Power BI services through the Model Context Protocol. Users can manage workspaces, execute DAX queries, refresh datasets, and create Fabric notebooks using natural language.69 npm2MIT
- FlicenseNot gradedqualityDmaintenanceEnables interaction with Power BI and Fabric through MCP tools, including workspace discovery and semantic model queries, with an agent loop and HTTP endpoints for Next.js backends.-
- AlicenseNot gradedqualityDmaintenanceEnables natural language interaction with Power BI Desktop via MCP, allowing DAX authoring, measure optimization, and model inspection.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to securely connect to your own Power BI or Fabric tenant using your Azure identity, with tools to inspect workspaces and models, run read-only DAX, validate and deploy your own reports, take page screenshots, and enforce guardrails that protect shared resources.1MIT