1. Conduid
  2. Data
  3. MsBuildGraphMcp
MCP server · Data

MsBuildGraphMcp

MCP server for MSBuild project graph analysis — exposes dependency graphs, shared imports, TFM compatibility, configuration diffs, and build issue detection to LLM-powered coding assistants.

Unclaimed data
34Low

Scored 5 months ago · breakdown

About MsBuildGraphMcp

MsBuildGraphMcp is an MCP server in the Data category: mCP server for MSBuild project graph analysis — exposes dependency graphs, shared imports, TFM compatibility, configuration diffs, and build issue detection to LLM-powered coding assistants. It has been installed 0 times through Conduid.

Install

Clone
git clone https://github.com/FlorinVica/msbuild-graph-mcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

Ask AI about MsBuildGraphMcp

Powered by Claude · Grounded in docs

I know everything about MsBuildGraphMcp. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ·README presentNot checked yet.
  • ·License declaredNot checked yet.
  • ·Tests presentNot checked yet.
  • ·Dependencies pinnedNot checked yet.
  • ·No dynamic code executionNot checked yet.
  • ·Scoped permissionsNot checked yet.

README

MSBuild Project Graph MCP Server

CI NuGet .NET Tests

Pre-build static analysis of MSBuild solutions for LLM-powered coding assistants. Analyze project dependencies, detect build issues, inspect shared imports, and compare configurations — all through natural language, before building.

No existing MCP server provides pre-build project graph analysis. This fills that gap.

What It Does

Ask your AI assistant natural questions about your .NET/C++ solution:

  • "Show me the dependency graph for this solution" → Full DAG with topological sort
  • "Are there any TFM mismatches?" → Finds net6.0 projects referencing net8.0 libraries
  • "What does Directory.Build.props affect?" → Shows all projects importing each shared file
  • "Compare Debug vs Release" → Property and package reference differences
  • "Where does LangVersion come from?" → Traces to Directory.Build.props line 3

Tools

Tool Description
analyze_solution Parse .sln/.slnx/.slnf — projects, TFMs, output types, configurations
get_project_graph Build the full dependency DAG with topological sort and graph metrics
find_shared_imports Discover Directory.Build.props/.targets and other shared imports
detect_build_issues Find circular deps, TFM mismatches, orphan projects, platform mismatches
analyze_project_properties Inspect evaluated properties with source tracking (which file, which line)
compare_configurations Diff Debug vs Release (or any two configs) — properties, packages, references
analyze_impact "What breaks if I remove project X?" — direct + transitive dependents
check_package_versions NuGet package version consistency, CPM detection, VersionOverride tracking
get_build_order Lightweight build order (topological sort) with critical path length
list_projects Fast project listing without MSBuild evaluation — instant response

Supported Clients

✅ Works with

Client Config file Details
VS Code + GitHub Copilot .vscode/mcp.json Copilot agent mode calls MCP tools directly
VS Code + Continue.dev .vscode/mcp.json Works with Claude, GPT, or any LLM backend
Cursor .cursor/mcp.json Built-in AI calls MCP tools natively
Windsurf Settings UI Native MCP support via stdio transport
Claude Desktop claude_desktop_config.json Full tool + prompt support
Claude Code (terminal) CLI: claude mcp add Inline with terminal workflow
Visual Studio 2026 + Copilot .mcp.json in solution dir Native MCP support in VS 2026 Preview

❌ Not supported

Client Reason
Visual Studio 2022 Copilot in VS 2022 does not support MCP protocol
ChatGPT OpenAI uses a different protocol (function calling, not MCP)
Gemini Google uses a different protocol (not MCP)

Quick Start

Install

dotnet tool install -g MsBuildGraphMcp

Configure

Claude Desktop — add to %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "msbuild-graph": {
      "command": "msbuild-graph-mcp"
    }
  }
}

Claude Code:

claude mcp add msbuild-graph -- msbuild-graph-mcp

VS Code — add to .vscode/mcp.json:

{
  "servers": {
    "msbuild-graph": {
      "type": "stdio",
      "command": "msbuild-graph-mcp"
    }
  }
}

Cursor — add to .cursor/mcp.json:

{
  "mcpServers": {
    "msbuild-graph": {
      "command": "msbuild-graph-mcp"
    }
  }
}

Requirements

  • .NET SDK 8.0+ (or Visual Studio 2022+)
  • Windows (MSBuildLocator discovers VS/.NET SDK installations)

Example Output

get_project_graph

