Model Context Protocol (MCP) server for Microsoft Fabric - exposes Fabric operations as MCP tools for AI agents
Project description
ms-fabric-mcp-server
A Model Context Protocol (MCP) server for Microsoft Fabric. Exposes Fabric operations (workspaces, notebooks, SQL, Livy, pipelines, jobs) as MCP tools that AI agents can invoke.
⚠️ Warning: This package is intended for development environments only and should not be used in production. It includes tools that can perform destructive operations (e.g.,
delete_notebook,delete_item) and execute arbitrary code via Livy Spark sessions. Always review AI-generated tool calls before execution.
Quick Start
The fastest way to use this MCP server is with uvx:
uvx ms-fabric-mcp-server
Installation
# Using uv (recommended)
uv pip install ms-fabric-mcp-server
# Using pip
pip install ms-fabric-mcp-server
# With SQL support (requires pyodbc)
pip install ms-fabric-mcp-server[sql]
# With OpenTelemetry tracing
pip install ms-fabric-mcp-server[sql,telemetry]
Authentication
Uses DefaultAzureCredential from azure-identity - no explicit credential configuration needed. This automatically tries multiple authentication methods:
- Environment credentials (
AZURE_CLIENT_ID,AZURE_TENANT_ID,AZURE_CLIENT_SECRET) - Managed Identity (when running on Azure)
- Azure CLI credentials (
az login) - VS Code credentials
- Azure PowerShell credentials
No Fabric-specific auth environment variables are needed - it just works if you're authenticated via any of the above methods.
Usage
VS Code Integration
Add to your VS Code MCP settings (.vscode/mcp.json or User settings):
{
"servers": {
"MS Fabric MCP Server": {
"type": "stdio",
"command": "uvx",
"args": ["ms-fabric-mcp-server"]
}
}
}
Claude Desktop Integration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"fabric": {
"command": "uvx",
"args": ["ms-fabric-mcp-server"]
}
}
}
Running Standalone
# Using uvx (no installation needed)
uvx ms-fabric-mcp-server
# Direct execution (if installed)
ms-fabric-mcp-server
# Via Python module
python -m ms_fabric_mcp_server
# With MCP Inspector (development)
npx @modelcontextprotocol/inspector uvx ms-fabric-mcp-server
Programmatic Usage (Library Mode)
from fastmcp import FastMCP
from ms_fabric_mcp_server import register_fabric_tools
# Create your own server
mcp = FastMCP("my-custom-server")
# Register all Fabric tools
register_fabric_tools(mcp)
# Add your own customizations...
mcp.run()
Configuration
Environment variables (all optional with sensible defaults):
| Variable | Default | Description |
|---|---|---|
FABRIC_BASE_URL |
https://api.fabric.microsoft.com/v1 |
Fabric API base URL |
FABRIC_SCOPES |
https://api.fabric.microsoft.com/.default |
OAuth scopes |
FABRIC_API_CALL_TIMEOUT |
30 |
API timeout (seconds) |
FABRIC_MAX_RETRIES |
3 |
Max retry attempts |
FABRIC_RETRY_BACKOFF |
2.0 |
Backoff factor |
LIVY_API_CALL_TIMEOUT |
120 |
Livy timeout (seconds) |
LIVY_POLL_INTERVAL |
2.0 |
Livy polling interval |
LIVY_STATEMENT_WAIT_TIMEOUT |
10 |
Livy statement wait timeout |
LIVY_SESSION_WAIT_TIMEOUT |
240 |
Livy session wait timeout |
MCP_SERVER_NAME |
ms-fabric-mcp-server |
Server name for MCP |
MCP_LOG_LEVEL |
INFO |
Logging level |
Copy .env.example to .env and customize as needed.
Available Tools
The server provides 25 core tools, with 3 additional SQL tools when installed with [sql] extras (28 total).
| Tool Group | Count | Tools |
|---|---|---|
| Workspace | 2 | list_workspaces, create_workspace |
| Item | 2 | list_items, delete_item |
| Notebook | 6 | import_notebook_to_fabric, get_notebook_content, attach_lakehouse_to_notebook, get_notebook_execution_details, list_notebook_executions, get_notebook_driver_logs |
| Job | 4 | run_on_demand_job, get_job_status, get_job_status_by_url, get_operation_result |
| Livy | 8 | livy_create_session, livy_list_sessions, livy_get_session_status, livy_close_session, livy_run_statement, livy_get_statement_status, livy_cancel_statement, livy_get_session_log |
| Pipeline | 3 | create_blank_pipeline, add_copy_activity_to_pipeline, add_activity_to_pipeline |
| SQL (optional) | 3 | get_sql_endpoint, execute_sql_query, execute_sql_statement |
SQL Tools (Optional)
SQL tools require pyodbc and the Microsoft ODBC Driver for SQL Server:
# Install with SQL support
pip install ms-fabric-mcp-server[sql]
# On Ubuntu/Debian, install the ODBC driver first:
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
If pyodbc is not available, the server starts with 25 tools (SQL tools disabled).
Development
# Clone and install with dev dependencies
git clone https://github.com/your-org/ms-fabric-mcp-server.git
cd ms-fabric-mcp-server
pip install -e ".[dev,sql,telemetry]"
# Run tests
pytest
# Run with coverage
pytest --cov
# Format code
black src tests
isort src tests
# Type checking
mypy src
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ms_fabric_mcp_server-0.6.2.tar.gz.
File metadata
- Download URL: ms_fabric_mcp_server-0.6.2.tar.gz
- Upload date:
- Size: 162.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f5b73de3772b87727deac1b15807dc69ff15dab53c9cf9bbaa31a18fab2be77
|
|
| MD5 |
4e4700a772e86dc87da15f336abf6f04
|
|
| BLAKE2b-256 |
394f0606fbabf3493abcab78d926be7cc836826f1dfad894547506901a558495
|
File details
Details for the file ms_fabric_mcp_server-0.6.2-py3-none-any.whl.
File metadata
- Download URL: ms_fabric_mcp_server-0.6.2-py3-none-any.whl
- Upload date:
- Size: 80.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5f97d3777b25da8f4812df208ef71e35eb348fe443275e75a83c97966dab6c3
|
|
| MD5 |
1ab9d1c4cce130e5f8e8a648673e7659
|
|
| BLAKE2b-256 |
4769afe97fa3b3f96d75d98f6d7bd00858a725a99a3264aed354cc7b98ec01c9
|