This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
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.
Connecting_AI_Agents_to_Microsoft_Fabric_with_GraphQL_and_the_Model_Context_Prot
Ready to connect your AI agents to Microsoft Fabric? Here's how to get everything up and running.
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.
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.
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
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.
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.
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:
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.
Connecting_AI_Agents_to_Microsoft_Fabric_with_GraphQL_and_the_Model_Context_Prot
Connecting_AI_Agents_to_Microsoft_Fabric_with_GraphQL_and_the_Model_Context_Prot
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:
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.