语义模型MCP服务器(v0.3.0)
一个模型上下文协议(MCP)服务器,用于连接到Microsoft Fabric和Power BI语义模型。该服务器提供了工具,用于浏览工作区、列出数据集、检索模型定义(TMSL)、执行DAX查询,以及针对语义模型创建或修改语义模型。
🆕 新品:最佳实践分析器 - 现在包含了针对71项行业最佳实践规则的语义模型全面分析!
一个专为语义模型作者设计的工具,允许您在VS Code Co-pilot中使用您自己的大型语言模型(LLM)与您的语义模型进行对话!!!
使用本地计算资源,而不是您的高级容量。
这个工具最适合在VS Code中运行,用作一个 *与你的语义模型聊天* 使用您自选的LLM服务器来实现该功能。
在VS Code中,副驾驶插件(Co-pilot)的限制远少于一些MCP客户端,并且还允许你自行调整/优化这段代码。
特点/功能
- 浏览 Power BI 工作区列出您租户中所有可用的工作区
- 数据集管理列出并探索工作区内的数据集
- 模型定义检索获取TMSL(Tabular Model Scripting Language,表格模型脚本语言)定义
- DAX 查询执行对语义模型运行DAX查询并获取结果
- 模型创建与编辑使用TMSL创建新的语义模型并更新现有模型
- Fabric 湖仓一体集成列出湖仓(lakehouse)、Delta 表,并获取 SQL 连接字符串
- DirectLake 模型支持创建和管理与Fabric数据湖仓库连接的DirectLake模型
- SQL 分析终端使用SQL查询湖仓表以进行模式验证和数据探索
- Microsoft Learn 集成搜索并访问微软的官方文档、教程和最佳实践
- TMSL 验证增强TMSL结构验证功能,提供详细的错误报告
- 工作区导航获取工作区ID并在不同环境之间导航
- 🆕 最佳实践分析器(BPA)对语义模型进行综合分析,对照行业最佳实践和微软建议
- 🆕 Power BI Desktop 检测自动检测并连接到本地的 Power BI Desktop 实例以进行开发和测试
🎯 最佳实践分析器(BPA)
语义模型MCP服务器现已包含一个功能强大的 最佳实践分析器 该工具会根据涵盖行业最佳实践和微软建议的71项全面规则,对您的语义模型进行评估。
什么是BPA?
最佳实践分析器会自动扫描您的语义模型(TMSL 定义),并识别多个类别中的潜在问题:
- 🚀 性能 - 优化建议以提高查询性能
- 💎 DAX 表达式 - DAX语法和模式的最佳实践
- 🔧 维护 - 模型可维护性和文档编制的规则
- 📝 命名规范 - 统一的命名标准
- 🎨 格式化 - 正确的格式和显示属性
- ⚠️ 防止错误 - 需要避免的常见陷阱和反模式
BPA(双酚A)严重程度等级
| 等级 | 名称 | 描述 | 示例问题 | ||
|---|---|---|---|---|---|
| (无对应中文) | (无对应中文) | (无对应中文) | (无对应中文) | ** | 🔴(红色)** 错误(3) |
| 严重 | 必须立即修复 | DAX语法错误,模型结构问题 | ** | 🟡(黄色方块)** 警告(2) | |
| 重要 | 需尽快处理 | 性能问题,非最优模式 | ** | 绿色(🟢)** 信息(1) |
| 建议 | 持续改进 | 格式调整、文档增强 |
可用的BPA工具 1.
#semantic_model_mcp_server analyze my [dataset_name] model for best practice violations分析已部署的模型 2.
#semantic_model_mcp_server run BPA analysis on this TMSL definition before deployment*在开发过程中分析TMSL*
注:自动处理JSON格式问题,包括换行符、转义引号以及嵌套的JSON字符串。 3.
#semantic_model_mcp_server generate a detailed BPA report for [dataset_name]生成综合报告 4.
#semantic_model_mcp_server show me only critical BPA errors in my model
#semantic_model_mcp_server get all WARNING level BPA issues按严重程度筛选 5.
#semantic_model_mcp_server show me all performance-related BPA violations
#semantic_model_mcp_server get DAX expression issues from BPA analysis按类别筛选 6.
#semantic_model_mcp_server what BPA rule categories are available?
#semantic_model_mcp_server show me a summary of loaded BPA rules获取BPA信息
常见的BPA违规行为及修复方法
🚀 性能问题❌ 问题 double 使用
"dataType": "double"金融金额的数据类型✅ 解决方案 decimal 使用
"dataType": "decimal"数据类型而不是❌ 问题
"isHidden": false外键对终端用户不隐藏✅ 解决方案
"isHidden": true隐藏外键列
💎 DAX 表达式问题❌ 问题
Average Price = [Total Sales] / [Total Quantity]使用“/”运算符进行除法运算✅ 解决方案
Average Price = DIVIDE([Total Sales], [Total Quantity])使用 DIVIDE() 函数来处理除以零的情况❌ 问题
Total Sales = SUM(SalesAmount)不合格的列引用✅ 解决方案
Total Sales = SUM(Sales[SalesAmount])使用完全限定的列引用
🎨 格式问题❌ 问题
{
"name": "Total Sales",
"expression": "SUM(Sales[SalesAmount])"
}度量值中缺少格式字符串✅ 解决方案
{
"name": "Total Sales",
"expression": "SUM(Sales[SalesAmount])",
"formatString": "#,0"
}添加适当的格式字符串
BPA(业务流程自动化)集成工作流 🔄(循环/重复)
1. Generate TMSL template
→ #semantic_model_mcp_server generate DirectLake TMSL template
2. Analyze before deployment
→ #semantic_model_mcp_server run BPA analysis on TMSL
3. Fix violations
→ Address critical errors and warnings
4. Deploy model
→ #semantic_model_mcp_server update model with validated TMSL
5. Final verification
→ #semantic_model_mcp_server analyze deployed model with BPA使用BPA的开发工作流程 🚨(警报/紧急情况的符号,无具体文字含义,可理解为“警报”或根据上下文翻译为相应的紧急提示)
1. Check for critical errors
→ #semantic_model_mcp_server get ERROR level BPA violations
2. Review performance issues
→ #semantic_model_mcp_server show performance-related BPA issues
3. Ensure documentation standards
→ #semantic_model_mcp_server check maintenance category violations质量门(或质量控制点)
BPA使用示例
You: "Analyze my Sales Model for best practice violations"
AI: [Runs BPA analysis and shows violations by category and severity]
You: "Show me only the critical errors"
AI: [Filters to ERROR level violations with specific recommendations]
You: "Generate a detailed BPA report"
AI: [Creates comprehensive report with all findings]示例1:全面模型健康检查
You: "My model is slow - what performance issues does BPA find?"
AI: [Analyzes model and highlights performance-related violations]
You: "Show me the specific DAX expressions that need fixing"
AI: [Filters to DAX expression category with examples]
You: "Research best practices for the issues you found"
AI: [Uses Microsoft Learn integration to provide authoritative guidance]示例2:性能优化
You: "I'm about to deploy this TMSL - run BPA analysis first"
AI: [Analyzes TMSL definition before deployment]
You: "Fix the critical issues and update the TMSL"
AI: [Applies BPA recommendations and validates changes]
You: "Now deploy the corrected model"
AI: [Deploys with confidence knowing BPA requirements are met]示例3:开发质量保证
BPA规则类别详解 🚀(火箭/快速上升/加速的符号,常用于表达快速进展或上升的趋势)
- 性能(24条规则)
- 避免使用浮点数据类型
- 隐藏外键并优化列属性
- 适当对大表进行分区
- 最小化计算列,使用星型模式
- 优化关系,避免过多的双向连接
减少Power Query转换 💎 翡翠宝石(或钻石,根据上下文可具体翻译)
- DAX 表达式(11条规则)
- 使用完全限定的列引用
- 使用不合格的测量参考标准
- 更倾向于使用DIVIDE()函数而非“/”运算符
- 避免使用 IFERROR() 函数以提高性能
- 使用 TREATAS 替代 INTERSECT
适当的时间智能模式 🔧(扳手或修理工具的符号,常用于表示需要修理或维护的含义)
- 维护(9条规则)
- 确保所有表格之间都有关联关系
- 为可见对象添加描述
- 移除未使用的视图和计算组
清理孤立对象 📝(这个符号本身在中文里没有直接对应的翻译,它通常代表“待办事项”或“笔记”的意思,可以翻译为“待办事项”或“笔记”等,具体根据上下文来确定)
- 命名规范(3条规则)
- 对象名称中不含特殊字符
- 去除名称中的空白字符
一致的命名模式 🎨 表示艺术或绘画的符号,可翻译为“🎨(艺术/绘画符号)”或根据上下文简化为“艺术/绘画”。在实际应用中,若该符号出现在文本中且无需特别强调其作为符号的意义,可直接保留原样或根据语境灵活处理。
- 格式化(17条规则)
- 为度量值和日期列提供格式字符串
- 适当标记主键
- 设定适当的数据类别
- 隐藏度量中使用的事实表列
使用一致的大小写 ⚠️(警告符号,无具体文字含义,可理解为“注意”或“警告”的意思)
- 防错设计(7条规则)
- 避免常见的反模式
- 防止破坏部署的配置
尽早发现语法和结构问题
高级BPA功能
自动化质量流水线
# Quality gate: No critical errors
if (bpa_errors > 0) block_deployment()
# Performance threshold
if (performance_violations > threshold) require_review()
# Documentation standards
if (missing_descriptions > limit) require_documentation()将BPA集成到您的CI/CD工作流中:
# Weekly health checks
#semantic_model_mcp_server generate weekly BPA report for all models
# Track improvements over time
#semantic_model_mcp_server compare current BPA results with last month
# Identify organization-wide patterns
#semantic_model_mcp_server analyze BPA trends across workspace持续模型健康监测
与 Microsoft Learn 的集成
You: "I have performance violations - research the best practices"
AI: [Uses BPA results + Microsoft Learn to provide authoritative guidance]
You: "Find official documentation for the DAX issues BPA found"
AI: [Searches Microsoft Learn for specific DAX patterns and recommendations]BPA与Microsoft Learn研究无缝集成:
- 开始使用BPA(业务流程自动化)🔍 从分析开始
"Analyze my model for best practice violations" - :🚨 重点关注关键点
"Show me only ERROR level BPA issues" - :🎯 目标类别
"What performance improvements does BPA suggest?" - :📚 研究解决方案
"Find Microsoft documentation for these BPA violations" - :✅ 验证修复
"Re-analyze the model after applying BPA recommendations"
:
最佳实践分析器确保您的语义模型遵循微软推荐的模式和行业标准,从而提升性能、可维护性和用户体验! 🎉
- 先决条件
- Python 3.8 或更高版本
- 访问 Microsoft Fabric/Power BI Premium 工作区
- 有效的微软认证(Azure AD)
- Analysis Services 库的 .NET Framework 依赖项
如果你在VS Code Copilot Chat中有权限使用高级模型,我建议使用ASK模式下的Claude Sonnet 4
🖥️ Power BI Desktop 集成 语义模型MCP服务器现在包含了强大的 Power BI Desktop 检测
这些功能能够实现与本地Power BI Desktop实例的无缝集成,以支持开发和测试工作流程。
什么是Power BI Desktop检测?
- 此功能可自动发现正在运行的 Power BI Desktop 进程及其关联的 Analysis Services 实例,使您能够:连接到本地模型
- 访问当前在 Power BI Desktop 中打开的语义模型开发测试
- 在发布前,先在本地实例上测试更改本地BPA分析
- 对开发中的模型运行最佳实践分析器调试
在开发过程中分析和调试模型
关键能力 🔍 翻译为中文是:“🔍”(注:这个符号本身在中文中通常不直接翻译,而是保持原样,表示放大镜,常用于表示搜索或查看细节的动作。如果需要解释其含义,可以说“放大镜”或“表示搜索/查看细节的符号”。)
- 自动发现
- 检测所有正在运行的 Power BI Desktop 进程
- 确定每个实例的Analysis Services端口号
- 查找当前打开的.pbix文件
生成即用型连接字符串 🔌(电源插头/插座)
- 连接测试
- 验证与本地 Analysis Services 实例的连接性
- 测试身份验证和访问权限
提供详细的连接诊断信息 🎯(目标)
- 开发集成
- 使用带有本地模型的BPA工具
- 在本地实例上执行DAX查询
分析本地 Power BI Desktop 模型中的 TMSL 定义
可用工具 1.
#semantic_model_mcp_server detect local Power BI Desktop instances检测正在运行的实例 2.
#semantic_model_mcp_server test connection to Power BI Desktop on port 55001测试本地连接 3.
#semantic_model_mcp_server analyze my local Power BI Desktop model for best practices本地BPA分析
它是如何工作的
- Power BI Desktop 为每个打开的 .pbix 文件运行一个本地的 Analysis Services 实例:进程检测
PBIDesktop.exe扫描以查找msmdsrv.exe并且 - 过程;程序港口探索(或译为:发现港)
- 识别动态端口(通常 > 50000)连接字符串
Data Source=localhost:{port} - 格式化为文件关联
将进程与其对应的.pbix文件关联起来
用例 🚀 火箭或快速前进的象征(常用于表达快速、进步或激动人心的事物)
- 开发工作流程
- 在 Power BI Desktop 中打开您的 .pbix 文件
- 使用MCP服务器检测本地实例
- 在开发过程中进行BPA分析
- 在发布前测试DAX查询
在本地验证模型更改 🧪 表示“试管”或“实验”的符号。
- 测试与验证
- 使用本地数据验证模型性能
- 测试新的计算方法和措施
- 验证关系和层级结构
检查格式设置和显示属性 🔧 修理工具或螺丝刀的符号,常用于表示需要维修或调整的物品或情境。
- 调试与故障排除
- 分析那些不会发布的模型
- 调试DAX表达式问题
- 调查性能问题
在部署前验证TMSL结构
# 1. Detect local Power BI Desktop instances
instances = detect_local_powerbi_desktop()
# 2. Get connection information
# Result: localhost:55001 (example port)
# 3. Test the connection
test_result = test_local_powerbi_connection(55001)
# 4. Run BPA analysis on local model
# Use the connection string with existing BPA tools
# 5. Execute DAX queries for testing
# Use local connection for development queries示例工作流程
安装
# Install the package
pip install semantic-model-mcp-server
# Or install specific version
pip install semantic-model-mcp-server==0.3.0选项1:从包注册表安装(推荐)
# Install directly from repository
pip install git+https://github.com/your-company/semantic-model-mcp-server.git
# Or clone and install locally
git clone https://github.com/your-company/semantic-model-mcp-server.git
cd semantic-model-mcp-server
pip install -e .选项2:从仓库安装(开发版)
git clone https://github.com/microsoft/fabric-toolbox.git
cd fabric-toolbox/tools/SemanticModelMCPServer
setup.bat
# or for the dev version
git clone --branch Semantic-Model-MCP-Server https://github.com/philseamark/fabric-toolbox.git
cd fabric-toolbox/tools/SemanticModelMCPServer
setup.bat选项3:传统设置(原始方法) 📖 如需团队安装的详细说明,请参阅
\TEAM_INSTALLATION_GUIDE.md\ 翻译成中文为:“团队安装指南.md”
2\. 启动MCP服务器
使用VS Code打开位于.vscode文件夹中的mcp.json文件,然后点击开始按钮(位于第2行和第3行之间)Start your MCP Server\[
\]
认证
- 服务器使用Azure Active Directory进行身份验证。请确保您已具备:
- 您Microsoft租户的有效凭据
- 访问您想要查询的Power BI/Fabric工作区
读取语义模型和执行DAX查询的权限
可用工具
#semantic_model_mcp_server list workspaces1. 列出Power BI工作区
#semantic_model_mcp_server list datasets in [workspace_name]2. 列出工作区中的数据集
#semantic_model_mcp_server get workspace id for [workspace_name]3. 获取工作区ID
#semantic_model_mcp_server get TMSL definition for [workspace_name] and [dataset_name]4. 获取模型定义
#semantic_model_mcp_server run DAX query against [dataset_name] in [workspace_name]5. 执行DAX查询
#semantic_model_mcp_server update model [dataset_name] in [workspace_name] using TMSL definition6. 使用TMSL更新模型
#semantic_model_mcp_server list lakehouses in [workspace_name]7. 列出Fabric Lakehouses(或译为“列出Fabric数据湖仓库”)
#semantic_model_mcp_server list delta tables in lakehouse [lakehouse_name]8. 列出Delta表
#semantic_model_mcp_server get SQL connection string for lakehouse [lakehouse_name]9. 获取Lakehouse SQL连接
#semantic_model_mcp_server search Microsoft Learn for DirectLake best practices10. 研究Microsoft Learn文档
#semantic_model_mcp_server run SQL query against lakehouse to validate table schemas11. 使用SQL查询Lakehouse
#semantic_model_mcp_server generate DirectLake TMSL template for tables in [lakehouse_name]12. 生成DirectLake TMSL模板
#semantic_model_mcp_server analyze my model for best practice violations
#semantic_model_mcp_server generate BPA report for [dataset_name]
#semantic_model_mcp_server show me critical BPA errors
#semantic_model_mcp_server get performance-related BPA issues13. 🆕 最佳实践分析工具
使用示例
#semantic_model_mcp_server list workspaces示例1:探索可用的工作区
#semantic_model_mcp_server get the TMSL definition for the DAX Performance Tuner Testing workspace and the Contoso 100M semantic model示例2:获取模型定义
#semantic_model_mcp_server run a DAX query to count rows in the fact table示例3:执行DAX查询
#semantic_model_mcp_server run a DAX query sum quantity by year示例4:按年份分析数据
#semantic_model_mcp_server create a DirectLake model using tables from the GeneratedData lakehouse示例5:创建DirectLake模型
#semantic_model_mcp_server add a new calculated column to the sales table in my model示例6:更新模型架构
入门指南:聊天提示示例
一旦您在VS Code中启动了MCP服务器,就可以使用这些示例提示开始与您的语义模型进行聊天。只需在VS Code的聊天界面中输入这些提示,AI就会利用MCP服务器与您的数据进行交互: 🔍(放大镜图标,通常表示搜索或查看细节)
发现与探索
#semantic_model_mcp_server list all my Power BI workspaces“我可以使用哪些工作空间?”
#semantic_model_mcp_server list datasets in [Your Workspace Name]“显示我主工作区中的所有数据集”
#semantic_model_mcp_server get the TMSL definition for [Workspace Name] and [Dataset Name]“我的销售模式结构是怎样的?” 📊 表格、数据图表
基本数据分析
#semantic_model_mcp_server run a DAX query to count rows in the fact table“我的事实表中有多少行?”
#semantic_model_mcp_server run a DAX query to show sales amount by product category, ordered by highest sales“按销售额划分,我的顶级产品类别有哪些?”
#semantic_model_mcp_server run a DAX query to sum sales amount by year“按年份显示销售趋势” 🎯(目标)
特定业务问题
#semantic_model_mcp_server run a DAX query to find the month with highest sales in 2023“我们去年表现最好的月份是哪个月?”
#semantic_model_mcp_server run a DAX query to show top 10 customers by total quantity purchased“哪些客户购买的产品最多?”
#semantic_model_mcp_server run a DAX query to calculate profit margin percentage by product category“我们各类产品的利润率是多少?” 🔬(表示科学、实验室或显微镜等意思的符号)
高级分析
#semantic_model_mcp_server create a DAX query that calculates YoY growth percentage for sales by category“给我展示每个产品类别的同比增长率”
#semantic_model_mcp_server run a DAX query to calculate average order value grouped by customer segment“按客户细分来看,平均订单价值是多少?”
#semantic_model_mcp_server write a DAX query to identify products with no sales in the last 180 days“查找过去6个月内未售出的产品” 🛠️(扳手)
模型创建与管理
#semantic_model_mcp_server create a DirectLake model using the business tables from my GeneratedData lakehouse“从我的湖仓表中创建一个新的DirectLake模型”
#semantic_model_mcp_server add a Total Profit measure to my sales model that calculates SalesAmount minus TotalCost“在我的现有模型中添加一个新指标”
#semantic_model_mcp_server modify my semantic model to include the new customer demographics table“更新我的模型以包含一个新表”
#semantic_model_mcp_server add a relationship between the sales table and the new product category table“在我的模型中创建表之间的关系” 🏗️(建筑工地/施工中)
Fabric 湖仓一体集成
#semantic_model_mcp_server list all lakehouses in my workspace“我的工作区域内有哪些湖畔别墅可供选择?”
#semantic_model_mcp_server list all Delta tables in the GeneratedData lakehouse“在湖仓中显示我的Delta表”
#semantic_model_mcp_server get the SQL endpoint connection for my lakehouse“获取我的数据湖仓库的SQL连接字符串”
#semantic_model_mcp_server query the lakehouse SQL endpoint to check column names and data types for the sales table“在创建 DirectLake 模型之前验证表架构” 📚 书籍或学习的象征
Microsoft Learn 研究与文档
#semantic_model_mcp_server search Microsoft Learn for DAX performance optimization best practices“查找最新的DAX最佳实践”
#semantic_model_mcp_server find Microsoft Learn articles about DirectLake requirements and limitations“Research DirectLake 实施指南”
#semantic_model_mcp_server search Microsoft Learn for TMSL tabular object reference and examples“获取TMSL语法文档”
#semantic_model_mcp_server search Microsoft Learn for the latest Power BI features and capabilities“查找 Power BI 的功能更新”
#semantic_model_mcp_server get Microsoft Learn learning paths for Microsoft Fabric data engineering“探索 Microsoft Fabric 学习路径”
#semantic_model_mcp_server search Microsoft Learn for star schema design best practices and patterns“研究数据建模模式”
#semantic_model_mcp_server search Microsoft Learn for Power BI performance troubleshooting guides“查找故障排除指南” 🛠️(工具/修理)
模型优化
#semantic_model_mcp_server get the TMSL definition and show me all the measures“我的模型中定义了哪些措施?”
#semantic_model_mcp_server show me the relationships in my semantic model“有没有什么关系是我应该注意的?”
#semantic_model_mcp_server analyze the TMSL definition and list any hidden tables or columns“我的模型中隐藏了哪些表格?” 💡 灯泡(表示灵感、想法或创意的出现)
- 优化提示语的技巧要具体明确
- 当您知道时,请包含工作区名称和数据集名称使用自然语言
- 该AI可以将您的业务问题转换为DAX查询语句要求解释
- 加上“并解释结果”以理解数据的含义请求可视化数据
- 询问“创建一个汇总表”或“将结果格式化得美观些”基于之前的查询进行构建
参考早期结果以深入挖掘见解 🚀 这个符号本身没有具体的中文翻译,它通常被用作表示火箭、快速移动或加速的符号。在中文语境中,我们可能会直接使用这个符号或者用文字描述其含义,比如“火箭”、“快速前进”等。如果要将其融入句子中,可能会说“🚀 我们即将发射火箭!”或者“🚀 看,火箭升空了!”
- 开始工作流程从探索开始
"What workspaces do I have access to?" - :探索您的数据
"Show me the structure of my [dataset name] model" - :提出简单的问题
"How many rows of data do I have?" - :“Progress to Business Questions”可以翻译为“向商业问题的进展”或“商业问题的进展概述”,具体翻译取决于上下文和语境。如果是指某个项目或计划在商业方面取得的进展,那么“商业进展”或“商业方面取得的进展”也是合适的翻译
"What are my top selling products?" - :深入分析
"Show me trends and patterns in my sales data" - :🆕 确保质量
"Analyze my model for best practice violations"
: 🎯(目标/瞄准)
最佳实践分析器提示
#semantic_model_mcp_server analyze my [dataset name] model for best practice violations“我的模型是否遵循了最佳实践?”
#semantic_model_mcp_server show me only ERROR level BPA violations in my model“我的模型中存在哪些最关键的问题?”
#semantic_model_mcp_server get all performance-related BPA recommendations for my model“我如何提高我的模型性能?”
#semantic_model_mcp_server analyze DAX expressions in my model using BPA rules“检查我的DAX表达式以遵循最佳实践”
#semantic_model_mcp_server create a comprehensive BPA report for [dataset name]“为我的模型生成一份质量报告”
#semantic_model_mcp_server show me BPA violation counts by category and severity“我应该重点关注哪些BPA类别?”
#semantic_model_mcp_server run BPA analysis on this TMSL definition to check for issues“在部署前验证我的TMSL” 📝
You: "What workspaces do I have access to?"
AI: [Lists your workspaces using the MCP server]
You: "Show me the datasets in my 'Sales Analytics' workspace"
AI: [Lists datasets in that workspace]
You: "Get the structure of my 'Sales Model' dataset"
AI: [Retrieves TMDL definition showing tables, measures, relationships]
You: "Create a DirectLake model using the tables from my GeneratedData lakehouse"
AI: [Uses MCP server to list lakehouse tables and creates TMSL definition for DirectLake model]
You: "Now add a calculated measure for profit margin to this model"
AI: [Modifies the TMSL to include new measure and updates the model]
You: "Show me the relationships in this new model"
AI: [Retrieves updated TMSL definition and displays the relationships]
You: "That's interesting - can you show me the trend for the 'Electronics' category over time?"
AI: [Creates and runs a more specific DAX query for Electronics trends]示例完整对话
记住:当您在提示中提到数据分析、DAX查询或语义模型探索时,AI助手将自动使用MCP服务器工具!
模型上下文协议(MCP)
- 这台服务器实现了模型上下文协议,使得人工智能助手和其他工具能够: 发现
- 可用的语义模型和工作区 检查
- 模型结构和元数据 查询
- 使用DAX表达式处理数据 创造
- 从Fabric数据湖仓库或其他数据源中获取新的语义模型 修改
- 通过更新TMSL定义来改进现有模型 管理
- 与Fabric数据湖仓库连接的DirectLake模型 检索
- 用于分析的完整模型定义 研究
- 通过Microsoft Learn集成获取官方微软文档和最佳实践 验证
- 使用SQL Analytics Endpoint查询的表架构 生成
- 带有适当结构验证的DirectLake TMSL模板 🆕 分析
- 使用全面的业务流程分析(BPA)规则构建最佳实践合规的语义模型 🆕 报告
- 关于模型质量的详细违规情况及改进建议 🆕 优化
通过自动化最佳实践分析提升模型性能
- 技术架构FastMCP 框架
- 使用FastMCP Python框架构建Analysis Services(分析服务)
- 利用Microsoft Analysis Services .NET库XMLA 端点
- 通过XMLA端点连接到Power BI微软学习API
- 与 Microsoft Learn 集成,以便访问官方文档和教程SQL Analytics 终端节点
- 连接到Fabric湖仓SQL端点以进行模式验证和数据探索认证
- 使用Microsoft Identity Client进行安全认证TMSL 验证
增强的表格式建模脚本语言验证引擎
- 支持的数据源
- Power BI Premium 工作区
- Microsoft Fabric 语义模型
- Analysis Services 表格式模型
- Fabric Lakehouses(布制数据湖仓库)和Delta Tables(Delta表)
- DirectLake 存储模式
任何XMLA兼容的端点
故障排除
- 常见问题认证错误
- 确保您拥有有效的Azure AD凭据和工作区访问权限连接超时
- 检查网络连接和工作区可用性权限被拒绝
验证您对目标工作区和语义模型具有读取权限
调试模式
python debug.py以调试模式运行以进行故障排除:
做出贡献 欢迎投稿!请参阅主页 fabric-toolbox 仓库
关于贡献指南。
许可证 这个项目遵循MIT许可证授权——详见 许可证
文件中有详细信息。
- 相关工具 DAX性能测试
- - DAX 查询的性能测试框架 Microsoft Fabric 管理
- - 用于Fabric管理的PowerShell模块 织物负载测试工具
