Enables AI agents to interact with Microsoft Fabric via MCP tools.
ms-fabric-mcp-server
A Model Context Protocol (MCP) server for Microsoft Fabric. Exposes Fabric operations (workspaces, notebooks, SQL, Livy, pipelines, jobs) as MCP tools that AI agents can invoke.
⚠️ Warning: This package is intended for development environments only and should not be used in production. It includes tools that can perform destructive operations (e.g.,
delete_item,delete_lakehouse_file,delete_activity_from_pipeline) and execute arbitrary code via Livy Spark sessions. Always review AI-generated tool calls before execution.
Quick Start
The fastest way to use this MCP server is with uvx:
uvx ms-fabric-mcp-server
Installation
# Using uv (recommended)
uv pip install ms-fabric-mcp-server
# Using pip
pip install ms-fabric-mcp-server
# With SQL support (requires pyodbc)
pip install ms-fabric-mcp-server[sql]
# With OpenTelemetry tracing
pip install ms-fabric-mcp-server[sql,telemetry]
Authentication
Uses DefaultAzureCredential from azure-identity - no explicit credential configuration needed. This automatically tries multiple authentication methods:
- Environment credentials (
AZURE_CLIENT_ID,AZURE_TENANT_ID,AZURE_CLIENT_SECRET) - Managed Identity (when running on Azure)
- Azure CLI credentials (
az login) - VS Code credentials
- Azure PowerShell credentials
No Fabric-specific auth environment variables are needed - it just works if you're authenticated via any of the above methods.
Usage
VS Code Integration
Add to your VS Code MCP settings (.vscode/mcp.json or User settings):
{
"servers": {
"MS Fabric MCP Server": {
"type": "stdio",
"command": "uvx",
"args": ["ms-fabric-mcp-server"]
}
}
}
Claude Desktop Integration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"fabric": {
"command": "uvx",
"args": ["ms-fabric-mcp-server"]
}
}
}
Codex Integration
Add to your Codex config.toml:
[mcp_servers.ms_fabric_mcp]
command = "uvx"
args = ["ms-fabric-mcp-server"]
Running Standalone
# Using uvx (no installation needed)
uvx ms-fabric-mcp-server
# Direct execution (if installed)
ms-fabric-mcp-server
# Via Python module
python -m ms_fabric_mcp_server
# With MCP Inspector (development)
npx @modelcontextprotocol/inspector uvx ms-fabric-mcp-server
Logging & Debugging (optional)
MCP stdio servers must keep protocol traffic on stdout, so redirect stderr to capture logs.
Giving the agent read access to the log file is a powerful way to debug failures.
You can also set AZURE_LOG_LEVEL (Azure SDK) and MCP_LOG_LEVEL (server) to control verbosity.
VS Code (Bash):
{
"servers": {
"MS Fabric MCP Server": {
"type": "stdio",
"command": "bash",
"args": [
"-lc",
"LOG_DIR=\"$HOME/mcp_logs\"; LOG_FILE=\"$LOG_DIR/ms-fabric-mcp-$(date +%Y%m%d_%H%M%S).log\"; uvx ms-fabric-mcp-server 2> \"$LOG_FILE\""
],
"env": {
"AZURE_LOG_LEVEL": "info",
"MCP_LOG_LEVEL": "INFO"
}
}
}
}
VS Code (PowerShell):
{
"servers": {
"MS Fabric MCP Server": {
"type": "stdio",
"command": "powershell",
"args": [
"-NoProfile",
"-Command",
"$logDir=\"$env:USERPROFILE\\mcp_logs\"; New-Item -ItemType Directory -Force -Path $logDir | Out-Null; $ts=Get-Date -Format yyyyMMdd_HHmmss; $logFile=\"$logDir\\ms-fabric-mcp-$ts.log\"; uvx ms-fabric-mcp-server 2> $logFile"
],
"env": {
"AZURE_LOG_LEVEL": "info",
"MCP_LOG_LEVEL": "INFO"
}
}
}
}
Programmatic Usage (Library Mode)
from fastmcp import FastMCP
from ms_fabric_mcp_server import register_fabric_tools
# Create your own server
mcp = FastMCP("my-custom-server")
# Register all Fabric tools
register_fabric_tools(mcp)
# Add your own customizations...
mcp.run()
Configuration
Environment variables (all optional with sensible defaults):
| Variable | Default | Description |
|---|---|---|
FABRIC_BASE_URL |
https://api.fabric.microsoft.com/v1 |
Fabric API base URL |
FABRIC_SCOPES |
https://api.fabric.microsoft.com/.default |
OAuth scopes |
FABRIC_API_CALL_TIMEOUT |
30 |
API timeout (seconds) |
FABRIC_MAX_RETRIES |
3 |
Max retry attempts |
FABRIC_RETRY_BACKOFF |
2.0 |
Backoff facto |
Tools (8)
delete_itemDeletes a specific item from a Microsoft Fabric workspace.delete_lakehouse_fileDeletes a file from a Fabric Lakehouse.delete_activity_from_pipelineRemoves an activity from a Fabric data pipeline.manage_workspacesOperations for managing Fabric workspaces.manage_notebooksOperations for managing and interacting with Fabric notebooks.execute_sql_queryExecutes SQL queries against Fabric data warehouses or lakehouses.manage_livy_sessionsManage and execute code via Livy Spark sessions.manage_pipelinesOperations for managing and running Fabric pipelines and jobs.Environment Variables
FABRIC_BASE_URLFabric API base URL (default: https://api.fabric.microsoft.com/v1)FABRIC_SCOPESOAuth scopes (default: https://api.fabric.microsoft.com/.default)FABRIC_API_CALL_TIMEOUTAPI timeout in secondsFABRIC_MAX_RETRIESMax retry attemptsAZURE_CLIENT_IDAzure Service Principal Client IDAZURE_TENANT_IDAzure Tenant IDAZURE_CLIENT_SECRETAzure Service Principal Client SecretConfiguration
{
"mcpServers": {
"fabric": {
"command": "uvx",
"args": ["ms-fabric-mcp-server"]
}
}
}