Edit

Share via


Consume Fabric data agent as a model context protocol server in Visual Studio Code

The Model Context Protocol (MCP) server is an emerging standard in the AI landscape that allows AI systems to discover and interact with external tools in a structured way. It plays a critical role in enabling AI models to access and use external knowledge and capabilities. By using MCP servers, AI systems can extend beyond their own data and reasoning. MCP servers provide a way to expose tools and services to AI systems in a consistent, discoverable manner. They help organizations integrate their knowledge into AI workflows.

Important

This feature is in preview.

Prerequisites

How it works

Fabric data agents can also function as MCP servers. When used as an MCP server, a Fabric data agent exposes a single tool. This tool represents the data agent itself, so external AI systems can interact with it through the MCP protocol. Because of this, it's important to provide a detailed and accurate description when publishing a Fabric data agent. The description becomes the tool description for the MCP server. External AI systems use this description to determine when and how to invoke the data agent. A clear and comprehensive description ensures that the agent is correctly understood and can be effectively used in AI workflows.

The Fabric data agent as an MCP server is valuable for people who build or test their own AI systems. It allows them to connect directly to the data agent and access organizational data that lives in Fabric OneLake without having to switch between different tools or platforms. This capability makes it easier to integrate organizational knowledge into AI experiments and development workflows, all within a single environment.

Note

Currently, you can use the Fabric data agent MCP server only in VS Code.

Screenshot showing the data agent MCP server before publishing.

To get started, after publishing the data agent, go to the Settings of the agent and open the Model Context Protocol tab. Here you see the following information:

  • Data agent MCP server name
  • MCP server URL
  • Data agent MCP tool name
  • MCP server tool description

You can also download the mcp.json file from this tab. Use this file to configure the MCP server in VS Code.

Screenshot showing the data agent MCP server settings tab.

Setting up the MCP server in VS Code

  1. Open VS Code and select a folder to work in.

  2. Inside this folder, create a folder named .vscode.

  3. Inside the inner folder, create a file called mcp.json.

  4. VS Code automatically displays a blue Add Server button at the bottom right of the window.

    Screenshot showing the data agent MCP server json file.

  5. Select Add Server and select HTTP. You're prompted to enter a URL. You can copy the MCP server URL from the Setting tab of the data agent as was shown earlier.

    Screenshot showing the selection of HTTP.

    Screenshot showing to enter the URL for MCP server.

  6. Press Enter and provide a name for your MCP server. Use this name to display the data agent MCP server in your VS Code environment.

  7. VS Code attempts to authenticate with the server. Select Allow and sign in with your credentials.

    Screenshot showing to MCP file of the data agent.

Enabling Agent Mode

After adding the MCP server, enable Agent Mode in VS Code. Agent Mode lets VS Code act as an orchestrator interface, connecting your editor with MCP servers to interact with external tools like the Fabric data agent. To enable it:

  1. In VS Code, go to the Command Palette (Ctrl+Shift+P or Cmd+Shift+P).

  2. Search for Enable Agent Mode and select it.

  3. Confirm any prompts to activate the mode.

    Screenshot showing data agent in F studio code in agent mode.

When Agent Mode is active, select an orchestrator to handle your queries. Available orchestrators in public preview include GPT-5, GPT-4.1, Claude Sonnet 4.5, Gemini 2.5 pro, and many more. The orchestrator manages the flow of information between your queries in VS Code and the Fabric data agent MCP server.

Using the Fabric Data Agent MCP Server

When you enable Agent Mode and select the orchestrator:

  • You can start asking questions directly from VS Code.
  • The orchestrator routes your queries to the Fabric data agent MCP server.
  • The agent returns answers based on the knowledge it has access to, including organizational data stored in Fabric OneLake.

By functioning as an MCP server, the Fabric data agent allows users to integrate organizational knowledge into AI workflows, perform experiments, and develop AI solutions without leaving VS Code. This integration streamlines access to OneLake data and enhances productivity for developers and business users alike.