Skip to content

Commit 4dcdd9b

Browse files
Srinivas ThatipamulaCopilot
andcommitted
Add 12 new OneLake tools: Security, Shortcuts, Settings
- Data Access Security: list, get, create-or-update, delete roles - Shortcuts: list, get, create-or-update, delete, reset-cache - Settings: get, modify-diagnostics, modify-immutability-policy - Refactored DFS ListPath methods to follow ADLS Gen2 Path List API spec - Consolidated path resolution logic via ResolveDirectoryPath helper - Added 233 unit tests (309 total OneLake tests passing) - Updated OneLake and Fabric Server READMEs with new tool documentation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 87684ed commit 4dcdd9b

48 files changed

Lines changed: 3074 additions & 143 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

servers/Fabric.Mcp.Server/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ A local-first Model Context Protocol (MCP) server that provides AI agents with c
3030
- [Available Tools](#available-tools)
3131
- [API Documentation & Best Practices](#api-documentation--best-practices)
3232
- [OneLake Data Operations](#onelake-data-operations)
33+
- [OneLake Security — Data Access Roles](#onelake-security--data-access-roles)
34+
- [OneLake Shortcuts](#onelake-shortcuts)
35+
- [OneLake Settings](#onelake-settings)
3336
- [Core Fabric Operations](#core-fabric-operations)
3437
- [Support and Reference](#support-and-reference)
3538
- [Documentation](#documentation)
@@ -250,6 +253,33 @@ The Fabric MCP Server exposes tools organized into three categories:
250253
| `onelake_list_tables` | Lists tables published within a namespace. |
251254
| `onelake_get_table` | Retrieves the definition for a specific table. |
252255
256+
### OneLake Security — Data Access Roles
257+
258+
| Tool Name | Description |
259+
|-----------|-------------|
260+
| `onelake_list_data_access_roles` | Lists all data access roles defined on a single item. |
261+
| `onelake_get_data_access_role` | Gets the full definition of a single data access role (members, permissions, decision rules). |
262+
| `onelake_create_or_update_data_access_role` | Upserts a single data access role on a single item. |
263+
| `onelake_delete_data_access_role` | Deletes a single data access role from an item. |
264+
265+
### OneLake Shortcuts
266+
267+
| Tool Name | Description |
268+
|-----------|-------------|
269+
| `onelake_list_shortcuts` | Lists shortcuts defined within an item, recursing through subfolders. |
270+
| `onelake_get_shortcut` | Gets the properties of a single shortcut. |
271+
| `onelake_create_or_update_shortcuts` | Creates or updates one or more shortcuts in a single call. |
272+
| `onelake_delete_shortcut` | Deletes a single shortcut from an item (preserves destination data). |
273+
| `onelake_reset_shortcut_cache` | Drops cached shortcut reads, forcing re-resolution from destination. |
274+
275+
### OneLake Settings
276+
277+
| Tool Name | Description |
278+
|-----------|-------------|
279+
| `onelake_get_settings` | Gets OneLake settings for a workspace (diagnostics + immutability policy). |
280+
| `onelake_modify_diagnostics` | Modifies diagnostic logging configuration at workspace scope. |
281+
| `onelake_modify_immutability_policy` | Modifies the workspace-level OneLake immutability policy. |
282+
253283
### Core Fabric Operations
254284
255285
| Tool Name | Description |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
changes:
2+
- section: "Features Added"
3+
description: "Added 12 new OneLake tools: Data Access Security (list, get, create-or-update, delete roles), Shortcuts (list, get, create-or-update, delete, reset-cache), and Settings (get, modify-diagnostics, modify-immutability-policy)"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
changes:
2+
- section: "Bugs Fixed"
3+
description: "Refactored OneLake DFS ListPath methods to follow ADLS Gen2 Path List API specification (directory as query parameter)"

tools/Fabric.Mcp.Tools.OneLake/README.md

Lines changed: 228 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,24 @@ Microsoft Fabric OneLake MCP (Model Context Protocol) Tools - Manage and interac
77
OneLake is Microsoft Fabric's built-in data lake that provides unified storage for all analytics workloads. This MCP tool provides operations for working with OneLake resources within your Fabric tenant, enabling AI agents to:
88

99
- Manage OneLake folders and files
10-
- Configure data access and permissions
11-
- Monitor OneLake storage usage and performance
12-
- Integrate with other Fabric workloads through OneLake
10+
- Browse items, tables and namespaces
11+
- Configure OneLake data access security (role-based)
12+
- Create, list and manage shortcuts (including bulk + cache reset)
13+
- Read and modify workspace-level OneLake settings (diagnostics, immutability)
1314

1415
**Features:**
15-
- 19 comprehensive OneLake commands with full MCP integration
16+
- 31 comprehensive OneLake commands with full MCP integration
1617
- Complete coverage for OneLake table APIs: configuration, namespace discovery, and table metadata
17-
- Friendly-name support for workspaces and items across data-plane commands ( `item-create` currently requires GUID IDs )
18+
- Data access security management: list, get, create/update, and delete roles
19+
- Shortcut management: list, get, create/update, delete, and cache reset
20+
- Workspace-level settings: diagnostics and immutability policy configuration
21+
- Friendly-name support for workspaces and items across all commands
1822
- Robust error handling and authentication
19-
- Production-ready with 100% test coverage (132 tests)
23+
- Production-ready with 100% test coverage (309 tests)
2024
- Clean, focused API design optimized for AI agent interactions
2125

26+
> **Note:** Item creation has moved to the [Fabric.Mcp.Tools.Core](../Fabric.Mcp.Tools.Core/src) toolset as `core_create_item`. See [Core tools](../Fabric.Mcp.Tools.Core/src) for item creation operations.
27+
2228
## Prerequisites
2329

2430
- Microsoft Fabric workspace with OneLake enabled
@@ -41,12 +47,14 @@ The OneLake MCP tools are configured to use the Microsoft Fabric production envi
4147

4248
```
4349
OneLake Data Plane: https://api.onelake.fabric.microsoft.com
44-
OneLake DFS API: https://onelake.dfs.fabric.microsoft.com
45-
OneLake Blob API: https://onelake.blob.fabric.microsoft.com
46-
OneLake Table API: https://onelake.table.fabric.microsoft.com
47-
Fabric API: https://api.fabric.microsoft.com/v1
50+
OneLake DFS API: https://onelake.dfs.fabric.microsoft.com
51+
OneLake Blob API: https://onelake.blob.fabric.microsoft.com
52+
OneLake Table API: https://onelake.table.fabric.microsoft.com
53+
Fabric Core API: https://api.fabric.microsoft.com/v1
4854
```
4955

56+
> **Endpoint routing:** Security, shortcut and settings tools call the **Fabric Core API** (`api.fabric.microsoft.com`). All other tools target the OneLake data plane / DFS / Blob / Table endpoints.
57+
5058
### Getting Started
5159

5260
Simply use the commands without any environment configuration:
@@ -90,7 +98,7 @@ You can verify which environment you're targeting by checking the endpoints in t
9098

9199
### Workspace and Item Identifiers
92100

93-
All commands except `item create` accept either GUID identifiers or friendly names via the `--workspace` and `--item` options. The existing `--workspace-id` and `--item-id` switches remain available for scripts that already depend on them. Friendly-name inputs are sent directly to the OneLake APIs without local GUID resolution; when using names, specify the item as `<itemName>.<itemType>` (for example, `SalesLakehouse.lakehouse`). `item create` currently requires the GUID-based `--workspace-id` option. Table-based commands additionally accept schema identifiers through `--namespace` or its alias `--schema`.
101+
All commands accept either GUID identifiers or friendly names via the `--workspace` and `--item` options. The existing `--workspace-id` and `--item-id` switches remain available for scripts that already depend on them. Friendly-name inputs are sent directly to the OneLake APIs without local GUID resolution; when using names, specify the item as `<itemName>.<itemType>` (for example, `SalesLakehouse.lakehouse`). Table-based commands additionally accept schema identifiers through `--namespace` or its alias `--schema`.
94102

95103
```bash
96104
dotnet run -- onelake file list --workspace "Analytics Workspace" --item "SalesLakehouse.lakehouse" --path "Files"
@@ -172,18 +180,7 @@ dotnet run -- onelake item list-data --workspace-id "47242da5-ff3b-46fb-a94f-977
172180

173181
#### Create Item
174182

175-
Creates a new item (Lakehouse, Notebook, etc.) in a Microsoft Fabric workspace using the Fabric API.
176-
177-
```bash
178-
dotnet run -- onelake item create --workspace-id "47242da5-ff3b-46fb-a94f-977909b773d5" --display-name "NewLakehouse" --type "Lakehouse"
179-
```
180-
181-
> **Note:** `item create` currently requires the GUID-based `--workspace-id` switch; friendly workspace names are not supported for this command yet.
182-
183-
**Parameters:**
184-
- `--workspace-id`: The ID of the Microsoft Fabric workspace
185-
- `--display-name`: Display name for the new item
186-
- `--type`: Type of item to create (e.g., Lakehouse, Notebook)
183+
> **Moved:** The `item create` command has been moved to [Fabric.Mcp.Tools.Core](../Fabric.Mcp.Tools.Core/src) as `core_create_item`. Use the Core toolset for creating new items (Lakehouse, Notebook, etc.) in a Microsoft Fabric workspace.
187184
188185
### File Operations
189186

@@ -629,6 +626,172 @@ dotnet run -- onelake table get --workspace-id "47242da5-ff3b-46fb-a94f-977909b7
629626
- `--namespace`/`--schema`: Namespace (schema) name
630627
- `--table`: Table name to retrieve
631628

629+
### Security — Data Access Roles
630+
631+
These tools manage role-based data access policies on OneLake items (Lakehouse / Warehouse). All security tools call the **Fabric Core API** and require the caller to be a workspace Admin or Member.
632+
633+
#### List Data Access Roles
634+
635+
Lists all data access roles defined on a single item.
636+
637+
```bash
638+
dotnet run -- onelake security list --workspace "Analytics Workspace" --item "SalesLakehouse.lakehouse"
639+
```
640+
641+
**Parameters:**
642+
- `--workspace`/`--workspace-id`: Workspace identifier
643+
- `--item`/`--item-id`: Item identifier
644+
645+
#### Get Data Access Role
646+
647+
Gets the full definition of a single data access role — members, permissions, decision rules.
648+
649+
```bash
650+
dotnet run -- onelake security get --workspace "Analytics Workspace" --item "SalesLakehouse.lakehouse" --role-name "DataAnalysts"
651+
```
652+
653+
**Parameters:**
654+
- `--workspace`/`--workspace-id`: Workspace identifier
655+
- `--item`/`--item-id`: Item identifier
656+
- `--role-name`: Name of the data access role to retrieve
657+
658+
#### Create or Update Data Access Role
659+
660+
Upserts a single data access role on a single item. Scoped to one role per call — does not affect other roles.
661+
662+
```bash
663+
dotnet run -- onelake security create-or-update --workspace "Analytics Workspace" --item "SalesLakehouse.lakehouse" --role-name "DataAnalysts" --role-definition '{"members":{"fabricItemMembers":[{"itemAccessType":"ReadAll"}]},"decisionRules":[{"effect":"Permit","permission":[{"attributeName":"Path","attributeValueIncludedIn":["Tables/*"]}]}]}'
664+
```
665+
666+
**Parameters:**
667+
- `--workspace`/`--workspace-id`: Workspace identifier
668+
- `--item`/`--item-id`: Item identifier
669+
- `--role-name`: Name of the data access role
670+
- `--role-definition`: JSON definition of the role (members + decision rules)
671+
672+
#### Delete Data Access Role
673+
674+
Deletes a single data access role from a single item. Destructive — principals that gained access only via this role lose it.
675+
676+
```bash
677+
dotnet run -- onelake security delete --workspace "Analytics Workspace" --item "SalesLakehouse.lakehouse" --role-name "TempRole"
678+
```
679+
680+
**Parameters:**
681+
- `--workspace`/`--workspace-id`: Workspace identifier
682+
- `--item`/`--item-id`: Item identifier
683+
- `--role-name`: Name of the data access role to delete
684+
685+
### Shortcut Operations
686+
687+
Shortcuts are references to data stored in external or internal locations (ADLS Gen2, S3, GCS, OneLake, Dataverse, etc.). These tools call the **Fabric Core API**.
688+
689+
#### List Shortcuts
690+
691+
Lists shortcuts defined within an item, recursing through subfolders.
692+
693+
```bash
694+
dotnet run -- onelake shortcut list --workspace "Analytics Workspace" --item "SalesLakehouse.lakehouse"
695+
```
696+
697+
**Parameters:**
698+
- `--workspace`/`--workspace-id`: Workspace identifier
699+
- `--item`/`--item-id`: Item identifier
700+
- `--parent-path`: (Optional) Parent path to scope the listing
701+
702+
#### Get Shortcut
703+
704+
Gets the properties of a single shortcut (name, path, target, configuration).
705+
706+
```bash
707+
dotnet run -- onelake shortcut get --workspace "Analytics Workspace" --item "SalesLakehouse.lakehouse" --shortcut-name "ExternalData" --shortcut-path "Tables/ExternalData"
708+
```
709+
710+
**Parameters:**
711+
- `--workspace`/`--workspace-id`: Workspace identifier
712+
- `--item`/`--item-id`: Item identifier
713+
- `--shortcut-name`: Name of the shortcut
714+
- `--shortcut-path`: Path of the shortcut within the item
715+
716+
#### Create or Update Shortcuts
717+
718+
Creates one or more shortcuts in a single call. Pass `--create-or-overwrite` to upsert (default fails on conflict).
719+
720+
```bash
721+
dotnet run -- onelake shortcut create-or-update --workspace "Analytics Workspace" --item "SalesLakehouse.lakehouse" --shortcuts '[{"name":"ExternalData","path":"Tables/ExternalData","target":{"adlsGen2":{"location":"https://storageaccount.dfs.core.windows.net","subpath":"/container/path"}}}]'
722+
```
723+
724+
**Parameters:**
725+
- `--workspace`/`--workspace-id`: Workspace identifier
726+
- `--item`/`--item-id`: Item identifier
727+
- `--shortcuts`: JSON array of shortcut definitions
728+
- `--create-or-overwrite`: (Optional) If set, overwrites existing shortcuts
729+
730+
#### Delete Shortcut
731+
732+
Deletes a single shortcut from an item. The destination data is preserved — only the shortcut reference is removed.
733+
734+
```bash
735+
dotnet run -- onelake shortcut delete --workspace "Analytics Workspace" --item "SalesLakehouse.lakehouse" --shortcut-name "ExternalData" --shortcut-path "Tables/ExternalData"
736+
```
737+
738+
**Parameters:**
739+
- `--workspace`/`--workspace-id`: Workspace identifier
740+
- `--item`/`--item-id`: Item identifier
741+
- `--shortcut-name`: Name of the shortcut to delete
742+
- `--shortcut-path`: Path of the shortcut
743+
744+
#### Reset Shortcut Cache
745+
746+
Drops cached shortcut reads for an item, forcing the next read to re-resolve from the destination. Use sparingly — primarily for debugging stale-cache issues.
747+
748+
```bash
749+
dotnet run -- onelake shortcut reset-cache --workspace "Analytics Workspace" --item "SalesLakehouse.lakehouse"
750+
```
751+
752+
**Parameters:**
753+
- `--workspace`/`--workspace-id`: Workspace identifier
754+
- `--item`/`--item-id`: Item identifier
755+
756+
### Settings Operations
757+
758+
Workspace-level OneLake settings for diagnostics and immutability policies. These tools call the **Fabric Core API**.
759+
760+
#### Get Settings
761+
762+
Gets the OneLake settings for a workspace — diagnostics configuration and immutability policy.
763+
764+
```bash
765+
dotnet run -- onelake settings get --workspace "Analytics Workspace"
766+
```
767+
768+
**Parameters:**
769+
- `--workspace`/`--workspace-id`: Workspace identifier
770+
771+
#### Modify Diagnostics
772+
773+
Modifies the diagnostic logging configuration for OneLake at the workspace scope. Replaces the existing diagnostics block; fetch with `get settings` first if you want to merge.
774+
775+
```bash
776+
dotnet run -- onelake settings modify-diagnostics --workspace "Analytics Workspace" --diagnostics-config '{"logAnalyticsWorkspaceId":"<workspace-id>","level":"Verbose"}'
777+
```
778+
779+
**Parameters:**
780+
- `--workspace`/`--workspace-id`: Workspace identifier
781+
- `--diagnostics-config`: JSON configuration for diagnostic settings
782+
783+
#### Modify Immutability Policy
784+
785+
Modifies the workspace-level OneLake immutability policy. **Warning:** Once enabled, immutability cannot be disabled — confirm with the user before applying.
786+
787+
```bash
788+
dotnet run -- onelake settings modify-immutability --workspace "Analytics Workspace" --immutability-policy '{"state":"Enabled"}'
789+
```
790+
791+
**Parameters:**
792+
- `--workspace`/`--workspace-id`: Workspace identifier
793+
- `--immutability-policy`: JSON immutability policy configuration
794+
632795
## Quick Reference - fabmcp.exe Commands
633796

634797
For users with the compiled `fabmcp.exe` executable, here are ready-to-use commands:
@@ -699,6 +862,45 @@ fabmcp.exe onelake table list --workspace "Analytics Workspace" --item "SalesLak
699862
fabmcp.exe onelake table get --workspace "Analytics Workspace" --item "SalesLakehouse.lakehouse" --schema "sales" --table "transactions"
700863
```
701864

865+
### Security Operations
866+
```cmd
867+
# List data access roles on an item
868+
fabmcp.exe onelake security list --workspace "47242da5-ff3b-46fb-a94f-977909b773d5" --item "0e67ed13-2bb6-49be-9c87-a1105a4ea342"
869+
870+
# Get a specific role definition
871+
fabmcp.exe onelake security get --workspace "47242da5-ff3b-46fb-a94f-977909b773d5" --item "0e67ed13-2bb6-49be-9c87-a1105a4ea342" --role-name "DataAnalysts"
872+
873+
# Delete a data access role
874+
fabmcp.exe onelake security delete --workspace "47242da5-ff3b-46fb-a94f-977909b773d5" --item "0e67ed13-2bb6-49be-9c87-a1105a4ea342" --role-name "TempRole"
875+
```
876+
877+
### Shortcut Operations
878+
```cmd
879+
# List shortcuts on an item
880+
fabmcp.exe onelake shortcut list --workspace "47242da5-ff3b-46fb-a94f-977909b773d5" --item "0e67ed13-2bb6-49be-9c87-a1105a4ea342"
881+
882+
# Get a specific shortcut
883+
fabmcp.exe onelake shortcut get --workspace "47242da5-ff3b-46fb-a94f-977909b773d5" --item "0e67ed13-2bb6-49be-9c87-a1105a4ea342" --shortcut-name "ExternalData" --shortcut-path "Tables/ExternalData"
884+
885+
# Delete a shortcut
886+
fabmcp.exe onelake shortcut delete --workspace "47242da5-ff3b-46fb-a94f-977909b773d5" --item "0e67ed13-2bb6-49be-9c87-a1105a4ea342" --shortcut-name "ExternalData" --shortcut-path "Tables/ExternalData"
887+
888+
# Reset shortcut cache
889+
fabmcp.exe onelake shortcut reset-cache --workspace "47242da5-ff3b-46fb-a94f-977909b773d5" --item "0e67ed13-2bb6-49be-9c87-a1105a4ea342"
890+
```
891+
892+
### Settings Operations
893+
```cmd
894+
# Get workspace OneLake settings
895+
fabmcp.exe onelake settings get --workspace "47242da5-ff3b-46fb-a94f-977909b773d5"
896+
897+
# Modify diagnostics configuration
898+
fabmcp.exe onelake settings modify-diagnostics --workspace "47242da5-ff3b-46fb-a94f-977909b773d5" --diagnostics-config '{"logAnalyticsWorkspaceId":"<id>","level":"Verbose"}'
899+
900+
# Modify immutability policy
901+
fabmcp.exe onelake settings modify-immutability --workspace "47242da5-ff3b-46fb-a94f-977909b773d5" --immutability-policy '{"state":"Enabled"}'
902+
```
903+
702904
**Note:** Replace the workspace identifier (`47242da5-ff3b-46fb-a94f-977909b773d5`) and item identifier (`0e67ed13-2bb6-49be-9c87-a1105a4ea342`) with your actual Fabric workspace and item values (names or IDs).
703905

704906
## Common Usage Patterns
@@ -831,9 +1033,9 @@ This tool is part of the Microsoft MCP (Model Context Protocol) project. Please
8311033
The OneLake MCP Tools include a comprehensive test suite with 100% command coverage:
8321034

8331035
#### Test Structure
834-
- **Total Tests**: 76 tests (all passing)
835-
- **Command Tests**: 70 tests covering all 11 OneLake MCP commands
836-
- **Service Architecture Tests**: 6 tests demonstrating testable patterns with dependency injection
1036+
- **Total Tests**: 309 tests (all passing)
1037+
- **Command Tests**: Covering all OneLake MCP commands including security, shortcuts, and settings
1038+
- **Service Architecture Tests**: Demonstrating testable patterns with dependency injection
8371039

8381040
#### Running Tests
8391041
```bash

0 commit comments

Comments
 (0)