Labsco
santhoshravindran7 logo

Microsoft Fabric Analytics

β˜… 112

from santhoshravindran7

An analytics server providing tools for interacting with the Microsoft Fabric data platform.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedPaid serviceAdvanced setup
<a href="https://glama.ai/mcp/servers/@santhoshravindran7/Fabric-Analytics-MCP"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@santhoshravindran7/Fabric-Analytics-MCP/badge" alt="Fabric Analytics MCP server" /> </a>

MseeP.ai Security Assessment Badge

Microsoft Fabric Analytics MCP Server

License: MIT PyPI version npm version TypeScript Node.js Python Model Context Protocol PRs Welcome GitHub issues GitHub stars

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.

πŸ“‹ Table of Contents

🌟 Key Features

  • πŸ—οΈ 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"
Copy & paste β€” that's it
- **☸️ 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"

Copy & paste β€” that's it

**πŸ“Š Multi-Workspace Analytics:**

"List all workspaces in our tenant and show their capacity assignments"

Copy & paste β€” that's it

**πŸ”’ Access Management:**

"Add user john.doe@company.com as Admin to the Analytics workspace"

Copy & paste β€” that's it

**πŸ—οΈ Environment Setup:**

"Create a development environment in the Analytics workspace with Python and R libraries"

Copy & paste β€” that's it

**πŸ”„ Git Integration:**

"Connect the Analytics workspace to our GitHub repository for version control"

Copy & paste β€” that's it

### **πŸ€– 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

πŸ”€ Synapse to Fabric Migration Tools

πŸ†• Automated Spark Workload Migration

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:

πŸ” Migration Discovery Tools

  • 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

πŸ”„ Transformation & Migration Tools

  • 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

✨ Key Migration Features

  • 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

🎯 Migration Scenarios

Migration Demo

πŸ“‹ Explore Before Migrating:

Copy & paste β€” that's it
"List all my Synapse workspaces and show me what notebooks are in workspace 'analytics-synapse'"

πŸ”„ Preview Transformations:

Copy & paste β€” that's it
"Discover assets from my Synapse workspace 'analytics-synapse' and show me how the code would be transformed (dry run)"

πŸš€ Complete Migration:

Copy & paste β€” that's it
"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

🎯 End-to-End Testing with Real Workspaces

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:

Copy & paste β€” that's it
# One-command end-to-end test
npm run test:e2e

What 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

πŸ› οΈ Tools & Capabilities

πŸ” CRUD Operations for Fabric Items

  • Tool: list-fabric-items

  • Description: List items in a Microsoft Fabric workspace (Lakehouses, Notebooks, etc.)

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • itemType: Filter by item type (optional)
  • Tool: create-fabric-item

  • Description: Create new items in Microsoft Fabric workspace

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • itemType: Type of item (Lakehouse, Notebook, Dataset, Report, Dashboard)
    • displayName: Display name for the new item
    • description: Optional description
  • Tool: get-fabric-item

  • Description: Get detailed information about a specific Microsoft Fabric item

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • itemId: ID of the item to retrieve
  • Tool: update-fabric-item

  • Description: Update existing items in Microsoft Fabric workspace

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • itemId: ID of the item to update
    • displayName: New display name (optional)
    • description: New description (optional)
  • Tool: delete-fabric-item

  • Description: Delete items from Microsoft Fabric workspace

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • itemId: ID of the item to delete

πŸ” Query Fabric Dataset (Enhanced)

  • 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 ID
    • datasetName: Name of the dataset to query
    • query: SQL or KQL query to execute

πŸš€ Execute Fabric Notebook

  • Tool: execute-fabric-notebook
  • Description: Execute a notebook in Microsoft Fabric workspace
  • Parameters:
    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • notebookId: ID of the notebook to execute
    • parameters: Optional parameters to pass to the notebook

πŸ“Š Get Analytics Metrics

  • Tool: get-fabric-metrics
  • Description: Retrieve performance and usage metrics for Microsoft Fabric items
  • Parameters:
    • workspaceId: Microsoft Fabric workspace ID
    • itemId: Item ID (dataset, report, etc.)
    • timeRange: Time range for metrics (1h, 24h, 7d, 30d)
    • metrics: List of metrics to analyze

