
通过MCP向AI代理展示VS代码语言智能,实现多个窗口间的自动路由
概览
VSCode LSP MCP 是一个 Visual Studio Code 扩展,通过模型上下文协议(MCP)暴露语言服务器协议(LSP)的功能。 : cjl.lsp-mcp — 打开扩展(Ctrl+Shift+X / Cmd+Shift+X)并搜索该插件。 这使得AI助手和外部工具能够在无需直接集成的情况下,利用VSCode强大的语言智能能力。 参见 vv-mcp.nvim,这是兄弟实现,通过 MCP 暴露 Neovim LSP 客户端和实时编辑器上下文。 像Claude和Cursor这样的大型语言模型难以准确理解你的代码库,原因如下: - 他们依赖正则表达式模式寻找符号,导致错误匹配 - 无法正确分析导入/导出关系 - 不理解类型层级或继承 - 代码导航能力有限 这个扩展弥合了这一差距,为AI工具提供了与VSCode内部使用的相同代码智能!
概述(AI 翻译)
英文 |中文
🔍 概述
VSCode LSP MCP 是一个 Visual Studio Code 扩展,通过模型上下文协议(MCP)暴露语言服务器协议(LSP)的功能。
扩展ID:cjl.lsp-mcp — 打开扩展(Ctrl+Shift+X / Cmd+Shift+X)并搜索cjl.lsp-mcp以精确找到该插件。
这使得AI助手和外部工具能够在无需直接集成的情况下,利用VSCode强大的语言智能能力。
[!提示] 使用 Neovim 吗? 参见 vv-mcp.nvim,这是通过 MCP 暴露 Neovim LSP 客户端和实时编辑器上下文的兄弟实现。
🌟 为什么要延长这个?
像Claude和Cursor这样的大型语言模型难以准确理解你的代码库,原因如下:
- 它们依赖正则表达式模式来寻找符号,导致错误匹配
- 他们无法正确分析进出口关系
- 他们不理解类型层级或继承
- 它们的代码导航能力有限
这个扩展弥合了这一差距,为AI工具提供了与VSCode内部使用的相同代码智能!
⚙️ 特色
- 🔄 LSP 桥接器:将 LSP 功能转换为 MCP 工具
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
VSCode LSP MCP
English | 中文
🔍 Overview
VSCode LSP MCP is a Visual Studio Code extension that exposes Language Server Protocol (LSP) features through the Model Context Protocol (MCP).
Extension ID: cjl.lsp-mcp — open Extensions (Ctrl+Shift+X / Cmd+Shift+X) and search for cjl.lsp-mcp to find this plugin precisely.
This allows AI assistants and external tools to utilize VSCode’s powerful language intelligence capabilities without direct integration.
[!TIP] Using Neovim? See vv-mcp.nvim, the sibling implementation that exposes Neovim LSP clients and live editor context through MCP.
🌟 Why This Extension?
Large language models like Claude and Cursor struggle to understand your codebase accurately because:
- They rely on regex patterns to find symbols, leading to false matches
- They can’t analyze import/export relationships properly
- They don’t understand type hierarchies or inheritance
- They have limited code navigation capabilities
This extension bridges that gap, providing AI tools with the same code intelligence that VSCode uses internally!
⚙️ Features
- 🔄 LSP Bridge: Converts LSP features into MCP tools
- 🤖 VS Code Copilot integration: Registers the local MCP server directly with VS Code Chat / Copilot
- 🔌 Multi-Instance Broker: One stable MCP endpoint discovers and routes requests across all open VS Code windows
- 🧠 25 LSP operations covering navigation, diagnostics, document metadata, symbols, call hierarchy, transactional rename, and safe Code Actions
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"lsp-mcp": {
"url": "http://127.0.0.1:9527/mcp"
}
}
}