Logo di VSCode LSP MCP

VSCode LSP MCP

Community
beixiyo

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

Autorebeixiyo
Repositoryvsc-lsp-mcp
LinguaTypeScript
Fork
11
Stelle
42
Strumenti disponibili
0
Tipo di trasportostdio
Categorie
LicenzaMIT
Link
  • Collega gli strumenti ai flussi di lavoro IA

    VSCode LSP MCP mette a disposizione funzionalità MCP utilizzabili da client e agenti IA compatibili.

  • 0 strumenti disponibili

    Esplora le azioni richiamabili qui sotto, con nomi e descrizioni quando forniti dal server.

  • Configurazione pronta da copiare

    Usa gli esempi di installazione per configurare questo server nel tuo client MCP preferito.

  • Indicatori di interesse open source

    42 stelle e 11 fork nel repository collegato.

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

Installazione

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

Usa MCP VSCode LSP MCP con più modelli IA

TypingMind collega gli strumenti MCP a livello di area di lavoro: una volta connesso VSCode LSP MCP, puoi usarlo con diversi modelli IA in TypingMind, senza configurarlo separatamente per ogni modello. Questa integrazione MCP viene eseguita localmente sul tuo dispositivo tramite il connettore MCP di TypingMind.

Guida alla configurazione del connettore locale

Usa questo metodo quando il server MCP deve accedere a file locali, app o risorse private sul tuo computer.

1

Apri le impostazioni MCP

In TypingMind, vai su Impostazioni, Impostazioni avanzate, poi su Model Context Protocol e scegli Configura MCP.

  1. Apri TypingMind nel tuo browser.
  2. Fai clic sull'icona Impostazioni.
  3. Vai a Impostazioni avanzate.
  4. Apri la sezione Model Context Protocol.
  5. Fai clic su Configura MCP e scegli Questo dispositivo.
Schermata di configurazione del connettore MCP di TypingMind con Questo dispositivo selezionato
2

Esegui il comando del connettore

Scegli Questo dispositivo, copia il comando da TypingMind ed eseguilo nel terminale. Lascia il processo in esecuzione mentre usi MCP.

  1. Copia il comando di configurazione mostrato da TypingMind.
  2. Apri Terminale su macOS o Windows Terminal su Windows.
  3. Incolla ed esegui il comando.
  4. Conferma l'installazione del pacchetto se il terminale ti chiede di procedere.
  5. Tieni aperta la finestra del terminale con il processo in esecuzione mentre usi gli strumenti MCP.
3

Aggiungi VSCode LSP MCP come server

Quando lo stato del connettore è Pronto, fai clic su Modifica server e incolla la configurazione del server MCP.

  1. Attendi che lo stato del connettore sia Pronto.
  2. Fai clic su Modifica server.
  3. Incolla la configurazione del server MCP di VSCode LSP MCP.
  4. Salva l'elenco dei server.
  5. Aggiorna per verificare che il connettore sia ancora pronto.
Impostazioni MCP di TypingMind con un server attivo e il pulsante Modifica server
{
  "mcpServers": {
    "vsc-lsp-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "lsp-mcp"
      ]
    }
  }
}
4

Usa la connessione con diversi modelli

Salva l'elenco dei server, apri Plugin, abilita gli strumenti MCP di VSCode LSP MCP, poi seleziona un modello IA supportato in TypingMind e usa gli strumenti in chat o assegnali a un agente IA.

  1. Apri la pagina Plugin in TypingMind.
  2. Abilita gli strumenti MCP di VSCode LSP MCP.
  3. Avvia una chat e scegli il modello IA che vuoi usare.
  4. Usa gli strumenti MCP in chat o assegnali a un agente IA.
  5. Passa a un altro modello IA quando serve, senza riconnettere MCP.
Chat di TypingMind che usa gli strumenti MCP abilitati con un modello IA selezionato
Puoi usare VSCode LSP MCP per aiutarmi con questa attività?
VSCode LSP MCP
Certo. Ho letto.
Ecco cosa ho trovato con VSCode LSP MCP.

Domande frequenti

A cosa serve il server MCP VSCode LSP MCP?

VSCode LSP MCP è un server MCP che consente ai client IA compatibili di accedere a strumenti e informazioni di contesto esterni. In TypingMind puoi aggiungere questo server MCP una sola volta e rendere disponibili i suoi strumenti nella tua area di lavoro IA.

Posso usare VSCode LSP MCP MCP con più modelli IA in TypingMind?

Sì. TypingMind collega gli strumenti MCP a livello di area di lavoro, quindi puoi usare VSCode LSP MCP con diversi modelli IA come Claude, ChatGPT, Gemini o altri modelli che hai configurato in TypingMind, senza dover configurare il server MCP separatamente per ogni modello.

Perché usare il connettore MCP VSCode LSP MCP con TypingMind?

TypingMind è una delle migliori interfacce per chattare con gli LLM perché riunisce più modelli IA, prompt, plugin, agenti IA, chiavi API e strumenti MCP in un'unica area di lavoro. Collegando VSCode LSP MCP, puoi usare i suoi strumenti MCP con i tuoi modelli preferiti e mantenere organizzato il tuo flusso di lavoro in chat su TypingMind.

Come collego VSCode LSP MCP MCP a TypingMind?

VSCode LSP MCP funziona tramite il connettore MCP locale di TypingMind. È la soluzione ideale quando il server MCP deve accedere a file locali, app desktop, strumenti da riga di comando o risorse private sul tuo computer.

Quali strumenti offre VSCode LSP MCP MCP in TypingMind?

VSCode LSP MCP mette a disposizione funzionalità MCP che puoi attivare dalla pagina Plugin di TypingMind e usare in chat o assegnare agli agenti IA.

Devo condividere le mie chiavi API con TypingMind per usare VSCode LSP MCP MCP?

No. TypingMind privilegia il funzionamento in locale e ti permette di mantenere il controllo su fornitori di modelli, chiavi API, prompt e configurazione MCP. Se VSCode LSP MCP richiede l'autenticazione, aggiungi le intestazioni, le impostazioni OAuth o la configurazione locale necessarie per quel server MCP quando crei la connessione.

Server MCP correlati

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