VSCode LSP MCP logo

VSCode LSP MCP

Community
beixiyo

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

Publisherbeixiyo
Repositoryvsc-lsp-mcp
LanguageTypeScript
Forks
11
Stars
42
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    VSCode LSP MCP exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    42 stars and 11 forks from the linked 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"
      ]
    }
  }
}

Use VSCode LSP MCP MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once VSCode LSP MCP is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add VSCode LSP MCP as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the VSCode LSP MCP MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "vsc-lsp-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "lsp-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the VSCode LSP MCP MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the VSCode LSP MCP MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use VSCode LSP MCP to help me with this task?
VSCode LSP MCP
Sure. I read it.
Here is what I found using VSCode LSP MCP.

Frequently asked questions

What is the VSCode LSP MCP MCP server used for?

VSCode LSP MCP is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use VSCode LSP MCP MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use VSCode LSP MCP with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use VSCode LSP MCP MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With VSCode LSP MCP connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect VSCode LSP MCP MCP to TypingMind?

VSCode LSP MCP runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does VSCode LSP MCP MCP provide in TypingMind?

VSCode LSP MCP exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use VSCode LSP MCP MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If VSCode LSP MCP requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