LS

lsp-mcp

Created 6 months ago

An MCP server for interacting with LSP interface, enabling LLMs to utilize LSPs for accurate code suggestions.

development documentation public

What is lsp-mcp?

Interact with Language Servers usint the Language Server Protocol to provide additional context information via hover, code actions and completions.

Documentation

LSP MCP Server

An MCP (Model Context Protocol) server for interacting with LSP (Language Server Protocol) interface. This server acts as a bridge that allows LLMs to query LSP Hover and Completion providers.

Overview

The MCP Server works by:

  1. Starting an LSP client that connects to a LSP server
  2. Exposing MCP tools that send requests to the LSP server
  3. Returning the results in a format that LLMs can understand and use

This enables LLMs to utilize LSPs for more accurate code suggestions.

Configuration:

{
  "mcpServers": {
    "lsp-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "tritlo/lsp-mcp", "", "", ""
      ]
    }
  }
}

Features# MCP Tools

  • get_info_on_location: Get hover information at a specific location in a file
  • get_completions: Get completion suggestions at a specific location in a file
  • get_code_actions: Get code actions for a specific range in a file
  • open_document: Open a file in the LSP server for analysis
  • close_document: Close a file in the LSP server
  • get_diagnostics: Get diagnostic messages (errors, warnings) for open files
  • start_lsp: Start the LSP server with a specified root directory
  • restart_lsp_server: Restart the LSP server without restarting the MCP server
  • set_log_level: Change the server's logging verbosity level at runtime

MCP Resources

  • lsp-diagnostics:// resources for accessing diagnostic messages with real-time updates via subscriptions
  • lsp-hover:// resources for retrieving hover information at specific file locations
  • lsp-completions:// resources for getting code completion suggestions at specific positions

Additional Features

  • Comprehensive logging system with multiple severity levels
  • Colorized console output for better readability
  • Runtime-configurable log level
  • Detailed error handling and reporting
  • Simple command-line interface

Prerequisites

  • Node.js (v16 or later)
  • npm

For the demo server:

  • GHC (8.10 or later)
  • Cabal (3.0 or later)

License

MIT License

Server Config

{
  "mcpServers": {
    "lsp-mcp-server": {
      "command": "npx",
      "args": [
        "lsp-mcp"
      ]
    }
  }
}

Links & Status

Repository: github.com
Hosted: No
Global: No
Official: Yes

Project Info

Hosted Featured
Created At: May 23, 2025
Updated At: Aug 07, 2025
Author: Tritlo
Category: community
License: MIT License
Tags:
development documentation public