Content
# MSBuild Binary Log Analyzer - MCP Server
This is a demo of an Model Context Protocol (MCP) server for analyzing MSBuild binary log files (`.binlog`) with AI assistance.
This project builds upon the demo provided by [baronfel/mcp-binlog-tool](https://github.com/baronfel/mcp-binlog-tool). The key feature of this analyzer is its ability to search binary logs with larger returned context that allows finding detailed build information while still keeping token count in check. As a result AI also can do the smart diff of the binlogs if good and bad binlogs are provided. Additional code and insights from [JanProvaznik/binlogAInalyzer](https://github.com/JanProvaznik/binlogAInalyzer) were also incorporated.
## Installation
### Global Tool Installation
Install as a .NET global tool:
```bash
dotnet build
dotnet pack .\binlog.mcp\binlog.mcp.csproj
dotnet tool install --global --add-source "binlog.mcp\bin\Release" ar-may.binlog.mcp
```
## VS Code Configuration
Configure the MCP server in your `mcp.json` file:
```json
{
"servers": {
"binlog-analyzer": {
"command": "ar-may.binlog.mcp",
"args": []
}
}
}
```
## Usage
### Basic Workflow
- Generate a binary log during build
- Use the `initial_binlog_instructions` prompt to start and ask questions about your binlog.
## Available Tools
### Core Tools
- **`load_binlog`**: Load and index a binary log file for analysis
### Search and Navigation
- **`search_binlog`**: Search through build events with structured queries and rich context
- **`get_node_details`**: Get comprehensive information about a specific build node by ID
- **`get_node_path`**: Show hierarchical path from build root to a specific node
### Project and Target Analysis
- **`list_projects`**: List all projects with entry targets, durations, and project IDs
- **`get_expensive_targets`**: Identify performance bottlenecks by slowest targets
- **`get_project_target_list`**: List all targets executed within a specific project
- **`get_target_info_by_name`**: Get detailed target information by searching by name
- **`get_target_info_by_id`**: Get detailed target information using unique target ID
### File System Analysis
- **`get_embedded_file_content`**: Retrieve content of files embedded in the binlog
- **`list_embedded_files`**: List all embedded files in the binlog
- **`get_double_writes`**: Detect files that were written multiple times during build
- **`get_file_copy_details`**: Analyze file copy operations and their details
- **`search_in_embedded_files`**: Search within embedded source files
### Evaluation Analysis
- **`list_evaluations`**: List all evaluations for a specific project
- **`get_evaluation_global_properties`**: Get global properties for a specific evaluation
## Available Prompts
- **`initial_binlog_instructions`**: Set MSBuild Binary Log Analysis Agent Persona - Use this to start your analysis session
- **`analyze_errors_warnings`**: Analyze Build Errors and Warnings - Focus on build failures and issues
- **`analyze_performance`**: Analyze Build Performance - Focus on build timing and optimization opportunities
## Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
**Note**: The quality of this code is best described as "vibe-coded" - it works for its intended purpose.