πŸ”§ Analyze Data Model

  • Tool: analyze-fabric-model
  • Description: Analyze a Microsoft Fabric data model and get optimization recommendations
  • Parameters:
    • workspaceId: Microsoft Fabric workspace ID
    • itemId: Item ID to analyze

πŸ“‹ Generate Analytics Report

  • Tool: generate-fabric-report
  • Description: Generate comprehensive analytics reports for Microsoft Fabric workspaces
  • Parameters:
    • workspaceId: Microsoft Fabric workspace ID
    • reportType: Type of report (performance, usage, health, summary)

πŸš€ Livy API Integration (Sessions & Batch Jobs)

Session Management

  • Tool: create-livy-session

  • Description: Create a new Livy session for interactive Spark/SQL execution

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • lakehouseId: Microsoft Fabric lakehouse ID
    • sessionConfig: Optional session configuration
  • Tool: get-livy-session

  • Description: Get details of a Livy session

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • lakehouseId: Microsoft Fabric lakehouse ID
    • sessionId: Livy session ID
  • Tool: list-livy-sessions

  • Description: List all Livy sessions in a lakehouse

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • lakehouseId: Microsoft Fabric lakehouse ID
  • Tool: delete-livy-session

  • Description: Delete a Livy session

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • lakehouseId: Microsoft Fabric lakehouse ID
    • sessionId: Livy session ID

Statement Execution

  • Tool: execute-livy-statement

  • Description: Execute SQL or Spark statements in a Livy session

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • lakehouseId: Microsoft Fabric lakehouse ID
    • sessionId: Livy session ID
    • code: SQL or Spark code to execute
    • kind: Statement type (sql, spark, etc.)
  • Tool: get-livy-statement

  • Description: Get status and results of a Livy statement

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • lakehouseId: Microsoft Fabric lakehouse ID
    • sessionId: Livy session ID
    • statementId: Statement ID

Batch Job Management

  • Tool: create-livy-batch

  • Description: Create a new Livy batch job for long-running operations

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • lakehouseId: Microsoft Fabric lakehouse ID
    • batchConfig: Batch job configuration
  • Tool: get-livy-batch

  • Description: Get details of a Livy batch job

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • lakehouseId: Microsoft Fabric lakehouse ID
    • batchId: Batch job ID
  • Tool: list-livy-batches

  • Description: List all Livy batch jobs in a lakehouse

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • lakehouseId: Microsoft Fabric lakehouse ID
  • Tool: delete-livy-batch

  • Description: Delete a Livy batch job

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • lakehouseId: Microsoft Fabric lakehouse ID
    • batchId: Batch job ID

πŸ“Š Spark Application Monitoring

Workspace-Level Monitoring

  • Tool: get-workspace-spark-applications
  • Description: Get all Spark applications in a Microsoft Fabric workspace
  • Parameters:
    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • continuationToken: Optional token for pagination

Item-Specific Monitoring

  • Tool: get-notebook-spark-applications

  • Description: Get all Spark applications for a specific notebook

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • notebookId: Notebook ID
    • continuationToken: Optional token for pagination
  • Tool: get-lakehouse-spark-applications

  • Description: Get all Spark applications for a specific lakehouse

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • lakehouseId: Lakehouse ID
    • continuationToken: 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 token
    • workspaceId: Microsoft Fabric workspace ID
    • sparkJobDefinitionId: Spark Job Definition ID
    • continuationToken: Optional token for pagination

Application Management

  • Tool: get-spark-application-details

  • Description: Get detailed information about a specific Spark application

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • livyId: Livy session ID
  • Tool: cancel-spark-application

  • Description: Cancel a running Spark application

  • Parameters:

    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • livyId: Livy session ID

Monitoring Dashboard

  • Tool: get-spark-monitoring-dashboard
  • Description: Generate a comprehensive monitoring dashboard with analytics
  • Parameters:
    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID

πŸ““ Notebook Management

The MCP server provides comprehensive notebook management capabilities with predefined templates and custom notebook support.

