LSP MCP Server
An MCP (Model Context Protocol) server that provides unified access to Language Server Protocol features for multiple programming languages.
Features
- Multi-language support: Rust, TypeScript/JavaScript, Python, Go, C/C++
- Full IDE features exposed as MCP tools:
lsp_hover- Type info and documentationlsp_goto_definition- Navigate to symbol definitionslsp_find_references- Find all usages of a symbollsp_completion- Code completion suggestionslsp_document_symbols- List symbols in a filelsp_workspace_symbols- Search symbols across workspacelsp_rename_symbol- Rename symbols across fileslsp_diagnostics- Get errors and warnings
Prerequisites
Language servers must be installed and available in PATH:
| Language | Server | Install |
|---|---|---|
| Rust | rust-analyzer | rustup component add rust-analyzer |
| TypeScript/JS | typescript-language-server | npm i -g typescript-language-server typescript |
| Python | pyright | npm i -g pyright or pip install pyright |
| Go | gopls | go install golang.org/x/tools/gopls@latest |
| C/C++ | clangd | Install via system package manager |
Installation
Usage
As MCP Server
Add to your MCP client configuration:
Tool Examples
1. Activate a workspace first:
2. Get hover info:
3. Find definition:
4. Find references:
Development
# Build
# Run in development
# Run tests
# Build release
Architecture
lsp-mcp/
├── src/
│ ├── main.rs # Entry point
│ ├── lib.rs # Public API
│ ├── error.rs # Error types
│ ├── server/ # MCP server
│ │ └── mcp_server.rs # Tool registration
│ ├── lsp/ # LSP client layer
│ │ ├── client.rs # LSP client wrapper
│ │ ├── manager.rs # Multi-server manager
│ │ ├── config.rs # Server configurations
│ │ └── transport.rs # Stdio transport
│ └── tools/ # MCP tools
│ ├── workspace.rs # Workspace management
│ ├── hover.rs # Hover info
│ ├── definition.rs # Go to definition
│ └── ... # Other tools
License
MIT