A comprehensive Model Context Protocol (MCP) server that provides analytics capabilities and tools for interacting with Microsoft Fabric data platform. This server enables AI assistants like Claude to seamlessly access, analyze, and monitor Microsoft Fabric resources through standardized MCP protocols, bringing the power of Microsoft Fabric directly to your AI conversations.
- π Key Features
- π Quick Start
- π οΈ Tools & Capabilities
- π§ͺ Development & Testing
- π¬ Example Queries
- π Authentication
- ποΈ Architecture
- βοΈ Configuration
- π€ Contributing
- π Security "Cancel the problematic Spark application"
- π Support
- ποΈ Complete Workspace Management - Create, delete, and manage Fabric workspaces with capacity assignment
- π Enhanced CRUD Operations - Create, read, update, and delete all Fabric items (notebooks, lakehouses, datasets, reports)
- π Advanced Notebook Management - Create, execute, and manage Fabric notebooks with 5 predefined templates
- β‘ Livy API Integration - Full Spark session and batch job management with real-time monitoring
- π Comprehensive Spark Monitoring - Real-time monitoring across workspaces, items, and applications
- π€ Multi-AI Assistant Support - Works with Claude Desktop, GitHub Copilot, and other MCP-compatible AI tools
- π Enhanced Azure CLI Authentication - Zero-config setup with automatic token management
- οΏ½οΈ Enterprise Authentication - Multiple auth methods (Bearer, Service Principal, Device Code, Interactive, Azure CLI)
- π Analytics & Insights - Generate comprehensive monitoring dashboards with real-time metrics
- π§ͺ End-to-End Testing - Complete test suite with real workspace creation and job execution
- π Advanced Token Management - Automatic token validation, refresh, and expiration handling "List all Fabric capacities I can use" "Assign workspace 1234abcd-abcd-1234-abcd-123456789000 to capacity f9998888-7777-6666-5555-444433332222" "Show all workspaces in capacity f9998888-7777-6666-5555-444433332222" "Unassign workspace 1234abcd-abcd-1234-abcd-123456789000 from its capacity"
- **βΈοΈ Enterprise Deployment** - Full Kubernetes and Azure deployment support with auto-scaling
- **π Docker Support** - Containerized deployment with health checks and monitoring
- **π Monitoring & Observability** - Built-in Prometheus metrics and Grafana dashboards
- **π Synapse to Fabric Migration** - Automated migration of Spark notebooks from Azure Synapse Analytics
- **π― 52 Total Tools** - Comprehensive coverage of Fabric operations including migration (up from 48 tools)
## ποΈ **New Workspace Management Features**
### **π Latest Updates - Comprehensive Workspace Operations**
The MCP server now includes **21 new workspace management tools** that enable complete workspace lifecycle management:
### **π Core Workspace Operations**
- **fabric_list_workspaces** - List all accessible workspaces with detailed metadata
- **fabric_create_workspace** - Create new workspaces with custom configuration
- **fabric_delete_workspace** - Delete workspaces with confirmation and cleanup
- **fabric_update_workspace** - Update workspace properties and settings
- **fabric_get_workspace** - Get detailed workspace information and status
### **β‘ Capacity & Resource Management**
- **fabric_list_capacities** - List all available Fabric capacities
- **fabric_assign_workspace_to_capacity** - Attach workspaces to dedicated capacity
- **fabric_unassign_workspace_from_capacity** - Move workspaces to shared capacity
- **fabric_list_capacity_workspaces** - List all workspaces in a capacity
### **π₯ Access Control & Security**
- **fabric_get_workspace_role_assignments** - View workspace permissions
- **fabric_add_workspace_role_assignment** - Grant workspace access to users/groups
- **fabric_update_workspace_role_assignment** - Modify user permissions
- **fabric_remove_workspace_role_assignment** - Remove workspace access
### **π Advanced Operations**
- **fabric_get_workspace_git_status** - Check Git integration status
- **fabric_connect_workspace_to_git** - Enable Git integration for workspace
- **fabric_disconnect_workspace_from_git** - Disable Git integration
- **fabric_update_workspace_git_connection** - Modify Git repository settings
### **π οΈ Environment & Pipeline Management**
- **fabric_list_workspace_environments** - List all environments in workspace
- **fabric_create_workspace_environment** - Create new environments
- **fabric_delete_workspace_environment** - Remove environments
- **fabric_list_workspace_data_pipelines** - List data integration pipelines
- **fabric_create_workspace_data_pipeline** - Create new data pipelines
### **π― Real-World Scenarios Enabled**
**π Automated Workspace Provisioning:**
"Create a new workspace called 'Analytics-Q1-2025' and assign it to our premium capacity"
**π Multi-Workspace Analytics:**
"List all workspaces in our tenant and show their capacity assignments"
**π Access Management:**
"Add user john.doe@company.com as Admin to the Analytics workspace"
**ποΈ Environment Setup:**
"Create a development environment in the Analytics workspace with Python and R libraries"
**π Git Integration:**
"Connect the Analytics workspace to our GitHub repository for version control"
### **π€ GitHub Copilot Integration**
**Perfect for GitHub Copilot** - The enhanced workspace management works seamlessly with **GitHub Copilot's built-in terminal**, making it ideal for:
- **π§ Azure CLI Authentication** - Uses your existing `az login` session
- **π» Terminal-Based Operations** - Natural workflow within your coding environment
- **β‘ Rapid Prototyping** - Quickly create test workspaces and environments
- **ποΈ Infrastructure as Code** - Manage Fabric resources alongside your codebase
- **π CI/CD Integration** - Automate workspace provisioning in deployment pipelines
**GitHub Copilot Example Commands:**
```bash
# Using Azure CLI auth, create a new workspace for our ML project
# List all workspaces and their Git integration status
# Set up a complete analytics environment with lakehouse and notebooks
The MCP server now includes 4 specialized migration tools that automate the migration of Spark notebooks and pipelines from Azure Synapse Analytics to Microsoft Fabric:
- fabric_list_synapse_workspaces - List all Synapse workspaces in your Azure subscription
- fabric_discover_synapse_workspace - Inventory notebooks, pipelines, linked services, and Spark jobs from Synapse
- fabric_transform_notebooks - Transform Synapse notebooks to Fabric format (mssparkutils β notebookutils)
- fabric_migrate_synapse_to_fabric - Complete end-to-end migration with discovery, transformation, and provisioning
-
Automatic Code Transformation - Converts Synapse-specific code to Fabric equivalents:
mssparkutilsβnotebookutils- Synapse magic commands β Fabric magic commands
- ABFSS path rewriting to OneLake
- Spark pool configuration cleanup
-
Comprehensive Asset Discovery - Inventories all migrat assets:
- Jupyter notebooks (ipynb format)
- Data pipelines and workflows
- Linked services and connections
- Spark job definitions
-
Safe Testing with Dry Run - Preview all changes before applying:
- Test transformations without provisioning
- Validate transformed code
- Review change reports
-
End-to-End Automation - Complete migration pipeline:
- Discovery β Transformation β Provisioning β Validation
- Automatic lakehouse creation
- OneLake shortcut provisioning
- Comprehensive migration reports
π Explore Before Migrating:
"List all my Synapse workspaces and show me what notebooks are in workspace 'analytics-synapse'"
π Preview Transformations:
"Discover assets from my Synapse workspace 'analytics-synapse' and show me how the code would be transformed (dry run)"
π Complete Migration:
"Migrate all notebooks from Synapse workspace 'analytics-synapse' to Fabric workspace 'abcd-1234' and create a lakehouse called 'MigratedData'"
π Detailed Migration Guide: See MIGRATION.md for comprehensive migration documentation including:
- Step-by-step workflows
- Transformation rule details
- Best practices and troubleshooting
- Complete examples
The MCP server now includes comprehensive end-to-end testing that creates real workspaces, assigns them to capacities, and executes actual jobs to validate the complete workflow:
# One-command end-to-end test
npm run test:e2eWhat it tests:
- β Workspace Creation - Creates real Fabric workspaces
- β Capacity Assignment - Attaches workspaces to your Fabric capacity
- β Item Creation - Creates notebooks, lakehouses, and other items
- β Job Execution - Runs actual Spark jobs and monitors completion
- β Resource Cleanup - Automatically removes all test resources
Recommended for AI Assistant Usage:
{
"mcpServers": {
"fabric-analytics": {
"command": "node",
"args": ["C:\\path\\to\\your\\build\\index.js"],
"cwd": "C:\\path\\to\\your\\project",
"env": {
"FABRIC_AUTH_METHOD": "bearer_token",
"FABRIC_TOKEN": "your_bearer_token_here",
"FABRIC_WORKSPACE_ID": "your_workspace_id",
"ENABLE_HEALTH_SERVER": "false"
}
}
}
}π‘ Get Bearer Token: Visit Power BI Embed Setup to generate tokens
β οΈ Important: Tokens expire after ~1 hour and need to be refreshed
If you experience 60-second timeouts during startup, this is due to interactive authentication flows blocking Claude Desktop's sandboxed environment. Solution:
-
Use Bearer Token Method (Recommended):
- Set
FABRIC_AUTH_METHOD: "bearer_token"in your config - Provide
FABRIC_TOKENwith a valid bearer token - This bypasses interactive authentication entirely
- Set
-
Alternative - Per-Tool Authentication:
- Provide token directly in tool calls:
bearerToken: "your_token_here" - Or use simulation mode:
bearerToken: "simulation"
- Provide token directly in tool calls:
-
Troubleshooting:
- Server now has 10-second timeout protection to prevent hanging
- Falls back to simulation mode if authentication fails
- Enhanced error messages provide clear guidance
π― Quick Fix: The server automatically prioritizes
FABRIC_TOKENenvironment variable over interactive authentication flows, preventing Claude Desktop timeouts.
# Clone and run locally
git clone https://github.com/santhoshravindran7/Fabric-Analytics-MCP.git
cd Fabric-Analytics-MCP
npm install && npm run build && npm start# Using Docker Compose
docker-compose up -d
# Or standalone Docker
docker build -t fabric-analytics-mcp .
docker run -p 3000:3000 -e FABRIC_CLIENT_ID=xxx fabric-analytics-mcp# One-command enterprise deployment
export ACR_NAME="your-registry" FABRIC_CLIENT_ID="xxx" FABRIC_CLIENT_SECRET="yyy" FABRIC_TENANT_ID="zzz"
./scripts/setup-azure-resources.sh && ./scripts/build-and-push.sh && ./scripts/deploy-to-aks.sh# Serverless deployment on Azure
az mcp server create --name "fabric-analytics-mcp" --repository "santhoshravindran7/Fabric-Analytics-MCP"π Detailed Guides:
- π³ Docker & Compose Setup
- βΈοΈ AKS Deployment Guide
- π Azure MCP Server Guide
- π§ Configuration Examples
- β Deployment Validation
-
Tool:
list-fabric-items -
Description: List items in a Microsoft Fabric workspace (Lakehouses, Notebooks, etc.)
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDitemType: Filter by item type (optional)
-
Tool:
create-fabric-item -
Description: Create new items in Microsoft Fabric workspace
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDitemType: Type of item (Lakehouse, Notebook, Dataset, Report, Dashboard)displayName: Display name for the new itemdescription: Optional description
-
Tool:
get-fabric-item -
Description: Get detailed information about a specific Microsoft Fabric item
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDitemId: ID of the item to retrieve
-
Tool:
update-fabric-item -
Description: Update existing items in Microsoft Fabric workspace
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDitemId: ID of the item to updatedisplayName: New display name (optional)description: New description (optional)
-
Tool:
delete-fabric-item -
Description: Delete items from Microsoft Fabric workspace
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDitemId: ID of the item to delete
- Tool:
query-fabric-dataset - Description: Execute SQL or KQL queries against Microsoft Fabric datasets
- Parameters:
bearerToken: Microsoft Fabric bearer token (optional - uses simulation if not provided)workspaceId: Microsoft Fabric workspace IDdatasetName: Name of the dataset to queryquery: SQL or KQL query to execute
- Tool:
execute-fabric-notebook - Description: Execute a notebook in Microsoft Fabric workspace
- Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDnotebookId: ID of the notebook to executeparameters: Optional parameters to pass to the notebook
- Tool:
get-fabric-metrics - Description: Retrieve performance and usage metrics for Microsoft Fabric items
- Parameters:
workspaceId: Microsoft Fabric workspace IDitemId: Item ID (dataset, report, etc.)timeRange: Time range for metrics (1h, 24h, 7d, 30d)metrics: List of metrics to analyze
- Tool:
analyze-fabric-model - Description: Analyze a Microsoft Fabric data model and get optimization recommendations
- Parameters:
workspaceId: Microsoft Fabric workspace IDitemId: Item ID to analyze
- Tool:
generate-fabric-report - Description: Generate comprehensive analytics reports for Microsoft Fabric workspaces
- Parameters:
workspaceId: Microsoft Fabric workspace IDreportType: Type of report (performance, usage, health, summary)
-
Tool:
create-livy-session -
Description: Create a new Livy session for interactive Spark/SQL execution
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlakehouseId: Microsoft Fabric lakehouse IDsessionConfig: Optional session configuration
-
Tool:
get-livy-session -
Description: Get details of a Livy session
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlakehouseId: Microsoft Fabric lakehouse IDsessionId: Livy session ID
-
Tool:
list-livy-sessions -
Description: List all Livy sessions in a lakehouse
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlakehouseId: Microsoft Fabric lakehouse ID
-
Tool:
delete-livy-session -
Description: Delete a Livy session
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlakehouseId: Microsoft Fabric lakehouse IDsessionId: Livy session ID
-
Tool:
execute-livy-statement -
Description: Execute SQL or Spark statements in a Livy session
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlakehouseId: Microsoft Fabric lakehouse IDsessionId: Livy session IDcode: SQL or Spark code to executekind: Statement type (sql, spark, etc.)
-
Tool:
get-livy-statement -
Description: Get status and results of a Livy statement
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlakehouseId: Microsoft Fabric lakehouse IDsessionId: Livy session IDstatementId: Statement ID
-
Tool:
create-livy-batch -
Description: Create a new Livy batch job for long-running operations
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlakehouseId: Microsoft Fabric lakehouse IDbatchConfig: Batch job configuration
-
Tool:
get-livy-batch -
Description: Get details of a Livy batch job
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlakehouseId: Microsoft Fabric lakehouse IDbatchId: Batch job ID
-
Tool:
list-livy-batches -
Description: List all Livy batch jobs in a lakehouse
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlakehouseId: Microsoft Fabric lakehouse ID
-
Tool:
delete-livy-batch -
Description: Delete a Livy batch job
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlakehouseId: Microsoft Fabric lakehouse IDbatchId: Batch job ID
- Tool:
get-workspace-spark-applications - Description: Get all Spark applications in a Microsoft Fabric workspace
- Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDcontinuationToken: Optional token for pagination
-
Tool:
get-notebook-spark-applications -
Description: Get all Spark applications for a specific notebook
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDnotebookId: Notebook IDcontinuationToken: Optional token for pagination
-
Tool:
get-lakehouse-spark-applications -
Description: Get all Spark applications for a specific lakehouse
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlakehouseId: Lakehouse IDcontinuationToken: Optional token for pagination
-
Tool:
get-spark-job-definition-applications -
Description: Get all Spark applications for a specific Spark Job Definition
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDsparkJobDefinitionId: Spark Job Definition IDcontinuationToken: Optional token for pagination
-
Tool:
get-spark-application-details -
Description: Get detailed information about a specific Spark application
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlivyId: Livy session ID
-
Tool:
cancel-spark-application -
Description: Cancel a running Spark application
-
Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDlivyId: Livy session ID
- Tool:
get-spark-monitoring-dashboard - Description: Generate a comprehensive monitoring dashboard with analytics
- Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace ID
The MCP server provides comprehensive notebook management capabilities with predefined templates and custom notebook support.
- Tool:
create-fabric-notebook - Description: Create new Fabric notebooks from predefined templates or custom definitions
- Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDdisplayName: Display name for the new notebooktemplate: Template type (blank, sales_analysis, nyc_taxi_analysis, data_exploration, machine_learning, custom)customNotebook: Custom notebook definition (required if template is 'custom')environmentId: Optional environment ID to attachlakehouseId: Optional default lakehouse IDlakehouseName: Optional default lakehouse name
Available Templates:
- blank: Basic notebook with minimal setup
- sales_analysis: Comprehensive sales data analysis with sample dataset
- nyc_taxi_analysis: NYC taxi trip data analysis with sample dataset
- data_exploration: Structured data exploration template
- machine_learning: Complete ML workflow template
- custom: Use your own notebook definition
- Tool:
get-fabric-notebook-definition - Description: Retrieve the notebook definition (cells, metadata) from an existing Fabric notebook
- Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDnotebookId: ID of the notebook to retrieveformat: Format to return (ipynb or fabricGitSource)
- Tool:
update-fabric-notebook-definition - Description: Update the notebook definition (cells, metadata) of an existing Fabric notebook
- Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDnotebookId: ID of the notebook to updatenotebookDefinition: Updated notebook definition object
- Tool:
run-fabric-notebook - Description: Execute a Fabric notebook on-demand with optional parameters and configuration
- Parameters:
bearerToken: Microsoft Fabric bearer tokenworkspaceId: Microsoft Fabric workspace IDnotebookId: ID of the notebook to runparameters: Optional notebook parameters (key-value pairs with types)configuration: Optional execution configuration (environment, lakehouse, pools, etc.)
Features:
- π Base64 encoded notebook payload support
- π§ Comprehensive metadata management
- π Environment and lakehouse integration
- ποΈ Parameterized notebook execution
- β‘ Spark configuration support
- π€ Support for multiple programming languages (Python, Scala, SQL, R)
Choose your preferred installation method:
# Install via pip (easiest method)
pip install fabric-analytics-mcp
# Verify installation
fabric-analytics --version
# Start the server
fabric-analytics-mcp start# Install globally via npm
npm install -g mcp-for-microsoft-fabric-analytics
# Verify installation
fabric-analytics --version
# Start the server
fabric-analytics
# Or using npx (no installation required)
npx mcp-for-microsoft-fabric-analyticsFor automated setup with environment configuration:
Unix/Linux/macOS:
# Download and run universal installer
curl -fsSL https://raw.githubusercontent.com/santhoshravindran7/Fabric-Analytics-MCP/main/scripts/install-universal.sh | bash
# Or with options for full setup
curl -fsSL https://raw.githubusercontent.com/santhoshravindran7/Fabric-Analytics-MCP/main/scripts/install-universal.sh | bash -s -- --method pip --config --env --testWindows (PowerShell):
# Download and run Windows installer
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/santhoshravindran7/Fabric-Analytics-MCP/main/scripts/install-windows.ps1'))
# Or with options for full setup
& ([scriptblock]::Create((iwr https://raw.githubusercontent.com/santhoshravindran7/Fabric-Analytics-MCP/main/scripts/install-windows.ps1).Content)) -Method pip -Config -Environment -Test# Clone repository
git clone https://github.com/santhoshravindran7/Fabric-Analytics-MCP.git
cd Fabric-Analytics-MCP
# Build and run with Docker
docker build -t fabric-analytics-mcp .
docker run -d --name fabric-mcp -p 3000:3000 --env-file .env fabric-analytics-mcpπ See Docker Installation Guide for detailed Docker and Kubernetes deployment options.
# Clone and build from source
git clone https://github.com/santhoshravindran7/Fabric-Analytics-MCP.git
cd Fabric-Analytics-MCP
npm install
npm run build # β
All configuration files included!Set up your environment variables:
export FABRIC_AUTH_METHOD=bearer_token # or service_principal, interactive
export FABRIC_CLIENT_ID=your-client-id
export FABRIC_CLIENT_SECRET=your-client-secret
export FABRIC_TENANT_ID=your-tenant-id
export FABRIC_DEFAULT_WORKSPACE_ID=your-workspace-idAdd to your Claude Desktop config:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"fabric-analytics": {
"command": "fabric-analytics-mcp",
"args": ["start"],
"env": {
"FABRIC_AUTH_METHOD": "bearer_token"
}
}
}
}{
"mcpServers": {
"fabric-analytics": {
"command": "fabric-analytics",
"env": {
"FABRIC_AUTH_METHOD": "bearer_token"
}
}
}
}{
"mcpServers": {
"fabric-analytics": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/PROJECT/build/index.js"]
}
}
}Restart Claude Desktop and try these queries:
- "List all workspaces I have access to"
- "Find workspace named 'Analytics'"
- "List all items in my Fabric workspace [your-workspace-id]"
- "Create a new lakehouse called 'Analytics Hub'"
- "Show me all running Spark applications"
- "Execute this SQL query: SELECT * FROM my_table LIMIT 10"
npm start # Production mode
npm run dev # Development mode with auto-reloadFor comprehensive testing of Spark functionality, install Python dependencies:
pip install -r livy_requirements.txtAvailable Test Scripts:
livy_api_test.ipynb- Interactive notebook for step-by-step testingcomprehensive_livy_test.py- Full-featured test with error handlingspark_monitoring_test.py- Spark application monitoring testsmcp_spark_monitoring_demo.py- MCP server integration demo
Add this configuration to your Claude Desktop config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"fabric-analytics": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/PROJECT/build/index.js"]
}
}
}π You're ready! Restart Claude Desktop and start asking questions about your Microsoft Fabric data!
For testing the Livy API functionality, additional Python dependencies are required:
# Install Python dependencies for Livy API testing
pip install -r livy_requirements.txtlivy_api_test.ipynb- Interactive Jupyter notebook for step-by-step testingcomprehensive_livy_test.py- Full-featured test with error handlingsimple_livy_test.py- Simple test following example patternslivy_batch_test.py- Batch job testing capabilitiesspark_monitoring_test.py- Spark application monitoring tests
npm startnpm run devAdd the following configuration to your Claude Desktop config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"fabric-analytics": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/PROJECT/build/index.js"]
}
}
}Once connected to Claude Desktop, you can ask natural language questions like:
- "List all Lakehouses in my workspace"
- "Create a new Notebook called 'Data Analysis'"
- "Update the description of my lakehouse"
- "Delete the test notebook from my workspace"
- "Create a sales analysis notebook with sample data"
- "Generate a new NYC taxi analysis notebook"
- "Create a machine learning notebook template"
- "Get the definition of my existing notebook"
- "Run my notebook with specific parameters"
- "Update my notebook with new cells"
- "Query the sales dataset to get total revenue by region"
- "Execute my analytics notebook with today's date"
- "Get performance metrics for the last 24 hours"
- "Analyze my data model and provide optimization recommendations"
- "Generate a usage report for my workspace"
- "Create a Livy session for interactive Spark analysis"
- "Execute SQL query 'SELECT * FROM my_table LIMIT 10'"
- "Run Spark code to show all tables"
- "Monitor my batch job progress"
- "Show me all Spark applications in my workspace"
- "What's the status of my notebook Spark jobs?"
- "Generate a comprehensive Spark monitoring dashboard"
- "Show me recent failed applications"
- "Cancel the problematic Spark application"
- "List all Fabric capacities I can use"
- "Assign workspace 1234abcd-abcd-1234-abcd-123456789000 to capacity f9998888-7777-6666-5555-444433332222"
- "Show all workspaces in capacity f9998888-7777-6666-5555-444433332222"
- "Unassign workspace 1234abcd-abcd-1234-abcd-123456789000 from its capacity"
Manage Microsoft Fabric capacity assignments directly from your AI assistant. These tools let you inspect available capacities, attach/detach workspaces, and audit capacity usage.
fabric_list_capacitiesβ Enumerate all capacities you can access (ID, SKU, region, state)fabric_assign_workspace_to_capacityβ Attach a workspace to a dedicated capacityfabric_unassign_workspace_from_capacityβ Return a workspace to shared capacityfabric_list_capacity_workspacesβ List all workspaces currently hosted on a given capacity
- If authentication fails or you're in simulation mode, capacity responses are simulated.
- Real capacity operations require appropriate Fabric / Power BI admin permissions.
- You can provide a bearer token per call (
bearerTokenfield) or rely on global auth.
| Tool | Required Parameters | Optional |
|---|---|---|
| fabric_list_capacities | (none) | bearerToken |
| fabric_assign_workspace_to_capacity | capacityId, workspaceId | bearerToken |
| fabric_unassign_workspace_from_capacity | workspaceId | bearerToken |
| fabric_list_capacity_workspaces | capacityId | bearerToken |
If Claude Desktop or another MCP client reports an error like:
Error: Unexpected token 'P', "Please set"... is not valid JSON
SyntaxError: Unexpected token 'P', "Please set"... is not valid JSON
This is the EXACT issue reported in GitHub issue where the user saw "Unexpected token 'P', 'Please set'..." errors.
This almost always means something wrote plain text to STDOUT (which must contain ONLY JSON-RPC frames). Common causes:
- Added
console.logdebug statements in server code - A dependency emitting warnings to STDOUT
- Early logging before transport initialization
- β
A startup guard now redirects
console.log/console.infoto STDERR automatically - β
Debug output has been consolidated behind the
DEBUG_MCP_RUN=1flag - β All diagnostic messages go to STDERR, keeping STDOUT clean for JSON-RPC protocol
- Avoid adding raw
console.logstatementsβpreferconsole.error(goes to STDERR) - If you must allow stdout logging temporarily (NOT recommended), set:
ALLOW_UNSAFE_STDOUT=true- Remove after debugging
- Regenerate the build (
npm run build) after changes to ensure compiled output matches source
If the capacity tools don't show up when the client lists tools:
- Ensure you rebuilt after pulling changes:
npm run build - Confirm you're launching the server from
build/index.jsand not an older snapshot - Verify no MCP client-side allowlist is filtering tool names
- Run a quick enumeration test: ask the assistant "List all available tools"
- If still missing, delete the
build/folder and rebuild to clear stale artifacts
- Azure CLI auth may fail silently without an active
az loginsession - Bearer tokens expire (~1 hour); refresh if operations suddenly fail
- For local testing: falling back to simulation still lets you prototype tool flows
Set the following (sent to STDERR, safe for MCP framing):
DEBUG_MCP_RUN=1
Optionally add structured auth tracing:
DEBUG_AUTH=1
Need a new troubleshooting topic? Open an issue or PR so others benefit from the resolution.
This MCP server supports multiple authentication methods powered by Microsoft Authentication Library (MSAL):
π€ For Claude Desktop: Use Bearer Token Authentication (Method #1) for the best experience and compatibility.
π§ Claude Desktop Fix: Recent updates prevent authentication timeouts by prioritizing bearer tokens and adding timeout protection for interactive authentication flows.
Perfect for AI assistants and interactive usage:
For Claude Desktop:
- Visit Power BI Embed Setup
- Generate a bearer token for your workspace
- Add to your
claude_desktop_config.json - No timeout issues - bypasses interactive authentication entirely
For Testing:
# All test scripts will prompt for authentication method
python enhanced_auth_test.pyUse Azure AD application credentials:
- Client ID (Application ID)
- Client Secret
- Tenant ID (Directory ID)
Environment Variables Setup:
export FABRIC_AUTH_METHOD="service_principal"
export FABRIC_CLIENT_ID="your-app-client-id"
export FABRIC_CLIENT_SECRET="your-app-client-secret"
export FABRIC_TENANT_ID="your-tenant-id"
export FABRIC_DEFAULT_WORKSPACE_ID="your-workspace-id"Claude Desktop Configuration:
{
"mcpServers": {
"fabric-analytics": {
"command": "node",
"args": ["/path/to/build/index.js"],
"env": {
"FABRIC_AUTH_METHOD": "service_principal",
"FABRIC_CLIENT_ID": "your-client-id",
"FABRIC_CLIENT_SECRET": "your-client-secret",
"FABRIC_TENANT_ID": "your-tenant-id"
}
}
}
}Sign in with browser on another device (great for headless environments):
export FABRIC_AUTH_METHOD="device_code"
export FABRIC_CLIENT_ID="your-client-id"
export FABRIC_TENANT_ID="your-tenant-id"Automatic browser-based authentication:
export FABRIC_AUTH_METHOD="interactive"
export FABRIC_CLIENT_ID="your-client-id"
export FABRIC_TENANT_ID="your-tenant-id"Use your existing Azure CLI login for seamless local testing:
export FABRIC_AUTH_METHOD="azure_cli"Prerequisites:
- Install Azure CLI:
winget install Microsoft.AzureCLI(Windows) or Download - Login to Azure:
az login - Set active subscription:
az account set --subscription "your-subscription-name"
Benefits:
- β Zero Configuration - Uses your existing Azure login
- β Instant Setup - No app registration or client secrets needed
- β Multi-Account Support - Switch Azure accounts easily
- β Perfect for Development - Seamless local testing experience
Quick Test:
# Verify Azure CLI setup
npm run test:azure-cli
# Start MCP server with Azure CLI auth
$env:FABRIC_AUTH_METHOD="azure_cli"; npm startπ‘ Pro Tip: Azure CLI authentication is perfect for developers who want to quickly test the MCP server without complex Azure AD app setup. Just
az loginand you're ready to go!
π Detailed Guides:
- Authentication Setup Guide - Complete Azure AD setup
- Claude Desktop Config Examples - Ready-to-use configurations
Check your authentication status:
"Check my Fabric authentication status"
"What authentication method am I using?"
"Test my Microsoft Fabric authentication setup"
- Never commit authentication tokens to version control
- Use Service Principal authentication for production deployments
- Device Code flow is perfect for CI/CD and headless environments
- Interactive authentication is ideal for development and testing
- All tokens are automatically validated and include expiration checking
Note: The MCP server seamlessly handles token validation and provides clear error messages for authentication issues.
Deploy the MCP server as a scalable service on Azure Kubernetes Service for enterprise production use.
- Azure CLI installed and configured
- Docker installed
- kubectl installed
- Azure subscription with AKS permissions
# Build the Docker image
npm run docker:build
# Tag and push to Azure Container Registry
npm run docker:push# Create Azure resources and deploy
./scripts/deploy-to-aks.shOnce deployed, your MCP server will be available at:
https://your-aks-cluster.region.cloudapp.azure.com/mcp
The AKS deployment includes:
- Horizontal Pod Autoscaler (3-10 pods based on CPU/memory)
- Azure Load Balancer for high availability
- SSL/TLS termination with Azure Application Gateway
- ConfigMaps for environment configuration
- Secrets for secure credential storage
- Health checks and readiness probes
- Resource limits and quality of service guarantees
All Kubernetes manifests are located in the /k8s directory:
namespace.yaml- Dedicated namespacedeployment.yaml- Application deployment with scalingservice.yaml- Load balancer serviceingress.yaml- External access and SSLconfigmap.yaml- Configuration managementsecret.yaml- Secure credential storagehpa.yaml- Horizontal Pod Autoscaler
Configure the deployment by setting these environment variables:
export AZURE_SUBSCRIPTION_ID="your-subscription-id"
export AZURE_RESOURCE_GROUP="fabric-mcp-rg"
export AKS_CLUSTER_NAME="fabric-mcp-cluster"
export ACR_NAME="fabricmcpregistry"
export DOMAIN_NAME="your-domain.com"The AKS deployment includes enterprise-grade security:
- Non-root container execution
- Read-only root filesystem
- Secret management via Azure Key Vault integration
- Network policies for traffic isolation
- RBAC with minimal required permissions
- Pod security standards enforcement
- Azure Monitor integration for logs and metrics
- Application Insights for performance monitoring
- Prometheus metrics endpoint for custom monitoring
- Auto-scaling based on CPU (70%) and memory (80%) thresholds
- Health checks for automatic pod restart
The deployment scripts support:
- Azure DevOps pipelines
- GitHub Actions workflows
- Automated testing before deployment
- Blue-green deployments for zero downtime
- Rollback capabilities for quick recovery
π Detailed Guide: See AKS_DEPLOYMENT.md for complete setup instructions.
Microsoft Azure now offers a preview service for hosting MCP servers natively. This eliminates the need for custom infrastructure management.
- Azure subscription with MCP preview access
- Azure CLI with MCP extensions
# Login to Azure
az login
# Enable MCP preview features
az extension add --name mcp-preview
# Deploy the MCP server
az mcp server create \
--name "fabric-analytics-mcp" \
--resource-group "your-rg" \
--source-type "github" \
--repository "santhoshravindran7/Fabric-Analytics-MCP" \
--branch "main" \
--auth-method "service-principal"# Set up service principal authentication
az mcp server config set \
--name "fabric-analytics-mcp" \
--setting "FABRIC_CLIENT_ID=your-client-id" \
--setting "FABRIC_CLIENT_SECRET=your-secret" \
--setting "FABRIC_TENANT_ID=your-tenant-id"# Get the server endpoint
az mcp server show --name "fabric-analytics-mcp" --query "endpoint"- Automatic scaling based on usage
- Built-in monitoring and logging
- Integrated security with Azure AD
- Zero infrastructure management
- Global CDN for low latency
- Automatic SSL/TLS certificates
Azure MCP Server offers:
- Pay-per-request pricing model
- Automatic hibernation during idle periods
- Resource sharing across multiple clients
- No minimum infrastructure costs
π Learn More: Azure MCP Server Documentation
Note: Azure MCP Server is currently in preview. Check Azure Preview Terms for service availability and limitations.
This MCP server is built with:
- TypeScript for type-safe development
- MCP SDK for Model Context Protocol implementation
- Zod for schema validation and input sanitization
- Node.js runtime environment
The server uses the following configuration files:
tsconfig.json- TypeScript compiler configurationpackage.json- Node.js package configuration.vscode/mcp.json- MCP server configuration for VS Code
βββ src/
β βββ index.ts # Main MCP server implementation
β βββ fabric-client.ts # Microsoft Fabric API client
βββ build/ # Compiled JavaScript output
βββ tests/ # Test scripts and notebooks
βββ .vscode/ # VS Code configuration
βββ package.json
βββ tsconfig.json
βββ README.md
To add new tools to the server:
- Define the input schema using Zod
- Implement the tool using
server.tool() - Add error handling and validation
- Update documentation
This server includes:
β Production Ready:
- Full Microsoft Fabric Livy API integration
- Spark session lifecycle management
- Statement execution with SQL and Spark support
- Batch job management for long-running operations
- Comprehensive error handling and retry logic
- Real-time polling and result retrieval
π§ͺ Demonstration Features:
- CRUD operations (configurable for real APIs)
- Analytics and metrics (extensible framework)
- Data model analysis (template implementation)
The MCP server includes comprehensive end-to-end testing that creates real workspaces, items, and jobs to validate complete functionality using Azure CLI authentication.
# 1. Set up end-to-end testing environment
npm run setup:e2e
# 2. Run the comprehensive end-to-end test
npm run test:e2eThe end-to-end test creates a complete workflow in your Microsoft Fabric tenant:
- π Validates Azure CLI Authentication - Uses your existing
az loginsession - ποΈ Creates a Test Workspace - New workspace with unique naming
- β‘ Attaches to Capacity - Links workspace to your Fabric capacity (optional)
- π Creates Notebooks & Lakehouses - Test items for validation
- π Runs Real Jobs - Executes notebook with actual Spark code
- π Monitors Execution - Tracks job status and completion
- π§Ή Cleans Up Resources - Removes all created test resources
The setup script creates a .env.e2e configuration file:
# Example configuration
FABRIC_CAPACITY_ID=your-capacity-id-here # Optional: for capacity testing
E2E_TEST_TIMEOUT=300000 # 5 minutes per operation
E2E_CLEANUP_ON_FAILURE=true # Clean up on test failure
E2E_RETRY_COUNT=3 # Retry failed operations- β Real Resource Creation - Creates actual Fabric workspaces and items
- β Azure CLI Integration - Uses your existing Azure authentication
- β Capacity Assignment - Tests workspace-to-capacity attachment
- β Job Execution - Runs real Spark jobs and monitors completion
- β Automatic Cleanup - Removes all test resources automatically
- β Comprehensive Logging - Detailed logging of all operations
- β Error Handling - Robust error handling and recovery
-
Azure CLI installed and logged in:
az login
-
Microsoft Fabric Access with permissions to:
- Create workspaces
- Create notebooks and lakehouses
- Run Spark jobs
- (Optional) Assign workspaces to capacity
-
Fabric Capacity (optional but recommended):
- Set
FABRIC_CAPACITY_IDin.env.e2efor capacity testing - Without capacity, workspace will use shared capacity
- Set
# Complete setup and run
npm run setup:e2e && npm run test:e2e
# Or run individual steps
npm run setup:e2e # Set up environment
npm run test:e2e # Run end-to-end test
# Direct execution
node setup-e2e.cjs # Setup script
node test-end-to-end.cjs # Test scriptThe test provides comprehensive output including:
π Starting End-to-End Test for Microsoft Fabric Analytics MCP Server
β
MCP Server Startup (1234ms)
β
Azure CLI Authentication
β
Workspace Creation
β
Capacity Attachment
β
Notebook Creation
β
Lakehouse Creation
β
Item Validation
β
Job Execution
π TEST SUMMARY
================
β
MCP Server Startup (2341ms)
β
Azure CLI Authentication
β
Workspace Creation
β
Capacity Attachment
β
Notebook Creation
β
Lakehouse Creation
β
Item Validation
β
Job Execution
Total: 8 | Passed: 8 | Failed: 0
- Creates Real Resources: The test creates actual workspaces and items in your Fabric tenant
- Requires Permissions: Ensure you have necessary Fabric permissions
- Uses Capacity: Jobs may consume capacity units if using dedicated capacity
- Automatic Cleanup: All resources are automatically deleted after testing
- Network Dependent: Requires stable internet connection for API calls
# Install Python dependencies for API testing
pip install -r livy_requirements.txtlivy_api_test.ipynb- Interactive Jupyter notebook for step-by-step testingcomprehensive_livy_test.py- Full-featured test with error handlingsimple_livy_test.py- Simple test following example patternslivy_batch_test.py- Batch job testing capabilitiesspark_monitoring_test.py- Spark application monitoring tests
-
Interactive Testing:
jupyter notebook livy_api_test.ipynb
-
Command Line Testing:
python simple_livy_test.py python spark_monitoring_test.py
-
Comprehensive Testing:
We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes and add tests if applicable
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow TypeScript best practices
- Add JSDoc comments for new functions
- Update tests for any new functionality
- Update documentation as needed
- See CONTRIBUTING.md for detailed guidelines
- Never commit authentication tokens to version control
- Use environment variables for sensitive configuration
- Follow Microsoft Fabric security best practices
- Report security issues privately via GitHub security advisories
- See SECURITY.md for our full security policy
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- π Check the MCP documentation
- π Review Microsoft Fabric API documentation
- π Open an issue in this repository
- π¬ Join the community discussions
- Microsoft Fabric Analytics team for the comprehensive data platform and analytics capabilities
- Microsoft Fabric Platform teams for the robust API platform and infrastructure
- Bogdan Crivat and Chris Finlan for the inspiring brainstorming conversation that gave me the idea to open-source this project
- Anthropic for the Model Context Protocol specification
This project began as my weekend hack project exploring AI integration with Microsoft Fabric. During a casual conversation with Chris and Bogdan about making AI tooling more accessible. What started as a personal experiment over a weekend is now available for everyone to build upon.

