Logo von VSCode LSP MCP

VSCode LSP MCP

Community
beixiyo

Expose VS Code language intelligence to AI agents via MCP, with automatic routing across multiple windows

Herausgeberbeixiyo
Repositoryvsc-lsp-mcp
SpracheTypeScript
Forks
11
Sterne
42
Verfügbare Tools
0
Transporttypstdio
Kategorien
LizenzMIT
Links
  • Tools mit KI-Workflows verbinden

    VSCode LSP MCP stellt MCP-Funktionen bereit, die kompatible KI-Clients und Agenten nutzen können.

  • 0 verfügbare Tools

    Sehen Sie sich unten die aufrufbaren Aktionen an, einschließlich Namen und Beschreibungen, sofern der Server diese bereitstellt.

  • Konfiguration zum Kopieren

    Nutzen Sie die Installationsbeispiele, um diesen Server in Ihrem bevorzugten MCP-Client zu konfigurieren.

  • Open-Source-Kennzahlen

    42 Sterne und 11 Forks im verlinkten Repository.

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.

[!TIP] Using Neovim? See vv-mcp.nvim, the sibling implementation that exposes Neovim LSP clients and live editor context through MCP.

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!

⚙️ 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
  • ☕ Java dependency source: Get decompiled Java class source via jdt:// URI (from jdtls), so AI can read library implementations
  • 📄 Dual output format: JSON for machine processing, Markdown for LLM-friendly reading

🛠️ Exposed MCP Tools

ToolDescription
healthReport the shared broker status
list_instancesList active VS Code windows, workspace roots, and instance IDs
execute_lspExecute an LSP operation in an explicitly selected or automatically matched instance
rename_resourceRename a workspace file or directory in the matching instance

LSP operations

OperationDescription
hoverGet hover information (documentation, type, etc.) at a position
definitionGet the definition location of a symbol
declarationGet the declaration location of a symbol
type_definitionGet the type definition location of a symbol
implementationGet the implementation location(s) of a symbol
referencesFind all references to a symbol
document_highlightFind semantic occurrences of a symbol in the current document
document_linksGet navigable document links exposed by the active language extension
inlay_hintsGet inferred type and parameter-name hints for a document range
signature_helpGet signatures and active-parameter information at a call site
document_symbolsGet the symbol outline (tree) of a document
workspace_symbolsSearch for symbols across the entire workspace by query
diagnosticsGet diagnostics for one file with optional severity, source, and code filters
workspace_diagnosticsGet filtered diagnostics under a workspace path
code_actionsList editable Code Actions at a position
code_action_previewPreview one listed Code Action without side effects
fix_document_previewPreview editable fix-all or quick-fix edits for an entire document
code_action_applyApply one previously previewed Code Action transaction
class_file_contentsGet decompiled Java class source via jdt:// URI (from jdtls), to read library/dependency implementations
prepare_renameLocate and validate a rename candidate
rename_previewPreview a symbol rename without modifying files
rename_applyApply one previously previewed rename transaction
prepare_call_hierarchyPrepare call hierarchy nodes and return recursive callId values
incoming_callsFind all callers of a symbol
outgoing_callsFind all callees (calls made by) a symbol

