VS Code MCP BridgeA VS Code extension that hosts a Model Context Protocol (MCP) HTTP server, exposing your live IDE state to AI coding agents — active file, cursor position, LSP diagnostics, visual diffs, git status, and more. Quickest way to get startedJust point your AI coding tool at this README and tell it to install the MCP for you. Features
Setup1. Install the extensionInstall from VSIX or the VS Code Marketplace. The server starts automatically when VS Code opens. 2. Connect your MCP clientThe server runs on
Most tools have a config file or settings UI where you can add an MCP server — add the URL above as an SSE transport. 3. Verify
Commands (
|
| Command | Description |
|---|---|
VS Code MCP Bridge: Start Server |
Start the HTTP server |
VS Code MCP Bridge: Stop Server |
Stop the HTTP server (disconnects all agents) |
VS Code MCP Bridge: Restart Server |
Restart the server (picks up port/settings changes) |
VS Code MCP Bridge: Show Status / Options |
Show connection count, copy URL, or stop |
VS Code MCP Bridge: Copy Connection URL |
Copy the SSE endpoint URL to clipboard |
The status bar item (bottom right) shows the current port and connected agent count. Click it to access the same options.
Tools
Context
| Tool | Description |
|---|---|
get_active_file |
Current file path, full content, and language |
get_selection |
Current text selection and cursor position |
get_open_tabs |
All open editor tabs |
get_workspace_info |
Workspace root, name, and folder structure |
Files
| Tool | Description |
|---|---|
show_diff |
Opens a native VS Code diff editor — use before writing |
read_file |
Read file contents (supports line ranges) |
write_file |
Write content to a file (integrates with VS Code undo) |
create_file |
Create a new file |
delete_file |
Delete a file (moves to trash by default) |
open_file |
Open a file in the editor, optionally jump to a line |
Language Server (LSP)
| Tool | Description |
|---|---|
get_diagnostics |
Errors and warnings from all language servers |
find_references |
Find all references to a symbol |
go_to_definition |
Get the definition location(s) of a symbol |
get_hover |
Type info and documentation for a symbol |
get_document_symbols |
All symbols (functions, classes, etc.) in a file |
search_workspace_symbols |
Search symbols across the entire workspace |
get_code_actions |
Available quick fixes and refactors for a range |
apply_code_action |
Apply a code action by index |
rename_symbol |
Rename a symbol and all references workspace-wide |
Git
| Tool | Description |
|---|---|
get_git_status |
Current branch, staged and unstaged changes |
get_git_diff |
Diff for a file or the entire repo (staged or unstaged) |
Terminal
| Tool | Description |
|---|---|
run_terminal_command |
Run a shell command and capture stdout/stderr |
VS Code
| Tool | Description |
|---|---|
execute_vscode_command |
Execute any VS Code command (requires allowlist in settings) |
Settings
| Setting | Default | Description |
|---|---|---|
mcpServer.port |
3333 |
HTTP port for the MCP server |
mcpServer.enableContextPush |
true |
Push active file/selection/diagnostic events to agents automatically |
mcpServer.authToken |
"" |
Bearer token for HTTP auth (empty = no auth) |
mcpServer.allowedCommands |
[] |
VS Code command IDs allowed via execute_vscode_command |
mcpServer.terminalStrategy |
"childProcess" |
childProcess captures output reliably; shellIntegration shows in the VS Code terminal panel |
Agent Behaviour
The server sends instructions to every connected agent on connect:
- Call
show_diffbefore writing any file so changes are visible in VS Code first - Call
get_active_fileandget_selectionbefore answering questions about code - Call
get_diagnosticswhen diagnosing errors rather than guessing - Use LSP tools (
go_to_definition,find_references,rename_symbol) instead of text search for code navigation and refactoring - Call
get_diagnosticsagain after making changes to confirm no new errors were introduced
Context Push
When mcpServer.enableContextPush is enabled, the server pushes events to connected agents whenever:
- The active file changes
- The selection/cursor moves
- Diagnostics update
Events arrive as MCP notifications/message log messages with data.type set to activeFile, selection, or diagnostics.
Security
The server only listens on 127.0.0.1 (localhost) — it is not reachable from other machines on your network. For shared or remote environments, set mcpServer.authToken in VS Code settings to require a bearer token on all connections.