Skip to main content
Glama
beixiyo

VSCode LSP MCP Server

by beixiyo

VSCode LSP MCP

πŸ” 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.

vscode-ext 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!

Related MCP server: MCP Server

βš™οΈ 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

  • β˜• Java dependency source: Get decompiled Java class source via jdt:// URI (from jdtls), so AI can read library implementations

πŸ› οΈ 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

get_class_file_contents

Get decompiled Java class source via jdt:// URI (e.g. from get_definition when the target is in a dependency JAR)

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

lsp-mcp.cors.enabled

Enable or disable CORS (Cross-Origin Resource Sharing).

boolean

true

lsp-mcp.cors.allowOrigins

Allowed origins for CORS. Use * to allow all origins, or provide a comma-separated list of origins (e.g., http://localhost:3000,http://localhost:5173).

string

*

lsp-mcp.cors.withCredentials

Whether to allow credentials (cookies, authorization headers) in CORS requests.

boolean

false

lsp-mcp.cors.exposeHeaders

Headers that browsers are allowed to access. Provide a comma-separated list of headers (e.g., Mcp-Session-Id).

string

Mcp-Session-Id

πŸ”— Integration with AI Tools

Cursor

Config file: ~/.cursor/mcp.json (e.g. %USERPROFILE%\.cursor\mcp.json on Windows)

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

Install MCP Server

OpenCode

Config file: ~/.config/opencode/opencode.jsonc

{
  "mcp": {
    "lsp-mcp": {
      "type": "remote",
      "url": "http://127.0.0.1:9527/mcp",
      "enabled": true
    }
  }
}

Claude Code

Config file: ~/.claude.json

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

Gemini | IFlow

Config file: ~/.gemini/settings.json

{
  "mcpServers": {
    "lsp-mcp": {
      "type": "streamable-http",
      "httpUrl": "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

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/beixiyo/vsc-lsp-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server