LSP MCP Server
by Tritlo
The LSP MCP Server acts as a bridge between Language Server Protocol (LSP) and Model Context Protocol (MCP), allowing LLMs to query LSP Hover and Completion providers. This enables LLMs to utilize LSPs for more accurate code suggestions.
Last updated: N/A
What is LSP MCP Server?
The LSP MCP Server is a bridge that allows Large Language Models (LLMs) to interact with Language Server Protocol (LSP) interfaces. It enables LLMs to query LSP Hover and Completion providers for more accurate code suggestions.
How to use LSP MCP Server?
The server starts an LSP client, exposes MCP tools to send requests to the LSP server, and returns the results in a format that LLMs can understand. You need to start the LSP server using the start_lsp
tool before using other LSP functionalities. Configuration involves specifying the LSP server details and language ID.
Key features of LSP MCP Server
MCP Tools for accessing LSP features (get_info_on_location, get_completions, get_code_actions, etc.)
MCP Resources for accessing LSP features (lsp-diagnostics://, lsp-hover://, lsp-completions://)
Comprehensive logging system with configurable log level
Language-specific extensions for enhanced capabilities
Use cases of LSP MCP Server
Providing code completion suggestions to LLMs
Enabling LLMs to understand code context through hover information
Facilitating code refactoring and error correction with code actions
Integrating LSP features into LLM-powered development tools
FAQ from LSP MCP Server
How do I start the LSP server?
How do I start the LSP server?
You must explicitly start the LSP server by calling the start_lsp
tool before using any LSP functionality. Provide the root directory for the LSP server.
How do I view debug logs?
How do I view debug logs?
Use the claude --mcp-debug
flag or change the log level at runtime using the set_log_level
tool.
What are MCP resources?
What are MCP resources?
MCP resources provide a RESTful approach to accessing LSP features like diagnostics, hover information, and code completions using lsp-diagnostics://
, lsp-hover://
, and lsp-completions://
schemes.
How do I get diagnostics for a specific file?
How do I get diagnostics for a specific file?
Use the get_diagnostics
tool with the file_path
parameter or subscribe to the lsp-diagnostics:///path/to/file
resource.
How are extensions loaded?
How are extensions loaded?
Extensions are loaded automatically when you specify a language ID when starting the server. All extension-provided features are namespaced with the language ID.