Create Notebook from Template

  • Tool: create-fabric-notebook
  • Description: Create new Fabric notebooks from predefined templates or custom definitions
  • Parameters:
    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • displayName: Display name for the new notebook
    • template: 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 attach
    • lakehouseId: Optional default lakehouse ID
    • lakehouseName: 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

Get Notebook Definition

  • Tool: get-fabric-notebook-definition
  • Description: Retrieve the notebook definition (cells, metadata) from an existing Fabric notebook
  • Parameters:
    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • notebookId: ID of the notebook to retrieve
    • format: Format to return (ipynb or fabricGitSource)

Update Notebook Definition

  • Tool: update-fabric-notebook-definition
  • Description: Update the notebook definition (cells, metadata) of an existing Fabric notebook
  • Parameters:
    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • notebookId: ID of the notebook to update
    • notebookDefinition: Updated notebook definition object

Execute Notebook

  • Tool: run-fabric-notebook
  • Description: Execute a Fabric notebook on-demand with optional parameters and configuration
  • Parameters:
    • bearerToken: Microsoft Fabric bearer token
    • workspaceId: Microsoft Fabric workspace ID
    • notebookId: ID of the notebook to run
    • parameters: 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)

πŸ§ͺ Development & Testing

Running the Server

Copy & paste β€” that's it
npm start        # Production mode
npm run dev      # Development mode with auto-reload

Testing Livy API Integration

For comprehensive testing of Spark functionality, install Python dependencies:

Copy & paste β€” that's it
pip install -r livy_requirements.txt

Available Test Scripts:

  • livy_api_test.ipynb - Interactive notebook for step-by-step testing
  • comprehensive_livy_test.py - Full-featured test with error handling
  • spark_monitoring_test.py - Spark application monitoring tests
  • mcp_spark_monitoring_demo.py - MCP server integration demo

Claude Desktop Integration

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

Copy & paste β€” that's it
{
  "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!

Livy API Testing Setup

For testing the Livy API functionality, additional Python dependencies are required:

Copy & paste β€” that's it
# Install Python dependencies for Livy API testing
pip install -r livy_requirements.txt

Available Test Scripts:

  • livy_api_test.ipynb - Interactive Jupyter notebook for step-by-step testing
  • comprehensive_livy_test.py - Full-featured test with error handling
  • simple_livy_test.py - Simple test following example patterns
  • livy_batch_test.py - Batch job testing capabilities
  • spark_monitoring_test.py - Spark application monitoring tests

πŸ’¬ Example Queries

Once connected to Claude Desktop, you can ask natural language questions like:

CRUD Operations:

  • "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"

Notebook Management:

  • "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"

Data Operations:

  • "Query the sales dataset to get total revenue by region"
  • "Execute my analytics notebook with today's date"

Analytics:

  • "Get performance metrics for the last 24 hours"
  • "Analyze my data model and provide optimization recommendations"
  • "Generate a usage report for my workspace"

Livy API Operations:

  • "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"

Spark Application Monitoring:

  • "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"

Capacity Management:

  • "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"

🧩 Capacity Management Tools

Manage Microsoft Fabric capacity assignments directly from your AI assistant. These tools let you inspect available capacities, attach/detach workspaces, and audit capacity usage.

Available Tools

  • fabric_list_capacities – Enumerate all capacities you can access (ID, SKU, region, state)
  • fabric_assign_workspace_to_capacity – Attach a workspace to a dedicated capacity
  • fabric_unassign_workspace_from_capacity – Return a workspace to shared capacity
  • fabric_list_capacity_workspaces – List all workspaces currently hosted on a given capacity

Notes

  • 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 (bearerToken field) or rely on global auth.

Minimal Parameter Reference

ToolRequired ParametersOptional
fabric_list_capacities(none)bearerToken
fabric_assign_workspace_to_capacitycapacityId, workspaceIdbearerToken
fabric_unassign_workspace_from_capacityworkspaceIdbearerToken
fabric_list_capacity_workspacescapacityIdbearerToken

🌐 Azure Model Context Protocol Server (Preview)

Microsoft Azure now offers a preview service for hosting MCP servers natively. This eliminates the need for custom infrastructure management.

πŸš€ Azure MCP Server Deployment

Prerequisites

  • Azure subscription with MCP preview access
  • Azure CLI with MCP extensions

Deploy to Azure MCP Service

Copy & paste β€” that's it
# 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"

Configure Authentication

Copy & paste β€” that's it
# 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"

Access Your MCP Server

Copy & paste β€” that's it
# Get the server endpoint
az mcp server show --name "fabric-analytics-mcp" --query "endpoint"

πŸ”§ Azure MCP Server Features

  • 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

πŸ’° Cost Optimization

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.

πŸ—οΈ Architecture

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

πŸ”§ Development

Project Structure

Copy & paste β€” that's it
β”œβ”€β”€ 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

Adding New Tools

To add new tools to the server:

  1. Define the input schema using Zod
  2. Implement the tool using server.tool()
  3. Add error handling and validation
  4. Update documentation

API Integration

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)

