How utkarshsinghshorthillsai/fabricmcp_server works
Project type and purpose
• This is a backend API microservice (Python, Uvicorn) that exposes Microsoft Fabric operations (“tools”) to an LLM-based MCP Client.
• Its responsibilities: authenticate with Azure, translate MCP Client calls into Fabric API calls, manage sessions, and return responses.
File structure
• Top-level:
• .env.example, pyproject.toml, uv.lock → configuration and dependency management (Poetry/uv)
• src/fabricmcp_server/app.py → entry point (FastAPI or similar)
• fabric_api_client.py → wrapper for direct Fabric REST API calls
• fabric_models.py → Pydantic or data classes for request/response schemas
• sessions.py → in-memory/session caching of Fabric credentials or LLM context
• activity_types.py → definitions of supported MCP activities
• tools/ → individual modules (connection_manager, items, lakehouses, notebooks, pipelines, universal_copy_activity) that implement each Fabric “tool”
README for stack and workflows
• Python 3.10+, uv (Uvicorn-like CLI), virtual env, MCP Client integration
• Workflow: MCP Client → HTTP → Server → Fabric API Client → Microsoft Fabric REST endpoints
Main components and interactions
a. MCP Client (LLM)
• Sends JSON-RPC or REST calls invoking “tools”
b. API Server (app.py)
• HTTP framework (FastAPI or similar under Uvicorn) handles incoming requests
• Routes requests to the appropriate tool module
c. Tool Modules (tools/*.py)
• Each module implements a business function (e.g., create lakehouse)
• Use fabric_api_client for HTTP calls to Fabric
d. Fabric API Client
• Handles authentication (via credentials from .env), token management, and request/response serialization
e. Azure/Microsoft Fabric Services
• External: Lakehouses, Notebooks, Pipelines, etc.
f. Session Manager
• Maintains session state (optional caching of tokens or context)
Architectural patterns & design principles
• Modular tool-based design: each Fabric feature lives in its own module under tools/
• Single‐responsibility: fabric_api_client vs. fabric_models vs. sessions
• Dependency injection via environment config (.env) for service principal credentials
• Stateless HTTP API; transient sessions managed in memory or simple cache