VS Code LSP MCP Bridge
Expose VS Code language intelligence as a local MCP server for AI coding tools.
This extension lets MCP clients ask the active VS Code workspace for semantic references, definitions, symbols, hover information, diagnostics, call hierarchy, type hierarchy, semantic tokens, code actions, formatting edits, and rename operations.
It is not tied to Codex and it is not tied to C#. It works with any language extension that implements VS Code's language-provider APIs. C# Dev Kit/Roslyn is a strong use case, but TypeScript, JavaScript, Python, Java, Go, Rust, PHP, and other languages can work when their VS Code language extension exposes the corresponding features.
The goal is simple: give AI coding tools a real semantic navigation path instead of forcing them to approximate code relationships with text search.
Requirements
- VS Code
1.100.0 or newer.
- A language extension installed for the workspace you want to inspect.
- An MCP client that can connect to Streamable HTTP MCP servers.
End users do not need to install Node.js. Node/npm are development-time tools only.
Quick Start
- Install the extension from the Visual Studio Marketplace.
- Open the workspace you want an AI coding tool to inspect.
- Make sure the relevant language extension is loaded and working in VS Code.
- Run
LSP MCP Bridge: Show Status from the Command Palette.
- Run
LSP MCP Bridge: Copy MCP Client Config.
- Choose your client: Codex, VS Code/GitHub Copilot, Claude Code, or Generic HTTP MCP Client.
- Paste the copied config into that client and restart or reload the client if needed.
The bridge starts automatically by default when VS Code finishes startup. You can also use:
LSP MCP Bridge: Start Server
LSP MCP Bridge: Stop Server
LSP MCP Bridge: Show Status
LSP MCP Bridge: Copy MCP Client Config
For client-specific setup, run LSP MCP Bridge: Copy MCP Client Config and choose the target client.
Supported Languages
The bridge delegates to VS Code, so language support depends on the installed language extension and project state.
Examples:
- C# through C# Dev Kit/Roslyn
- TypeScript and JavaScript through the built-in TypeScript language service
- Python through the Python and Pylance extensions
- Java through Java language extensions
- Go through the Go extension
- Rust through rust-analyzer
Not every provider implements every VS Code language feature. For example, a language extension might support definitions and references but not type hierarchy or semantic tokens.
What It Exposes
The bridge exposes VS Code's public language-provider command surface. It does not expose private language-server internals or arbitrary language-server protocol requests that VS Code does not publish through its extension API.
Read-only tools include:
- references, definitions, declarations, implementations, and type definitions
- hover, diagnostics, document highlights, document symbols, and workspace symbols
- call hierarchy and type hierarchy
- document links, semantic tokens, folding ranges, colors, inline values, code lens, and inlay hints
- completions, signature help, code actions, prepare rename, and rename preview
Write-capable tools include:
- apply code action
- organize imports
- fix all
- format document, format range, and format on type
- rename symbol
See docs/TOOLS.md for the complete tool catalog.
Security Model
The bridge is local-first and conservative by default:
- Binds to
127.0.0.1 by default.
- Uses a random bearer token stored in VS Code SecretStorage.
- Writes connection info to
~/.vscode-lsp-mcp-bridge/connection.json.
- Refuses to start in untrusted workspaces.
- Exposes read-only tools by default.
- Keeps write tools disabled unless
vscodeLspMcpBridge.enableWriteTools is enabled.
- Requires a VS Code modal approval before each write operation applies edits or executes a write-capable command.
- Does not expose shell execution.
See docs/SECURITY.md for details.
Settings
| Setting |
Default |
Description |
vscodeLspMcpBridge.autoStart |
true |
Start the local bridge server when VS Code finishes startup. |
vscodeLspMcpBridge.host |
127.0.0.1 |
Host for the local bridge server. Keep this on localhost. |
vscodeLspMcpBridge.port |
36521 |
Port for the local bridge server. |
vscodeLspMcpBridge.connectionFile |
empty |
Optional path for the connection file. Empty uses ~/.vscode-lsp-mcp-bridge/connection.json. |
vscodeLspMcpBridge.enableWriteTools |
false |
Enable MCP tools that can apply workspace edits. Each write still requires VS Code approval. |
Development
Install dependencies:
npm install
Compile:
npm run compile
Run the extension:
- Open this folder in VS Code.
- Press
F5.
- In the Extension Development Host, open a real project with language extensions installed.
- Run
LSP MCP Bridge: Show Status.
Package a local VSIX:
npm run package
See docs/PUBLISHING.md for Marketplace publishing steps.