πŸ§ͺ Testing

πŸš€ End-to-End Testing

The MCP server includes comprehensive end-to-end testing that creates real workspaces, items, and jobs to validate complete functionality using Azure CLI authentication.

Quick Setup for E2E Testing

Copy & paste β€” that's it
# 1. Set up end-to-end testing environment
npm run setup:e2e

# 2. Run the comprehensive end-to-end test
npm run test:e2e

What the E2E Test Does

The end-to-end test creates a complete workflow in your Microsoft Fabric tenant:

  1. πŸ” Validates Azure CLI Authentication - Uses your existing az login session
  2. πŸ—οΈ Creates a Test Workspace - New workspace with unique naming
  3. ⚑ Attaches to Capacity - Links workspace to your Fabric capacity (optional)
  4. πŸ““ Creates Notebooks & Lakehouses - Test items for validation
  5. πŸƒ Runs Real Jobs - Executes notebook with actual Spark code
  6. πŸ“Š Monitors Execution - Tracks job status and completion
  7. 🧹 Cleans Up Resources - Removes all created test resources

E2E Test Configuration

The setup script creates a .env.e2e configuration file:

Copy & paste β€” that's it
# 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

E2E Test Features

  • βœ… 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

Prerequisites for E2E Testing

  1. Azure CLI installed and logged in:

    Copy & paste β€” that's it
    az login
  2. Microsoft Fabric Access with permissions to:

    • Create workspaces
    • Create notebooks and lakehouses
    • Run Spark jobs
    • (Optional) Assign workspaces to capacity
  3. Fabric Capacity (optional but recommended):

    • Set FABRIC_CAPACITY_ID in .env.e2e for capacity testing
    • Without capacity, workspace will use shared capacity

Running E2E Tests

Copy & paste β€” that's it
# 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 script

E2E Test Output

The test provides comprehensive output including:

Copy & paste β€” that's it
πŸš€ 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

⚠️ Important Notes for E2E Testing

  • 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

πŸ§ͺ Unit & Integration Testing

Prerequisites

Copy & paste β€” that's it
# Install Python dependencies for API testing
pip install -r livy_requirements.txt

Available Test Scripts

  • livy_api_test.ipynb - Interactive Jupyter notebook for step-by-step testing
  • comprehensive_livy_test.py - Full-featured test with error handling
  • simple_livy_test.py - Simple test following example patterns
  • livy_batch_test.py - Batch job testing capabilities
  • spark_monitoring_test.py - Spark application monitoring tests

Quick Testing

  1. Interactive Testing:

    Copy & paste β€” that's it
    jupyter notebook livy_api_test.ipynb
  2. Command Line Testing:

    Copy & paste β€” that's it
    python simple_livy_test.py
    python spark_monitoring_test.py
  3. Comprehensive Testing:

    Copy & paste β€” that's it

🀝 Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes and add tests if applicable
  4. Commit your changes (git commit -m 'Add amazing feature')
  5. Push to the branch (git push origin feature/amazing-feature)
  6. Open a Pull Request

Development Guidelines

  • 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

πŸ”’ Security

  • 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

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For issues and questions:

Acknowledgments

  • 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.