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.
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.
{
"mcpServers": {
"lsp-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"tritlo/lsp-mcp",
"<language-id>",
"<path-to-lsp>",
"<lsp-args>"
]
}
}
}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