All operations are invoked through the single execute_lsp MCP tool with a unified input format:

  • operation — which LSP operation to execute
  • uri — file path or URI string (supports both plain paths and file:///jdt:// URIs)
  • line — line number (1-based, matching editor display). Required for position-dependent operations
  • character — character offset (1-based, matching editor display). Required for position-dependent operations
  • newName / renameId — used by the three-stage rename flow
  • actionKind / actionId — filter and continue the Code Action transaction flow
  • query — required only for workspace_symbols
  • symbolKinds, includeDeclaration, includeExternal, pathPattern, severities, sources, codes — optional result filters applied before maxResults
  • startLine, endLine — optional inclusive range for inlay_hints
  • callId — returned by call hierarchy operations for recursive traversal
  • instanceId — optional instance returned by list_instances; takes precedence over automatic path routing

1-based positions: Both input and output use 1-based line/character values, matching what your editor displays. VS Code shows Ln 9, Col 16 → pass line: 9, character: 16. Output positions can be used directly as input for the next call — no conversion needed.

Multi-instance routing

The extension starts one lightweight internal endpoint per VS Code window and registers it with a shared broker. External clients keep using a single MCP URL. The broker selects an instance in this order:

  1. Exact instanceId, when provided
  2. Longest workspace-root prefix matching the input file path
  3. The only active instance, when no path can identify one

If two windows open the same project, routing is intentionally rejected as ambiguous until the caller passes instanceId. The registry contains no public credentials and stale window records expire automatically.

The first multi-instance release supports local desktop workspaces and file: resources. Remote SSH, WSL, Dev Containers, and virtual workspaces are not yet advertised as supported.

Workspace tools

ToolDescription
rename_resourceRename a file or directory through VS Code's WorkspaceEdit API. Accepts oldUri, newUri, and optional overwrite parameters. Language extensions can update affected imports and exports as part of the same workspace edit.

For example, the built-in TypeScript provider updates relative imports and barrel exports when a referenced .ts or .tsx file is renamed. The exact companion edits remain language-provider dependent, so inspect diagnostics after applying a resource rename.

📋 Configuration

KeyDescriptionTypeDefault
lsp-mcp.enabledEnable or disable the LSP MCP server.booleantrue
lsp-mcp.portPreferred port for the shared MCP broker.number9527
lsp-mcp.cors.enabledEnable CORS for browser-based MCP clients. Keep disabled for native clients.booleanfalse
lsp-mcp.cors.allowOriginsAllowed 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.withCredentialsWhether to allow credentials (cookies, authorization headers) in CORS requests.booleanfalse
lsp-mcp.cors.exposeHeadersHeaders that browsers are allowed to access. Provide a comma-separated list of headers (e.g., Mcp-Session-Id).stringMcp-Session-Id
lsp-mcp.maxResultsMaximum number of items returned for list-type results such as workspace_symbols. Prevents excessive token usage.number200
lsp-mcp.outputFormatOutput format for LSP operation results. json for machine-readable JSON, markdown for LLM-friendly Markdown.stringjson
lsp-mcp.hover.excludePatternsRegular expressions that exclude an entire aggregated hover item when its content matches. Applies to JSON and Markdown output.string[]["^翻译 \u0060", "\\[Comment Translate\\]"]
lsp-mcp.dependencyMarkersPath substrings used to classify dependency results for sorting and includeExternal=false.string[]language-specific defaults

Hover exclusion patterns are applied to each complete aggregated hover item before output formatting. For example:

json
{
  "lsp-mcp.hover.excludePatterns": [
    "^翻译 `",
    "\\[Comment Translate\\]"
  ]
}

🔗 Integration with AI Tools

VS Code Copilot

No mcp.json setup is required. After the extension starts, it registers the local LSP MCP server with VS Code through an MCP server definition provider.

Use MCP: List Servers or the chat tools picker in VS Code to enable or manage the LSP MCP Server.

Cursor

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

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

OpenCode

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

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

Claude Code

Config file: ~/.claude.json

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

Gemini | IFlow

Config file: ~/.gemini/settings.json

json
{
  "mcpServers": {
    "lsp-mcp": {
      "type": "streamable-http",
      "httpUrl": "http://127.0.0.1:9527/mcp"
    }
  }
}

Codex

Config file: ~/.codex/config.toml

toml
[mcp_servers.lsp-mcp]
url = "http://127.0.0.1:9527/mcp"

Roo Code

json
{
  "mcpServers": {
    "lsp-mcp": {
      "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

Installation

TypingMind
{
  "mcpServers": {
    "vsc-lsp-mcp": {
      "command": "node",
      "args": [
        "path/to/your/extension/activation/script.js"
      ]
    }
  }
}

VSCode LSP MCP MCP mit mehreren KI-Modellen nutzen

TypingMind bindet MCP-Tools auf Arbeitsbereichsebene ein. Sobald VSCode LSP MCP verbunden ist, können Sie die Integration mit verschiedenen KI-Modellen in TypingMind verwenden, statt sie für jedes Modell separat einzurichten. Diese MCP-Integration läuft lokal über den TypingMind-MCP-Konnektor auf Ihrem Gerät.

Einrichtungsanleitung für den lokalen Konnektor

Nutzen Sie diese Option, wenn der MCP-Server Zugriff auf lokale Dateien, Apps oder private Ressourcen auf Ihrem Computer benötigt.

1

MCP-Einstellungen öffnen

Gehen Sie in TypingMind zu „Einstellungen“, „Erweiterte Einstellungen“ und dann „Model Context Protocol“ und wählen Sie „Konnektor-Setup“.

  1. Öffnen Sie TypingMind in Ihrem Browser.
  2. Klicken Sie auf das Symbol „Optionen“.
  3. Gehen Sie zu „Erweiterte Einstellungen“.
  4. Öffnen Sie den Abschnitt „Model Context Protocol“.
  5. Klicken Sie auf „Konnektor-Setup“ und wählen Sie „Dieses Gerät“.
Einrichtungsbildschirm des TypingMind-MCP-Konnektors mit ausgewählter Option „Dieses Gerät“
2

Konnektor-Befehl ausführen

Wählen Sie „Dieses Gerät“, kopieren Sie den Befehl aus TypingMind und führen Sie ihn im Terminal aus. Lassen Sie den Prozess laufen, solange Sie MCP verwenden.

  1. Kopieren Sie den in TypingMind angezeigten Einrichtungsbefehl.
  2. Öffnen Sie unter macOS Terminal bzw. unter Windows Windows Terminal.
  3. Fügen Sie den Befehl ein und führen Sie ihn aus.
  4. Bestätigen Sie die Paketinstallation, wenn Sie im Terminal zum Fortfahren aufgefordert werden.
  5. Lassen Sie das Terminalfenster geöffnet und den Prozess darin laufen, solange Sie MCP-Tools verwenden.
3

VSCode LSP MCP als Server hinzufügen

Wenn der Konnektorstatus „Bereit“ anzeigt, klicken Sie auf „Server ändern“ und fügen Sie die MCP-Server-Konfiguration ein.

  1. Warten Sie, bis der Konnektorstatus „Bereit“ anzeigt.
  2. Klicken Sie auf „Server ändern“.
  3. Fügen Sie die MCP-Server-Konfiguration für VSCode LSP MCP ein.
  4. Speichern Sie die Serverliste.
  5. Aktualisieren Sie die Ansicht, um bei Bedarf zu prüfen, ob der Konnektor weiterhin bereit ist.
MCP-Einstellungen in TypingMind mit aktivem Server und der Schaltfläche „Server ändern“
{
  "mcpServers": {
    "vsc-lsp-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "lsp-mcp"
      ]
    }
  }
}
4

Verbindung modellübergreifend nutzen

Speichern Sie die Serverliste, öffnen Sie „Plugins“ und aktivieren Sie die MCP-Tools von VSCode LSP MCP. Wählen Sie dann ein beliebiges unterstütztes KI-Modell in TypingMind und verwenden Sie die Tools im Chat oder weisen Sie sie einem KI-Agenten zu.

  1. Öffnen Sie die Seite „Plugins“ in TypingMind.
  2. Aktivieren Sie die MCP-Tools von VSCode LSP MCP.
  3. Starten Sie einen Chat und wählen Sie das KI-Modell, das Sie verwenden möchten.
  4. Nutzen Sie die MCP-Tools im Chat oder weisen Sie sie einem KI-Agenten zu.
  5. Wechseln Sie bei Bedarf zu einem anderen KI-Modell, ohne die MCP-Verbindung erneut herzustellen.
TypingMind-Chat mit aktivierten MCP-Tools und einem ausgewählten KI-Modell
Können Sie mir mit VSCode LSP MCP bei dieser Aufgabe helfen?
VSCode LSP MCP
Gerne. Ich habe es gelesen.
Das habe ich mit VSCode LSP MCP gefunden.

Häufig gestellte Fragen

Wofür wird der MCP-Server VSCode LSP MCP verwendet?

VSCode LSP MCP ist ein MCP-Server, über den kompatible KI-Clients auf externe Tools und Kontext zugreifen können. In TypingMind können Sie diesen MCP-Server einmal hinzufügen und seine Tools in Ihrem KI-Arbeitsbereich verfügbar machen.

Kann ich VSCode LSP MCP MCP mit mehreren KI-Modellen in TypingMind verwenden?

Ja. TypingMind bindet MCP-Tools auf Arbeitsbereichsebene ein. So können Sie VSCode LSP MCP mit verschiedenen KI-Modellen wie Claude, ChatGPT, Gemini oder anderen in TypingMind konfigurierten Modellen verwenden, ohne den MCP-Server für jedes Modell separat einzurichten.

Warum VSCode LSP MCP MCP mit TypingMind nutzen?

TypingMind ist eine der besten Oberflächen für LLM-Chats, da es mehrere KI-Modelle, Prompts, Plugins, KI-Agenten, API-Schlüssel und MCP-Tools in einem Arbeitsbereich vereint. Sobald VSCode LSP MCP verbunden ist, können Sie die zugehörigen MCP-Tools mit Ihren bevorzugten Modellen nutzen und Ihre Chat-Abläufe in TypingMind übersichtlich organisieren.

Wie verbinde ich VSCode LSP MCP MCP mit TypingMind?

VSCode LSP MCP wird über den lokalen MCP-Konnektor von TypingMind angebunden. Das ist die beste Wahl, wenn der MCP-Server auf lokale Dateien, Desktop-Apps, Befehlszeilentools oder private Ressourcen auf Ihrem Computer zugreifen muss.

Welche Tools stellt VSCode LSP MCP MCP in TypingMind bereit?

VSCode LSP MCP stellt MCP-Funktionen bereit, die Sie auf der Plugins-Seite in TypingMind aktivieren und im Chat verwenden oder KI-Agenten zuweisen können.

Muss ich meine API-Schlüssel mit TypingMind teilen, um VSCode LSP MCP MCP zu verwenden?

Nein. TypingMind arbeitet vorrangig lokal, sodass Sie die Kontrolle über Ihre Modellanbieter, API-Schlüssel, Prompts und MCP-Konfiguration behalten. Falls VSCode LSP MCP eine Authentifizierung erfordert, fügen Sie beim Erstellen der Verbindung die erforderlichen Header, OAuth-Einstellungen oder die lokale Konfiguration für diesen MCP-Server hinzu.

Ähnliche MCP-Server

Alle

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