# lsp-mcp [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/theUpsider/lsp-mcp  
**GitHub Stars:** 3  
**npm Downloads (last month):** 551  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/lsp-mcp

## Description
A Model Context Protocol (MCP) server that gives language models access to Language Server Protocol (LSP) functionality across all major programming languages.

## Tools
Capabilities this server exposes over MCP:

- **lsp_init** — Initialize LSP for a project root. Pass languages to pre-warm specific servers; omit to auto-detect from project files (lazy startup per file if none found).
- **lsp_definition** — Find definitions
- **lsp_references** — Find references
- **lsp_document_symbols** — List document symbols
- **lsp_workspace_symbols** — Search workspace symbols
- **lsp_diagnostics** — Get errors and warnings. Pass a file path to trigger analysis of that file and its language server, then return diagnostics for that file (scope: file) or all files seen so far (scope: workspace). Omit file for workspace scope to query whatever has been opened previously.
- **lsp_type_definition** — Find type definitions
- **lsp_implementation** — Find implementations
- **lsp_health** — Show LSP server health
- **lsp_rename** — Rename symbol
- **lsp_code_action** — List or apply code actions
- **lsp_formatting** — Format document
- **lsp_range_formatting** — Format selected range

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "lsp-mcp": {
    "command": "npx",
    "args": ["-y","@theupsider/lsp-mcp@latest"],
    "env": {
      "LSP_MCP_LOG_LEVEL": ""
    }
  }
}
```

**Requires environment variables:** `LSP_MCP_LOG_LEVEL` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What lsp-mcp does

The lsp-mcp MCP server exposes Language Server Protocol features through MCP tools. It supports project initialization, definition and type-definition lookup, reference searches, symbol inspection, workspace symbol queries, diagnostics, implementation lookup, server health checks, renaming, code actions, and document or range formatting.

Language detection uses project markers such as `pyproject.toml`, `package.json`, `go.mod`, `Cargo.toml`, `pom.xml`, `build.gradle`, and `Package.swift`. The listed language-server mappings cover Python, TypeScript, JavaScript, C#, Java, Go, Rust, C/C++, Ruby, PHP, Kotlin, and Swift. Multiple language servers can run for one project.

## How it works

Run the lsp-mcp MCP server through the MCP stdio protocol. A client can initialize it with a project root, after which the server scans the workspace and starts matching language servers on a best-effort basis. Clients with MCP Roots support can initialize automatically; otherwise, call `lsp_init` with a root path before using the other tools.

The optional `languages` argument to `lsp_init` lets a client preselect languages instead of relying on project detection. If a language was not started during initialization, later tool calls can trigger lazy startup for the language associated with the requested file. Responses contain readable text plus raw LSP data.

Initialized workspace details and detected languages persist in the operating system's configuration directory. On later starts, the server can reconnect using the last-known root. If a previously healthy language server cannot start, `lsp_init` becomes available again for reinitialization.

## Setup and configuration

Install the package globally with npm or Bun:

```bash
npm install -g @theupsider/lsp-mcp@latest
```

Then run `lsp-mcp`, or configure it as a stdio server in an MCP client. For VS Code and Cursor, the README recommends workspace-level `.vscode/mcp.json` configuration so the process runs where the workspace resides, including remote, WSL, and development-container environments.

The lsp-mcp MCP server must run on the same machine as the code. Its managed language servers require direct filesystem access and do not work when the source is only available through a remote connection. Set `LSP_MCP_LOG_LEVEL` to `error`, `info`, or `debug`; the default is `info`.

## Tools and capabilities

- `lsp_init` initializes a project and optionally pre-warms selected languages.
- `lsp_definition`, `lsp_type_definition`, and `lsp_implementation` navigate related code locations.
- `lsp_references` finds symbol usages.
- `lsp_document_symbols` and `lsp_workspace_symbols` inspect symbols within a file or across the project.
- `lsp_diagnostics` reports file or workspace errors and warnings.
- `lsp_health` reports the status of managed language servers.
- `lsp_rename` changes a symbol name through LSP.
- `lsp_code_action` lists or applies available actions.
- `lsp_formatting` formats a document, while `lsp_range_formatting` formats a selected range.

## Limitations and notes

Language-server availability and behavior depend on the mapped server binaries and the project. Initialization is best effort, so a language may require a later lazy start or reinitialization if its server is missing or fails. The server uses local filesystem access; it is not suitable for placing the MCP process on a different machine from the workspace.

_Full upstream README: https://allmcps.com/mcp/lsp-mcp/readme_

