Token导航 LogoToken导航TokenDH.com
Fabric AI Gateway logo
数据服务stdio官方级别未说明来源级核验

Fabric AI Gateway

MCP Server

Fabric AI Gateway 是一个 MCP (Model Context Protocol) 服务器,允许 AI CLI (如 Gemini, Codex) 直接与 Microsoft Fabric Cloud 交互,无需 Windows VM 或 Power BI Desktop。

工具数

17

提示词数

0

GitHub Stars

1

资源数

0
Python数据分析API集成

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

ankinguyen-engineer-2002

提供方

ankinguyen-engineer-2002

最后核验

2026/5/17 20:20

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python3 -m venv venv

详细介绍

🚀 Fabric AI Gateway

MCP Server cho Microsoft Fabric Cloud - Chạy Native trên macOS

![Python 3.9+](https://www.python.org/downloads/) ![License: MIT](https://opensource.org/licenses/MIT)


📋 Mô tả

Fabric AI Gateway là một MCP (Model Context Protocol) Server cho phép AI CLI (Gemini, Codex) tương tác trực tiếp với Microsoft Fabric Cloud mà không cần Windows VM hoặc Power BI Desktop.

Hỗ trợ 2 chế độ:

ModeMô tảBackend
Semantic ModelĐọc schema, thực thi DAX, tạo/sửa MeasuresREST API + XMLA
Data WarehouseQuét cấu trúc, profiling, sampling, SQLpyodbc + ODBC 18

🏗️ Kiến trúc Hệ thống

┌─────────────────────────────────────────────────────────────────────────────┐
│                              USER                                           │
│                                │                                            │
│                    ┌───────────▼───────────┐                                │
│                    │   mcp_cloud_fabric.py │ ◄── Entry Point                │
│                    │   (Auth + Setup)      │                                │
│                    └───────────┬───────────┘                                │
│                                │                                            │
│              ┌─────────────────┼─────────────────┐                          │
│              ▼                 ▼                 ▼                          │
│   ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐            │
│   │   Gemini CLI     │ │   Codex CLI      │ │ Standalone CLI   │            │
│   │                  │ │                  │ │   (src/cli.py)   │            │
│   └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘            │
│            │ stdio              │ stdio              │ direct               │
│            └────────────────────┼────────────────────┘                      │
│                                 ▼                                           │
│                    ┌───────────────────────┐                                │
│                    │    MCP Server         │                                │
│                    │  (src/mcp_server.py)  │                                │
│                    │                       │                                │
│                    │  ┌─────────────────┐  │                                │
│                    │  │ Context Manager │  │ ◄── ~/.fabric-gateway/         │
│                    │  │                 │  │      context.json              │
│                    │  └─────────────────┘  │                                │
│                    └───────────┬───────────┘                                │
│                                │                                            │
│              ┌─────────────────┴─────────────────┐                          │
│              ▼                                   ▼                          │
│   ┌──────────────────────┐          ┌──────────────────────┐                │
│   │  SEMANTIC MODE       │          │  WAREHOUSE MODE      │                │
│   │  (13 Tools)          │          │  (3 Tools)           │                │
│   │                      │          │                      │                │
│   │  ● list_workspaces   │          │  ● get_warehouse_    │                │
│   │  ● list_datasets     │          │    tables            │                │
│   │  ● connect_dataset   │          │  ● execute_sql       │                │
│   │  ● get_tables        │          │  ● describe_table    │                │
│   │  ● get_columns       │          │                      │                │
│   │  ● get_measures *    │          └──────────┬───────────┘                │
│   │  ● get_relationships*│                     │                            │
│   │  ● execute_dax       │                     ▼                            │
│   │  ● get_dataset_info  │          ┌──────────────────────┐                │
│   │  ● refresh_dataset   │          │  warehouse_adapter   │                │
│   │  ● create_measure *  │          │  (pyodbc + Token)    │                │
│   │  ● delete_measure *  │          └──────────┬───────────┘                │
│   │  ● create_relationship*         │                            │
│   └──────────┬───────────┘                     │                            │
│              │                                 │                            │
│              ▼                                 ▼                            │
│   ┌──────────────────────┐          ┌──────────────────────┐                │
│   │  semantic_adapter    │          │  Fabric Warehouse    │                │
│   │  (REST API + DAX)    │          │  (SQL Endpoint)      │                │
│   └──────────┬───────────┘          └──────────────────────┘                │
│              │                                                              │
│              ▼                                                              │
│   ┌──────────────────────┐                                                  │
│   │  Power BI Service    │          * = Requires Premium/Fabric             │
│   │  (api.powerbi.com)   │                                                  │
│   └──────────────────────┘                                                  │
└─────────────────────────────────────────────────────────────────────────────┘

📁 Cấu trúc Project

MCP_Cloud_Fabric/
├── mcp_cloud_fabric.py          # 🚀 Entry Point - Auth + CLI Launch
├── config.yaml.template         # ⚙️ Config template (copy to config.yaml)
├── requirements.txt             # Python dependencies
├── CHANGELOG.md                 # 📝 Lịch sử thay đổi
│
├── src/
│   ├── mcp_server.py            # 🤖 MCP Server (JSON-RPC stdio)
│   ├── cli.py                   # 🖥️ Standalone CLI
│   ├── auth.py                  # 🔐 MSAL Authentication
│   ├── context_manager.py       # 📋 State Management
│   ├── semantic_adapter.py      # 📊 Power BI REST API + DAX
│   ├── warehouse_adapter.py     # 🗄️ SQL via pyodbc
│   └── utils/
│       ├── xmla_client.py       # XMLA wrapper
│       ├── tmsl_generator.py    # TMSL generator
│       ├── fabric_client_wrapper.py  # .NET client wrapper
│       └── FabricClient/        # 🔧 .NET Middleware (ADOMD/TOM)
│           ├── Program.cs
│           └── FabricClient.csproj
│
├── bin/TabularEditor/           # Windows binaries (Mono compatible)
│
├── scripts/                     # Shell launchers
│   ├── fabricgw, geminigw, codexgw
│
├── tests/                       # Unit tests (pytest)
│
└── docs/                        # Documentation

⚡ Yêu cầu Hệ thống

ComponentYêu cầu
OSmacOS (Apple Silicon hoặc Intel)
Python3.9+
ODBC DriverODBC Driver 18 for SQL Server
Azure ADApp Registration với Fabric permissions

Cài đặt ODBC Driver

brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
brew install msodbcsql18

🛠️ Cài đặt

# Clone repository
git clone 
cd MCP_Cloud_Fabric

# Tạo virtual environment
python3 -m venv venv
source venv/bin/activate

# Cài đặt dependencies
pip install -r requirements.txt

# Copy và cấu hình config
cp config.yaml.template config.yaml
# Sửa config.yaml với Client ID và Tenant ID của bạn

⚙️ Cấu hình

config.yaml

auth:
  client_id: "YOUR_AZURE_AD_APP_CLIENT_ID"
  tenant_id: "YOUR_AZURE_AD_TENANT_ID"

limits:
  max_dax_rows: 1000
  sample_rows: 10

Azure AD App Permissions

APIPermissionType
Power BI ServiceDataset.Read.AllDelegated
Power BI ServiceDataset.ReadWrite.AllDelegated
Power BI ServiceWorkspace.Read.AllDelegated
Azure SQL Databaseuser_impersonationDelegated

🚀 Sử dụng

Chạy CLI chính

python mcp_cloud_fabric.py

Flow sử dụng

1. Authenticate (Browser login)
         │
         ▼
2. Select Workspace
         │
         ▼
3. Select Mode ─────────────────────────┐
         │                              │
         ▼                              ▼
   [Semantic Model]              [Data Warehouse]
         │                              │
         │                              ▼
         │                    Enter SQL Endpoint
         │                    Enter Warehouse Name
         │                              │
         └──────────────┬───────────────┘
                        │
                        ▼
4. Select Interface ────────────────────┐
         │              │               │
         ▼              ▼               ▼
   [Gemini CLI]   [Codex CLI]   [Standalone]
         │              │               │
         ▼              ▼               ▼
    Chat với AI    Chat với AI    Gõ lệnh thủ công
    về data        về data        (dax, sql, etc.)

🔧 MCP Tools Reference

Semantic Model Mode (14 Tools)

ToolMô tảPremium?XMLA Write?
list_workspacesLiệt kê tất cả workspaces-
list_datasetsLiệt kê semantic models trong workspace-
connect_datasetKết nối tới một model-
get_tablesLấy danh sách tables + số columns-
get_columnsLấy chi tiết columns (có filter)-
get_measuresLấy tất cả measures-
get_relationshipsLấy tất cả relationships-
execute_daxChạy DAX query-
get_dataset_infoLấy metadata dataset-
refresh_datasetTrigger refresh-
create_measureTạo measure mới✅ Middleware
delete_measureXóa measure✅ Middleware
create_relationshipTạo relationship✅ Middleware
delete_relationshipXóa relationship✅ Middleware
macOS Support: Các tool write sử dụng .NET Middleware (FabricClient) với TOM API để thực thi trực tiếp qua XMLA endpoint. Nếu middleware không khả dụng, tool sẽ trả về TMSL script để chạy thủ công trong SSMS hoặc Tabular Editor.

Data Warehouse Mode (3 Tools)

ToolMô tả
get_warehouse_tablesLiệt kê all tables (có filter schema)
execute_sqlChạy SQL SELECT query
describe_tableLấy schema của bảng

🔒 Bảo mật

  • ✅ Token cache mã hóa tại ~/.fabric-gateway/token_cache.bin
  • ✅ Kết nối SQL được mã hóa (Encrypt=yes)
  • ✅ Không sử dụng TrustServerCertificate=yes
  • ✅ SQL queries được validate để chặn lệnh nguy hiểm
  • ✅ Context file chỉ lưu IDs, không lưu credentials

� License

MIT License


📚 Tài liệu thêm

目录标签

目录标签

Python数据分析API集成AICLI本地部署MicrosoftFabric数据仓库PowerBI

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

token

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

17

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiotoken部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP