Get the FREE Ultimate OpenClaw Setup Guide →

lsp

An Model Context Protocol (MCP) server that provides LLMs/AI Agents with the capabilities of a language server protocol (LSP) server. This gives the AI the ability to get language aware context from the codebase.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio jonrad-lsp-mcp docker run -i --rm docker.io/jonrad/lsp-mcp:0.3.1

How to use

This MCP server provides Language Server Protocol (LSP) functionality to an AI agent, enabling language-aware analysis and context from a codebase. It exposes an LSP surface via an MCP server named lsp, which you run inside a container (via Docker) or through npx as described in the Quick Start. The idea is to let the AI leverage real-time code intelligence (diagnostics, symbol navigation, definitions, references, etc.) without embedding a full LSP client inside the agent. The server is designed to support multiple LSPs in parallel, and can be configured to load specific language servers or switch the underlying LSP by altering the lsp flag passed to the --lsp argument in the configuration. In practice you would point your MCP client at the lsp server, and provide the code workspace location so the AI can query and receive language-aware responses. When using Claude Desktop, you can run this via Docker with the provided image, or use npx to pull the mcp package and run the LSP server command as shown in the examples.

How to install

Prerequisites:

  • Docker installed and running (recommended for lsp server).
  • Optional: Node.js if you prefer npx mode (npx approach shown below).

Installation steps (Docker - recommended):

  1. Ensure Docker is running on your machine.
  2. Create or edit your MCP config to include the lsp server:
{
  "mcpServers": {
    "lsp": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "docker.io/jonrad/lsp-mcp:0.3.1"]
    }
  }
}
  1. Start the MCP system using your preferred MCP client or runtime.
  2. Optionally share a local workspace with the container using Docker volume flags (e.g., -v /path/to/workspace:/workspace).

Installation steps (npx):

  1. Install Node.js if not already installed.
  2. Run or configure the containerless/more lightweight npx path as shown in the README example:
{
  "mcpServers": {
    "lsp": {
      "command": "npx",
      "args": ["-y", "--silent", "git+https://github.com/jonrad/lsp-mcp", "--lsp", "npx -y --silent -p 'typescript@5.7.3' -p 'typescript-language-server@4.3.3' typescript-language-server --stdio"]
    }
  }
}

This approach will pull the LSP-related tooling directly and expose the lsp server capabilities to the MCP framework.

Note: The README indicates Docker is the recommended path for Claude Desktop usage. If you switch to npx, be aware of potential finicky behavior noted in the README.

Additional notes

Tips and considerations:

  • The lsp MCP server is designed to support multiple language servers in parallel, but the Quick Start notes that multiple LSPs at the same time are not yet supported in Claude Desktop; plan to run only one LSP per container or manage multiplexing at the MCP client level.
  • When using Docker, you can map local files into the container to enable code access, typically via -v /local_dir:/remote_dir, and then reference /remote_dir in your interactions.
  • If you encounter issues with npx startup, prefer the Docker setup as it is described as the recommended path in the Quick Start.
  • The environment variable DOCKER_HOST is optional but can be used to specify the Docker daemon address when running in remote or specialized environments.
  • If you need to switch the underlying language server (e.g., different language support), modify the --lsp argument in the npx configuration and restart the MCP server accordingly.
  • The project uses the lsp-mcp image version 0.3.1 in the Docker example; verify latest versions if you’re deploying in a new environment.

Related MCP Servers

Sponsor this space

Reach thousands of developers