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:
- Starting an LSP client that connects to a LSP server
- Exposing MCP tools that send requests to the LSP server
- 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 fileget_completions: Get completion suggestions at a specific location in a fileget_code_actions: Get code actions for a specific range in a fileopen_document: Open a file in the LSP server for analysisclose_document: Close a file in the LSP serverget_diagnostics: Get diagnostic messages (errors, warnings) for open filesstart_lsp: Start the LSP server with a specified root directoryrestart_lsp_server: Restart the LSP server without restarting the MCP serverset_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 subscriptionslsp-hover://resources for retrieving hover information at specific file locationslsp-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
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