VSCode LSP

•
42
•

Enables AI assistants and external tools to leverage Visual Studio Code's Language Server Protocol (LSP) features for advanced code intelligence via the Model Context Protocol (MCP).

VSCode LSP is a Visual Studio Code extension that bridges the gap between large language models (LLMs) and accurate codebase understanding. By converting VSCode's powerful Language Server Protocol (LSP) features into accessible Model Context Protocol (MCP) tools, it empowers AI assistants and external tools like Cursor and Roo Code to gain deep code context. This includes precise symbol information, import/export relationships, and type hierarchies, directly addressing common LLM limitations such as reliance on regex patterns and limited code navigation, ultimately providing AI with the same robust code intelligence available internally within VSCode.

主要功能

01Supports multiple VSCode instances by automatically handling port conflicts
02Enables intelligent code completions, symbol definitions, and references
03Provides rich and accurate code context through LSP for AI tools
04Facilitates precise renaming of symbols across multiple files
051 GitHub stars
06Bridges Language Server Protocol (LSP) features to Model Context Protocol (MCP) tools

使用案例

01Integrating VSCode's robust language understanding into external AI coding environments like Cursor and Roo Code
02Enhancing large language models (LLMs) and AI assistants with accurate code intelligence from VSCode
03Improving AI agents' ability to navigate, analyze, and refactor code with deep structural context

VSCode LSP MCP 🚀

LSP MCP Icon

License github

English | 中文

🔍 Overview

VSCode LSP MCP is a Visual Studio Code extension that exposes Language Server Protocol (LSP) features through the Model Context Protocol (MCP). This allows AI assistants and external tools to utilize VSCode's powerful language intelligence capabilities without direct integration.

demo

��� 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
  • 🔌 Multi-Instance Support: Automatically handles port conflicts for multiple VSCode windows
  • 🧠 Rich Code Context: Provides accurate symbol information through LSP

🛠️ Exposed MCP Tools

Tool Description
get_hover Get hover information for symbols
get_definition Find symbol definitions
get_completions Get intelligent code completions
get_references Find all references to a symbol
rename_symbol Rename symbols across files

📋 Configuration

Key Description Type Default
lsp-mcp.enabled Enable or disable the LSP MCP server. boolean true
lsp-mcp.port Port for the LSP MCP server. number 9527
lsp-mcp.maxRetries Maximum number of port retry attempts when the default port is occupied. number 10

🔗 Integration with AI Tools

Cursor

Install MCP Server

{
  "mcpServers": {
    "lsp": {
      "url": "http://127.0.0.1:9527/mcp"
    }
  }
}

Roo Code

{
  "mcpServers": {
    "lsp": {
      "type": "streamable-http",
      "url": "http://127.0.0.1:9527/mcp",
      "disabled": false
    }
  }
}

💻 Development

  • Clone the repository
  • Run pnpm install
  • Run pnpm run update to generate metadata
  • Press F5 to start debugging