MI

Microsoft Fabric MCP Server with LLM Integration

Accelerate work in your Microsoft Fabric tenant with an MCP server integrated with your favorite LLM models.

Quick Install
npx -y @aci-labs/ms-fabric-mcp

Overview

This repository provides a Model Context Protocol (MCP) server tailored for Microsoft Fabric environments, enabling Fabric tenants to route prompts and model calls to external large language model (LLM) providers. The server acts as a bridge between Fabric and your preferred LLMs, providing an API that Fabric (or other clients) can call to run completions, manage chat-style messages, and invoke extensions or “tools” that perform actions inside the tenant.

Using an MCP server is useful when you want to keep your Fabric tenant in control of model orchestration, auditability, and tooling integration rather than relying on a direct third-party connection. It simplifies common developer tasks like generating SQL/DAX, summarizing datasets, or automating pipeline steps by combining LLM responses with first-class Fabric operations.

Features

  • Adapter-based LLM provider support (can be configured to use OpenAI, Azure OpenAI, local models, or other providers)
  • REST API for model requests and chat-style interactions
  • Tool/plugin system to run tenant-side actions (queries, metadata lookup, job triggers) from model-driven prompts
  • Configurable authentication and auditing hooks suitable for enterprise Fabric tenants
  • Container-friendly deployment (Docker / docker-compose examples included)
  • Extensible codebase to add new tools, providers, or request filters

Installation / Configuration

Clone the repository, configure environment variables, and run the server either locally or in a container.

  1. Clone the repo
git clone https://github.com/aci-labs/ms-fabric-mcp.git
cd ms-fabric-mcp
  1. Create a .env file (example)
# .env
PORT=8080
LOG_LEVEL=info

# Choose provider: openai | azure_openai | local
MODEL_PROVIDER=openai

# OpenAI example
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxx

# Azure OpenAI example
AZURE_ENDPOINT=https://your-azure-endpoint.openai.azure.com
AZURE_API_KEY=xxxxxxxxxxxxxxxxxxxx
AZURE_DEPLOYMENT_NAME=text-davinci-003

# Fabric integration & auth (examples)
FABRIC_CLIENT_ID=your-client-id
FABRIC_CLIENT_SECRET=your-client-secret
FABRIC_TENANT_ID=your-tenant-id
  1. Run with Docker (recommended)
docker build -t ms-fabric-mcp:latest .
docker run -d \
  --name ms-fabric-mcp \
  --env-file .env \
  -p 8080:8080 \
  ms-fabric-mcp:latest
  1. Or run locally (Node/.NET runtime depending on repo)
# Example for Node-based implementation
npm install
npm run start

Environment variables and exact startup commands depend on the implementation in the repository. Refer to the repo’s startup script if you need framework-specific steps.

Available Tools / Resources

The server typically exposes these resources. The exact names and routes may vary by implementation; use this as a reference.

  • REST API endpoint (example): POST /mcp/v1/complete
  • Message payload: accepts chat-like messages (role/content) and provider/model hints
  • Tool hooks: functions that can be invoked by the model or orchestration layer, such as:
    • executeSql: run SQL or DAX queries against Fabric catalogs
    • describeTable: return schema/row-samples for a OneLake table
    • listNotebooks/reports: enumerate tenant artifacts
    • runPipeline: trigger a data pipeline or refresh
  • Admin endpoints: health, metrics, config reload

Example request body (chat + tool usage):

POST /mcp/v1/complete
{
  "model": "gpt-4",
  "messages": [
    {"role": "system", "content": "You are a Fabric data assistant."},
    {"role": "user", "content": "Write a SQL query to get monthly revenue by product."}
  ],
  "tools": ["executeSql", "describeTable"]
}

Use Cases

  • Generate SQL or DAX from natural language

    • Analyst asks: “Show monthly revenue for Q1 2026 by product category.” The MCP server sends the prompt to an LLM and optionally runs a verify/explain tool to produce a safe SQL query ready to execute against Fabric sources.
    • Example cURL:
      curl -X POST http://localhost:8080/mcp/v1/complete \
        -H "Content-Type: application/json" \
        -d '{"model":"gpt-4","messages":[{"role":"user","content":"Generate a SQL query to list monthly revenue by product."}], "tools":["executeSql"]}'
      
  • Summarize datasets and tables

    • Automate dataset documentation: call describeTable to fetch schema and sample rows, pass that to the LLM to generate human-readable summaries and column explanations.
  • Assist with Power BI

Tags:ai-ml