{
  "metrics": {
    "nodeCount": 4,
    "edgeCount": 3,
    "uniqueProjectCount": 4,
    "maxDepth": 2,
    "constructionTimeMs": 297
  },
  "projects": [
    {
      "name": "WebApp",
      "targetFrameworks": ["net8.0"],
      "outputType": "Exe",
      "isRoot": true,
      "references": ["DataLib\\DataLib.csproj", "CoreLib\\CoreLib.csproj"]
    }
  ],
  "topologicalOrder": [
    "CoreLib\\CoreLib.csproj",
    "DataLib\\DataLib.csproj",
    "WebApp\\WebApp.csproj"
  ]
}

detect_build_issues

{
  "totalIssues": 2,
  "frameworkMismatches": [{
    "project": "OldApp.csproj",
    "projectTfm": "net6.0",
    "dependency": "NewLib.csproj",
    "dependencyTfm": "net8.0",
    "reason": "net6.0 cannot consume net8.0"
  }],
  "orphanProjects": [{
    "name": "UnusedLib",
    "reason": "Library with no referencing projects"
  }]
}

Features

  • Pre-build analysis — no build required, evaluates MSBuild project files directly
  • .sln / .slnx / .slnf — supports all solution formats including the new .slnx (VS 17.10+)
  • Multi-targeting aware — correctly handles TargetFrameworks (plural) with outer/inner build deduplication
  • TFM compatibility — NuGet.Frameworks-based checking (net8.0-windows vs net8.0, netstandard2.0 vs net48, etc.)
  • Property source tracking — shows which file and line number defined each MSBuild property
  • Configuration diffing — compares any two configurations (Debug/Release, custom configs)
  • Circular dependency detection — catches both MSB4251 and CircularDependencyException
  • Shared import discovery — identifies Directory.Build.props, Directory.Build.targets, Directory.Packages.props
  • CPM detection — recognizes Central Package Management (ManagePackageVersionsCentrally)

Security

All tools are read-only — no builds are triggered, no files are modified.

Measure Description
IsBuildEnabled = false Prevents MSBuild target execution during evaluation
MSBUILDENABLEALLPROPERTYFUNCTIONS guard Server refuses to start if this dangerous env var is set
Path validation UNC paths rejected, extension whitelist, existence check
Fresh ProjectCollection per call No state leakage between tool invocations
try/finally cleanup Projects always unloaded, even on exception

Important: MSBuild property functions execute during evaluation (by design). Functions like $([System.IO.File]::ReadAllText(...)) run when a project is loaded. Only analyze projects you trust.

Architecture

┌──────────────────┐     stdio (JSON-RPC)   ┌─────────────────────┐
│ Claude / Copilot │◄──────────────────────►│ msbuild-graph-mcp   │
│ VS Code / Cursor │                        │                     │
└──────────────────┘                        │ MSBuildLocator      │
                                            │ ► ProjectGraph      │
                                            │ ► ProjectCollection │
                                            │ ► SolutionPersist   │
                                            └─────────────────────┘

Key architectural decisions:

  • MSBuildLocator JIT trap pattern — RegisterInstance() in Main(), MSBuild types only in [NoInlining] method
  • EvaluationContext.Shared via ProjectInstanceFactoryFunc — 2-5x speedup for large solutions
  • Parallelism capped at 8 — prevents memory exhaustion on high-core machines
  • Microsoft.Build 17.13.9 with ExcludeAssets="runtime" — avoids 17.14.8 dependency publishing bug

Testing

333 tests across 35 test files, sourced from 5 rounds of internet research covering 20+ sources:

dotnet test tests/MsBuildGraphMcp.Tests/
# Passed! - Failed: 0, Passed: 333, Skipped: 0, Total: 333, Duration: 12s

Test categories: validation, core tools, TFM compatibility, security (OWASP/CVE), solution formats, production resilience, concurrency, path edge cases, JSON serialization, real-world scenarios.

8 production bugs found and fixed during testing.

Complementary Tools

This server provides pre-build analysis. For post-build analysis (requires a completed build), see:

  • BinlogInsights.Mcp — 26 MCP tools + 13 CLI commands for MSBuild binary log analysis (build times, errors, performance, analyzers)
  • baronfel/mcp-binlog-tool — MSBuild binary log analysis (build times, errors, targets)

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT - FlorinVica

README mirrored from the source repository 5 months ago. The original is authoritative.

Questions

About MsBuildGraphMcp

How do I install MsBuildGraphMcp?

Run git clone https://github.com/FlorinVica/msbuild-graph-mcp, then add the server to your MCP client's configuration. Conduid has recorded 0 installs, so the command is known to work with current clients.

Is MsBuildGraphMcp safe to use with an AI agent?

Its trust score is 34 out of 100 (low). Conduid hasn't run static security checks on this repository yet, so review the source yourself before granting it credentials. It has no ConduID identity yet, so agent calls to it are not receipted.

Is MsBuildGraphMcp still maintained?

Conduid hasn't recorded a commit date for this repository yet. Check the repository directly for recent activity.