Visual Studio
FreeNot checkedConnect AI agents (Claude, ChatGPT, Gemini, etc.) to Visual Studio 2022/2026. MCP server for autonomous debugging, build management, and error analysis via COM.
About
Connect AI agents (Claude, ChatGPT, Gemini, etc.) to Visual Studio 2022/2026. MCP server for autonomous debugging, build management, and error analysis via COM.
README
A Model Context Protocol (MCP) server that connects AI coding assistants (like Claude) to Visual Studio 2022/2026 via COM automation.
This bridge enables AI agents to:
- 📖 Read build output, debug logs, and error lists
- 🔨 Build solutions and check for errors
- 🐛 Start/stop debugging sessions
- 📍 Inspect call stacks at breakpoints
Perfect for autonomous AI-driven development workflows where the agent can build, test, and debug without human intervention.
🚀 Quick Start
Prerequisites
- Windows 10/11
- .NET 8.0 SDK or higher
- Visual Studio 2022 or 2026 (must be running)
- Claude Desktop or another MCP-compatible client
Installation
Clone and build:
git clone https://github.com/YOUR_USERNAME/vs-mcp-bridge.git cd vs-mcp-bridge dotnet publish -c Release -f net8.0 -r win-x64 --self-contained falseRegister with Claude:
claude mcp add vs-bridge -- "<full-path>\bin\Release\net8.0\win-x64\publish\VisualStudioMcpServer.exe"Open Visual Studio with any solution, then start using the tools!
🛠️ Available Tools
Information Tools
| Tool | Description |
|---|---|
GetSolutionInfo |
Returns current solution path and list of projects |
ListOutputPanes |
Lists all Output Window panes (Build, Debug, etc.) |
ReadOutputPane |
Reads content from a specific pane (with truncation) |
GetErrorList |
Returns all errors and warnings from the Error List |
Build & Debug Tools
| Tool | Description |
|---|---|
BuildSolution |
Builds the solution and returns success/error count |
StartDebugging |
Starts debugging (F5) |
StartWithoutDebugging |
Runs without debugger (Ctrl+F5) |
StopDebugging |
Stops the current debug session |
GetDebuggerState |
Returns current state (design/running/breakpoint) |
GetCallStack |
Returns call stack when stopped at a breakpoint |
🤖 Autonomous Testing Workflow
Claude can now run this autonomous development loop:
1. BuildSolution → Check for compile errors
2. If errors: GetErrorList → Analyze and fix code → Rebuild
3. If success: StartDebugging
4. GetDebuggerState → Monitor execution
5. If at breakpoint: GetCallStack → Analyze the issue
6. StopDebugging → Make fixes → Repeat
⚙️ Technical Details
COM Message Filter
Visual Studio is a single-threaded COM server. When VS is busy (building, debugging), it rejects COM calls. This bridge implements IOleMessageFilter to automatically retry rejected calls.
.NET Core Compatibility
Since Marshal.GetActiveObject was removed in .NET Core, this project uses P/Invoke to oleaut32.dll and ole32.dll for COM object retrieval.
STAThread Requirement
COM automation requires a Single-Threaded Apartment (STA). The main thread is marked with [STAThread] to ensure proper COM interop.
📋 Tool Parameters
ReadOutputPane
paneName: string - Name (or partial name) of the pane to read
maxLines: int - Max lines to return from end (default: 50, 0 = all)
BuildSolution
waitForBuild: bool - Wait for completion (default: true)
format: string - Output format: "text" or "json"
GetErrorList / GetSolutionInfo / GetDebuggerState / GetCallStack
format: string - Output format: "text" or "json"
🔧 Troubleshooting
| Issue | Solution |
|---|---|
| "No VS instance found" | Ensure Visual Studio is running with a solution open |
| Tools not appearing | Restart Claude after re-registering the MCP |
| COM errors | Make sure VS isn't in a modal dialog (e.g., unsaved changes prompt) |
📄 License
MIT License - see LICENSE for details.
🤝 Contributing
Contributions welcome! Feel free to open issues or PRs.
Ideas for future tools:
SetBreakpoint- Add/remove breakpoints programmaticallyEvaluateExpression- Evaluate expressions in debugger contextOpenFile- Open specific files in VS editorNavigateToError- Jump to error location
Installing Visual Studio
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/alon-mini/visual-studio-mcpFAQ
Is Visual Studio MCP free?
Yes, Visual Studio MCP is free — one-click install via Unyly at no cost.
Does Visual Studio need an API key?
No, Visual Studio runs without API keys or environment variables.
Is Visual Studio hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Visual Studio in Claude Desktop, Claude Code or Cursor?
Open Visual Studio on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
GitHub
PRs, issues, code search, CI status
by GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
by mcpdotdirectCompare Visual Studio with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All development MCPs
