Manage Microsoft Fabric with PySpark & LLMs
Fabric MCP Server gives AI assistants control of Microsoft Fabric workspaces, lakehouses, and PySpark notebooks with performance scoring.
1.0.0Add to Favorites
Why it matters
Streamline your Microsoft Fabric development and MLOps with this comprehensive Python MCP server. It integrates LLMs for intelligent notebook creation, code generation, and performance optimization.
Outcomes
What it gets done
Develop and optimize PySpark notebooks with LLM assistance.
Manage Fabric resources like workspaces, lakehouses, and warehouses.
Automate data loading, querying, and schema management.
Analyze and improve notebook performance with detailed recommendations.
Source
Get it from source
Spark does not host a copy of it.
Open sourceReports
Agent outcome reports
No reports yet
Capabilities
Tools your agent gets
Show all available Fabric workspaces
Set the current workspace context for the session
Show all lakehouses in the workspace
Create a new lakehouse
Set the current lakehouse context
Show all warehouses in the workspace
Create a new warehouse
Set the current warehouse context
Overview
Fabric MCP Server
Fabric MCP Server lets an AI assistant manage Microsoft Fabric workspaces, lakehouses, and warehouses, run SQL queries, and build, validate, and optimize PySpark notebooks with performance scoring. Use it when an AI assistant needs to work directly against a Microsoft Fabric tenant to manage resources or develop and tune PySpark notebooks.
What it does
Fabric MCP Server is a Python-based MCP server for working with the Microsoft Fabric API. It lets an AI assistant manage Fabric workspaces, lakehouses, and warehouses, run SQL queries, and develop, test, and optimize PySpark notebooks, with LLM-assisted code generation and performance analysis built in.
When to use - and when NOT to
Use it when you want an AI assistant to work directly against a Microsoft Fabric tenant: browsing and switching between workspaces, lakehouses, and warehouses, inspecting table schemas, running SQL, or building and tuning PySpark notebooks. It authenticates via Azure (az login), so it is only useful if you have Azure access to a Fabric tenant; it is not a general-purpose Spark or SQL tool for environments outside Microsoft Fabric.
Capabilities
- Manage workspaces, lakehouses, warehouses, and tables (list_workspaces, set_workspace, list_lakehouses, create_lakehouse, set_lakehouse, list_warehouses, create_warehouse, set_warehouse, list_tables, set_table)
- Retrieve Delta table schemas and metadata (get_lakehouse_table_schema, get_all_lakehouse_schemas)
- Execute SQL queries and load data (get_sql_endpoint, run_query, load_data_from_url)
- Perform operations on reports and semantic models
- Intelligent notebook creation with 6 specialized templates: basic, etl, analytics, ml, fabric_integration, and streaming
- Smart code generation for common PySpark operations
- Comprehensive validation with syntax checking and best practices
- Fabric-specific optimizations and compatibility checks
- Performance analysis with a 0-100 score and optimization recommendations
- Real-time monitoring and execution analytics
How to install
From source:
git clone https://github.com/your-repo/fabric-mcp.git
cd fabric-mcp
uv sync
pip install -r requirements.txt
Run it under the MCP Inspector for local development with uv run --with mcp mcp dev fabric_mcp.py, or as an HTTP server on port 8081 with uv run python .\fabric_mcp.py --port 8081. For VS Code, register it under STDIO or HTTP transport, for example:
{
"mcp": {
"servers": {
"ms-fabric-mcp": {
"type": "stdio",
"command": "<FullPathToProjectFolder>\\.venv\\Scripts\\python.exe",
"args": ["<FullPathToProjectFolder>\\fabric_mcp.py"]
}
}
}
}
It requires Azure authentication via az login --scope https://api.fabric.microsoft.com/.default. Both STDIO and HTTP communication modes are supported.
Typical requests it is built to handle include listing all workspaces, creating a PySpark notebook that reads sales data, cleans it, and optimizes performance, or diagnosing a slow PySpark notebook and suggesting fixes.
Who it's for
Data engineers and analysts working in Microsoft Fabric who want an AI assistant to manage Fabric resources and write, validate, and optimize PySpark notebooks directly, instead of switching between the Fabric UI and a notebook editor by hand.
Source README
A comprehensive Python-based MCP server for working with Microsoft Fabric API, featuring advanced capabilities for developing, testing, and optimizing PySpark notebooks with LLM integration.
Installation
From Source
git clone https://github.com/your-repo/fabric-mcp.git
cd fabric-mcp
uv sync
pip install -r requirements.txt
MCP Inspector
uv run --with mcp mcp dev fabric_mcp.py
HTTP Server
uv run python .\fabric_mcp.py --port 8081
Configuration
VSCode STDIO Integration
{
"mcp": {
"servers": {
"ms-fabric-mcp": {
"type": "stdio",
"command": "<FullPathToProjectFolder>\\.venv\\Scripts\\python.exe",
"args": ["<FullPathToProjectFolder>\\fabric_mcp.py"]
}
}
}
}
VSCode HTTP Integration
{
"mcp": {
"servers": {
"ms-fabric-mcp": {
"type": "http",
"url": "http://<localhost or remote IP>:8081/mcp/",
"headers": {
"Accept": "application/json,text/event-stream"
}
}
}
}
}
Available Tools
| Tool | Description |
|---|---|
list_workspaces |
Show all available Fabric workspaces |
set_workspace |
Set the current workspace context for the session |
list_lakehouses |
Show all lakehouses in the workspace |
create_lakehouse |
Create a new lakehouse |
set_lakehouse |
Set the current lakehouse context |
list_warehouses |
Show all warehouses in the workspace |
create_warehouse |
Create a new warehouse |
set_warehouse |
Set the current warehouse context |
list_tables |
Show all tables in the lakehouse |
get_lakehouse_table_schema |
Get the schema for a specific table |
get_all_lakehouse_schemas |
Get schemas for all tables in the lakehouse |
set_table |
Set the current table context |
get_sql_endpoint |
Get the SQL endpoint for a lakehouse or warehouse |
run_query |
Execute SQL queries |
load_data_from_url |
Load data from a URL into tables |
Capabilities
- Manage workspaces, lakehouses, warehouses, and tables
- Retrieve Delta table schemas and metadata
- Execute SQL queries and load data
- Perform operations on reports and semantic models
- Intelligent notebook creation with 6 specialized templates
- Smart code generation for common PySpark operations
- Comprehensive validation with syntax checking and best practices
- Fabric-specific optimizations and compatibility checks
- Performance analysis with scoring and optimization recommendations
- Real-time monitoring and execution analytics
Usage Examples
List all my Fabric workspaces
Create a PySpark notebook that reads sales data, cleans it, and optimizes performance
My PySpark notebook is slow. Help me optimize it.
Notes
Requires Azure authentication (az login --scope https://api.fabric.microsoft.com/.default). Includes 6 specialized PySpark templates: basic, etl, analytics, ml, fabric_integration, and streaming. Provides performance scoring (0-100) and detailed optimization recommendations. Supports both STDIO and HTTP communication modes.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.