Copilot CLI IDE Bridge for Visual Studio
A Visual Studio extension that enables GitHub Copilot CLI to interact with Visual Studio via the /ide command — the same way it works with VS Code.
How It Works
- Package loads when a solution is opened in Visual Studio (
ProvideAutoLoad)
- RPC server starts on a named pipe, exposing VS services (DTE, diff, diagnostics)
- MCP server process launches as a separate net10.0 child process, connecting back to VS via RPC
- Lock file written to
~/.copilot/ide/ with the MCP pipe path, auth nonce, and workspace folders
- Copilot CLI discovers the lock file via
/ide, connects, and calls MCP tools to interact with VS
- Solution changes tracked — when you close/open solutions, the lock file's workspace folders update automatically
- Stale files cleaned — on startup, lock files and log files from dead processes are removed
Getting Started
Prerequisites
- Visual Studio 2022 (v17.x) or Visual Studio 2026 (v18.x)
- GitHub Copilot CLI installed
- An active Copilot subscription
- .NET 10.0 SDK (for the MCP server process)
Build & Install
# Clone and build
git clone https://github.com/sailro/CopilotCliIde
# Build both the VSSDK package and the MCP server
dotnet build src/CopilotCliIde.Server/CopilotCliIde.Server.csproj
dotnet build src/CopilotCliIde/CopilotCliIde.csproj
# The .vsix is produced at:
# src/CopilotCliIde/bin/Debug/CopilotCliIde.vsix
Double-click the .vsix to install, or use F5 in Visual Studio to debug in the experimental instance.
Usage
- Open a solution in Visual Studio — the extension activates automatically
- Open Copilot CLI in a terminal, with the working directory matching the solution folder
- Run
/ide in Copilot CLI — it discovers Visual Studio and connects
$ copilot
> /ide
✓ Connected to Visual Studio (CopilotCliIde)
Once connected, the agent can:
- Query solution info — ask "What solution is open?"
- Read file content — from disk, with line range support
- See your selection — ask "What text do I have selected?"
- Propose diffs — the agent opens a real VS diff view using
IVsDifferenceService
- Check diagnostics — get errors and warnings from the VS Error List
The extension exposes 7 MCP tools to the Copilot CLI agent:
| Tool |
Description |
get_vscode_info |
Solution path, name, project list |
get_selection |
Active editor selection: text, file path, line/column range |
get_diagnostics |
Errors and warnings from the VS Error List (filterable by URI) |
read_file |
Read file content from disk (supports line ranges) |
open_diff |
Open a real VS diff view comparing original with proposed changes. Blocks until user acts. |
close_diff |
Close a diff tab by its tab name |
update_session_name |
Set the CLI session display name |
get_vscode_info
Returns information about the current Visual Studio instance:
{
"ideName": "Visual Studio",
"solutionPath": "C:\\Dev\\myproject\\MyProject.sln",
"solutionName": "MyProject",
"solutionDirectory": "C:\\Dev\\myproject",
"projects": [{ "name": "MyProject", "fullName": "..." }],
"processId": 12345
}
get_selection
Returns the current editor selection, read on-demand from DTE:
{
"current": true,
"filePath": "C:\\Dev\\myproject\\Program.cs",
"selectedText": "Console.WriteLine(\"Hello\");",
"startLine": 10,
"startColumn": 8,
"endLine": 10,
"endColumn": 35,
"isEmpty": false
}
get_diagnostics
Returns errors and warnings from the Visual Studio Error List. Accepts an optional uri parameter to filter by file:
{
"diagnostics": [
{
"severity": "vsBuildErrorLevelHigh",
"message": "The name 'x' does not exist in the current context.",
"file": "C:\\Dev\\myproject\\Program.cs",
"line": 12,
"column": 5,
"project": "MyProject"
}
]
}
read_file
Reads file content from disk with optional line range:
{
"filePath": "C:\\Dev\\myproject\\Program.cs",
"content": "using System;\n...",
"totalLines": 42,
"startLine": 1,
"linesReturned": 10
}
open_diff / close_diff
The diff workflow lets the agent propose changes that you review in VS:
- Agent calls
open_diff with original_file_path, new_file_contents, and tab_name → a real VS diff view opens via IVsDifferenceService
- You review the changes in the native diff viewer
- Agent calls
close_diff with the same tab_name to close the diff tab
Note: Tool names and schemas match VS Code's Copilot Chat extension exactly (get_vscode_info, get_selection, open_diff, close_diff, get_diagnostics, update_session_name) to ensure full compatibility with the Copilot CLI /ide protocol.
Architecture
Protocol Stack
- MCP Transport: Windows named pipe (
\\.\pipe\mcp-{uuid}.sock) with HTTP/1.1 + Nonce auth
- RPC Transport: Windows named pipe (
\\.\pipe\copilot-cli-rpc-{uuid}) with StreamJsonRpc
- Discovery: Lock files in
~/.copilot/ide/{uuid}.lock
- Diagnostics: Per-process log files in
~/.copilot/ide/ (vs-error-{pid}.log, vs-connection-{pid}.log)
{
"socketPath": "\\\\.\\pipe\\mcp-{uuid}.sock",
"scheme": "pipe",
"headers": { "Authorization": "Nonce {uuid}" },
"pid": 12345,
"ideName": "Visual Studio",
"timestamp": 1672531200000,
"workspaceFolders": ["C:\\Dev\\myproject"],
"isTrusted": true
}
License
MIT