A Model Context Protocol (MCP) server that provides tools for reading and editing Power BI semantic models via the Tabular Object Model (TOM) v19+. This server exposes TMDL manipulation capabilities to Visual Studio Code Agent mode and other MCP-compatible clients.
TOM-MCP bridges the gap between Power BI's Tabular Object Model and modern AI-assisted development tools by implementing the Model Context Protocol. It enables AI assistants to understand, analyze, and modify Power BI semantic models programmatically.
- List Tables: Enumerate all tables in a TMDL model
- List Measures: List all measures in a specific table
- Detect Unused Columns: Find columns not referenced by any measure or calculated column
- Add/Update Measures: Create new measures or modify existing ones
- Rename Objects: Rename tables, columns, or measures with automatic DAX reference updates
- Format Model: Deterministically format TMDL files for consistent Git diffs
- Validate Model: Comprehensive model validation using Tabular Editor 2
- Structural validation (TOM round-trip)
- Best Practice Analyzer (BPA) checks
- Progress streaming for long-running validations
- Diff TMDL: Stream Git-style unified diffs between TMDL files
- List Tools: Discover available tools in the MCP server
- .NET 8.0 or later
- Tabular Editor 2 (for validation features)
- Git (for diff functionality)
- Clone the repository:
git clone https://github.com/yourusername/tom-mcp.git
cd tom-mcp- Build the project:
dotnet build- Configure Tabular Editor 2 (for validation):
# Run the setup script
.\setup-te2.ps1Add to your .vscode/mcp.json:
{
"servers": {
"tom-mcp": {
"command": "dotnet",
"args": [
"C:\\repos\\tom-mcp\\bin\\Release\\net9.0\\tom-mcp.dll"
],
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"type": "stdio"
}
}
}tmdl_list_tables- Lists all tables in a TMDL modeltmdl_list_measures- Lists measures in a specific tabletmdl_detect_unused_columns- Finds unreferenced columns
addMeasure- Adds or updates a measuretmdl_rename_object- Renames objects and updates referencestmdl_format_model- Formats model for consistent version control
tmdl_validate_model- Comprehensive model validation with BPA
diff_tmdl- Compares two TMDL fileslist_tools- Lists all available tools
// In VS Code with GitHub Copilot
use #tmdl_validate_model to validate the model at "C:/MyModel/definition"use #addMeasure to add a measure named "Total Sales" with formula "SUM(Sales[Amount])" to table "Measures" in "C:/MyModel/definition"use #tmdl_rename_object to rename column "CustomerID" to "Customer ID" in table "Sales" at "C:/MyModel/definition"- Transport: Supports both stdio (for VS Code) and HTTP modes
- Framework: Built on MCP SDK 0.3.1-alpha
- Dependencies:
- Microsoft.AnalysisServices.Tabular (TOM)
- Tabular Editor 2 (for validation)
dotnet run -- --stdio# HTTP test endpoints available at:
# http://localhost:5000/test-echo
# http://localhost:5000/test-tmdl
# http://localhost:5000/test-validate- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
[Your License Here]
- Built with Model Context Protocol
- Powered by Tabular Object Model
- Validation by Tabular Editor