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
- π License
- π Support
- π Complete CRUD Operations - Create, read, update, and delete Fabric items
- β‘ Livy API Integration - Full Spark session and batch job management
- π Spark Application Monitoring - Real-time monitoring across workspaces and items
- π€ Claude Desktop Ready - Plug-and-play integration with Claude Desktop
- π Enterprise Authentication - Multiple auth methods (Bearer, Service Principal, Device Code, Interactive)
- π‘οΈ MSAL Integration - Microsoft Authentication Library for secure enterprise access
- π Analytics & Insights - Generate comprehensive monitoring dashboards
- π§ͺ Comprehensive Testing - Extensive test suite with real API validation
- π Token Management - Automatic token validation and expiration handling
-
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
- Node.js 18+ and npm
- Microsoft Fabric workspace access
- Claude Desktop (for AI integration)
-
Clone and Install
git clone https://github.com/santhoshravindran7/Fabric-Analytics-MCP.git cd Fabric-Analytics-MCP npm install npm run build -
Configure Claude Desktop
Add 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": "node", "args": ["/ABSOLUTE/PATH/TO/PROJECT/build/index.js"] } } } -
Start Using
Restart Claude Desktop and try these queries: - "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 capabilitieslivy_setup.py- Quick setup and configuration helper
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"
- "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"
This MCP server supports multiple authentication methods powered by Microsoft Authentication Library (MSAL):
Provide your own Microsoft Fabric bearer token:
# 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"π 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.
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)
# 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.