|
| 1 | +--- |
| 2 | +title: "Introducing the Visual Studio MCP Server!" |
| 3 | +date: "2026-01-14T12:00:00-05:00" |
| 4 | +categories: [dotnet, csharp, extensibility, visualstudio, ai, mcp] |
| 5 | +description: "A Visual Studio extension that exposes IDE features through the Model Context Protocol, enabling AI assistants to interact with Visual Studio programmatically." |
| 6 | +--- |
| 7 | + |
| 8 | +JetBrains is shipping MCP servers for their IDEs. Visual Studio isn't. |
| 9 | + |
| 10 | +So I wrote one. |
| 11 | + |
| 12 | +## VS MCP Server |
| 13 | + |
| 14 | +**VS MCP Server** exposes Visual Studio features as [MCP](https://modelcontextprotocol.io/) tools. Once connected, an AI assistant can: |
| 15 | + |
| 16 | +- Get information about your currently open solution and projects |
| 17 | +- Open, close, read, and write documents |
| 18 | +- Work with text selections and navigate the editor |
| 19 | +- Trigger builds and check build status |
| 20 | + |
| 21 | +All through the MCP protocol. It doesn't matter if you're using Claude Desktop, Cursor, Windsurf, or any other MCP-compatible client - they all speak the same language. |
| 22 | + |
| 23 | +## The Architecture |
| 24 | + |
| 25 | +Visual Studio extensions run on the UI thread, and blocking that is a recipe for a sluggish IDE. An MCP server needs to handle HTTP connections and process requests, so doing all that on the main thread wasn't going to work. |
| 26 | + |
| 27 | +The solution was to split things up. The extension spawns a separate process to handle HTTP/SSE communication with MCP clients. That process talks back to the Visual Studio extension via named pipes using JSON-RPC. Visual Studio stays responsive, the MCP server handles requests without blocking anything. |
| 28 | + |
| 29 | +```mermaid |
| 30 | +flowchart LR |
| 31 | + A[MCP Client<br/>Any AI Tool] <-->|HTTP/SSE<br/>:5050| B[MCPServer.Server<br/>Out of process] |
| 32 | + B <-->|Named Pipes<br/>JSON-RPC| C[VS Extension<br/>VS Integration] |
| 33 | +``` |
| 34 | + |
| 35 | +## Getting Started |
| 36 | + |
| 37 | +The extension is available on the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=CodingWithCalvin.VS-MCPServer). Install it, configure settings at **Tools > Options > MCP Server** if needed, then start the server via **Tools > MCP Server > Start Server** (or enable auto-start). |
| 38 | + |
| 39 | +From there, configure your MCP client to connect to `http://localhost:5050/sse`. The extension supports Visual Studio 2022 and 2026, on both ARM64 and AMD64. |
| 40 | + |
| 41 | +For the full list of available tools and configuration options, check out the [GitHub repo](https://github.com/CodingWithCalvin/VS-MCPServer). |
| 42 | + |
| 43 | +## What's Next |
| 44 | + |
| 45 | +The current toolset covers the basics - solutions, documents, editor operations, and builds. But there's a lot more potential here. I'm planning to integrate Roslyn to enable deeper code exploration capabilities. Imagine asking your AI assistant to find all usages of a method, or get the signature of a class, or navigate through the semantic model of your code. That's where things get really interesting. |
| 46 | + |
| 47 | +## Wrapping Up |
| 48 | + |
| 49 | +This is a new project, and I'm still finding the rough edges. If you run into issues or have ideas for additional tools, let me know. The source is on [GitHub](https://github.com/CodingWithCalvin/VS-MCPServer), and as always, I'm open to feedback and contributions. |
| 50 | + |
| 51 | +Thanks for reading! |
0 commit comments