Microsoft Fabric Updates Blog

Connecting AI Agents to Microsoft Fabric with GraphQL and the Model Context Protocol (MCP)

Have you ever wondered how to give AI assistants access to your organization’s data in a clean, structured way? The Model Context Protocol (MCP) is an open standard that creates a bridge between large language models and external tools, APIs, and data sources. Think of it as a universal translator that lets AI agents understand and interact with your systems seamlessly.

GraphQL is well-suited for MCP scenarios. In contrast to traditional REST APIs, which often require multiple calls and can return more data than is needed, GraphQL enables AI agents to request specific information in a single query. Additionally, the self-documenting feature of GraphQL schemas allows AI agents to independently identify available data and operations, increasing efficiency in interacting with APIs.

Customers want to connect AI applications to their Fabric data, be it on Databases, Warehouses or Lakehouses. While API for GraphQL already provides powerful querying capabilities, setting up that connection for AI agents might not be as straightforward as it could be. With this simple local MCP server fit for development purposes, developers can leverage AI agents to discover their Fabric data structure, understand what’s available, and query it by using natural language – all through the standardized MCP interface. Best of all, there is no need to define a separate MCP tool in the server for each GraphQL type, query or mutation. The MCP server introspects the GraphQL schema empowering AI agents to understand all available types and operations from the get-go.

Retrieving customer details using the introspected Microsoft Fabric GraphQL API schema in VSCode with GitHub Copilot and MCP Server.

Setting Up Your Own Fabric GraphQL MCP Server

Ready to connect your AI agents to Microsoft Fabric? Here’s how to get everything up and running.

What You’ll Need

  • Node.js installed on your machine.
  • Access to a Microsoft Fabric workspace with a GraphQL API enabled. You can create a new API following an easy tutorial for existing Fabric data sources or create a Fabric SQL database from scratch and link a GraphQL API to expose tables.
  • An Azure App Registration with proper permissions to access your Fabric workspace.
  • An MCP-compatible client (like VSCode with GitHub Copilot, Cursor, Claude, or any MCP client).

Step 1: Set up your Azure App Registration

You’ll need to configure Service Principal access for your Microsoft Entra app and Fabric workspace; this is crucial for authentication. You can follow the documentation to set this up properly – it includes enabling Service Principals in the Fabric Tenant Admin portal and granting the required permissions to your app.

Step 2: Enable GraphQL Introspection

It is important to note that introspection must be enabled on your Fabric GraphQL API for the MCP server to function properly. By default, introspection is disabled and must be activated by a Workspace Admin through the Fabric portal. Check out the Fabric API for GraphQL introspection documentation for the details.

Step 3: Download and Configure the MCP Server

Clone the MCP server from the Microsoft Fabric samples repository or download the ‘FabricGraphQL_MCP.js‘ file directly.

Navigate to the MCP directory and install the dependencies defined in the ‘package.json‘ file:

npm install

Next, create a ‘.env’ file with your Fabric connection details:

MICROSOFT_FABRIC_API_URL=https://your-fabric-endpoint/graphql
MICROSOFT_FABRIC_TENANT_ID=your_tenant_id_here
MICROSOFT_FABRIC_CLIENT_ID=your_client_id_here
MICROSOFT_FABRIC_CLIENT_SECRET=your_client_secret_here
SCOPE=https://api.fabric.microsoft.com/.default

Step 4: Start the MCP Server

node FabricGraphQL_MCP.js

The server starts listening on port 3000 in the localhost by default. You should see confirmation that it’s running and ready to accept MCP connections.

Step 5: Configure our MCP Client

The next step is to connect your AI client to the MCP server. The server operates as a local HTTP service, so you will need to configure your client to use ‘http://localhost:3000/mcp’.

For VSCode with GitHub Copilot, you can add the server in your MCP tools configuration:

"graphql-mcp-server": {
   "type": "http",
   "url": "http://localhost:3000/mcp"
}

For Cursor or Claude, the setup is similar – add the server in MCP Tools settings with the same URL.

Step 6: Test the Connection

Once everything is configured, restart your MCP client; remember this is the important workflow: before doing anything else, your AI assistant needs to introspect the schema first. Generate a prompt such as, ‘First, introspect the GraphQL schema to see what data is available.’

Once the schema is loaded, you can start asking natural language questions about your Fabric data:

  • ‘Show me the first 10 stock items with their colors and brands.’
  • ‘What’s the structure of the customer dimension table?’
  • ‘Can you query for customers and their purchase patterns?’

The AI agent will utilize the MCP server to identify your data structure through introspection, after which it will execute GraphQL queries within your Fabric workspace.

Querying GraphQL with natural language
MCP Tool automatically generating the GraphQL query to provide an answer

What makes this work so well?

The beauty of this setup is in its simplicity. Your AI agent doesn’t need to know anything about Fabric-specific APIs or authentication methods. It just sees a standard MCP interface that provides:

  • Schema discovery: the agent can explore what data is available and easily understand the available data structure.
  • Dynamic querying: can construct and execute GraphQL queries on the fly.
  • Simplicity: this uses a single MCP tool (‘query-graphql’) to execute any operation defined in the GraphQL schema. No need to define separate tools for each query or mutation, you have one tool to rule them all! (While this works well as a demo for generic use cases, you might want to define single purpose tools based on a specific GraphQL queries for more focused use cases.)
  • Web based integrations: the server uses HTTP transport, making it easier to use it as a starting point for more complex self-hosted client-server or web-based integrations.
  • Type safety: GraphQL’s strong typing helps the agent understand data types and relationships.
  • Efficient data retrieval: no over-fetching or under-fetching of data.

What’s Next?

This MCP server lays the groundwork for diverse AI-driven data interactions, combining GraphQL’s flexibility with MCP’s standardization. We look forward to seeing community developments on this platform.

Have you tried connecting AI agents to your Fabric data sources? What challenges have you run into? We’d love to hear about your experiences and any ideas for improving this integration, submit your feedback to Fabric Ideas.

The complete MCP server implementation is available in the Microsoft Fabric samples repository. Feel free to fork it, modify it, and make it your own!

Related blog posts

Connecting AI Agents to Microsoft Fabric with GraphQL and the Model Context Protocol (MCP)

November 4, 2025 by Misha Desai

We’re introducing a set of new enhancements for Data Agent creators — designed to make it easier to debug, improve, and express your agent’s logic. Whether you’re tuning example queries, refining instructions, or validating performance, these updates make it faster to iterate and deliver high-quality experiences to your users. New Debugging Tools View referenced example … Continue reading “Creator Improvements in the Data Agent”

November 3, 2025 by Arshad Ali

Additional authors – Madhu Bhowal, Ashit Gosalia, Aniket Adnaik, Kevin Cheung, Sarah Battersby, Michael Park Esri is recognized as the global market leader in geographic information system (GIS) technology, location intelligence, and mapping, primarily through its flagship software, ArcGIS. Esri empowers businesses, governments, and communities to tackle the world’s most pressing challenges through spatial analysis. … Continue reading “ArcGIS GeoAnalytics for Microsoft Fabric Spark (Generally Available)”