Bring LSP superpowers to your CLI LLM tools!
LSMCP is a bridge between the Model Context Protocol (MCP) and Language Server Protocol (LSP), enabling CLI-based LLM clients like Claude Code and Gemini CLI to access rich code intelligence without grep/cat operations.
- 🚀 Zero-config for popular languages: TypeScript, Python, Rust, Go work out-of-the-box
- 📦 24 LSP servers supported: 4 built-in defaults + 20 from Mason registry
- 🎯 6 core MCP tools: goto_definition, find_references, hover, document_symbols, diagnostics, workspace_symbols
- ⚡ Lazy initialization: LSP servers start on-demand
- 🤖 Auto-installation: Automatically downloads missing LSP servers on first use
- 📍 Multi-location discovery: Checks LSMCP, Mason, and system PATH for installed LSPs
- 🔧 Highly configurable: 3-tier config system (user → registry → defaults)
- 🦀 Written in Rust: Fast, safe, single binary
LSP servers are automatically installed on first use! LSMCP will download and manage LSP servers for you.
However, you'll need the package managers installed for auto-installation to work:
npm(for TypeScript, JavaScript LSPs)cargo(for Rust LSPs)go(for Go LSPs)
Optional - Manual Installation: If you prefer to install LSPs manually or already have them:
# TypeScript/JavaScript
npm install -g typescript-language-server typescript
# Python
npm install -g pyright
# Rust (already have it if you're using rustup!)
rustup component add rust-analyzer
# Go
go install golang.org/x/tools/gopls@latestLSMCP will automatically detect existing installations in:
~/.local/share/lsmcp/servers/(LSMCP-managed)~/.local/share/nvim/mason/bin/(Mason)- System PATH
Choose your preferred installation method:
# Run directly without installing
nix run github:YZTangent/lsmcp -- --help
# Install to your profile
nix profile install github:YZTangent/lsmcp
# Or add to your flake.nix
{
inputs.lsmcp.url = "github:YZTangent/lsmcp";
}- Fedora/RHEL/CentOS (DNF)
- Arch Linux (AUR)
- Debian/Ubuntu (APT)
If you prefer to build from source or packages aren't available for your platform:
git clone https://github.com/YZTangent/lsmcp
cd lsmcp
cargo build --release
cargo install --path .Requirements: Rust 1.70 or higher (curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh)
Edit your Claude Desktop MCP configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
Add LSMCP to the mcpServers section:
{
"mcpServers": {
"lsmcp": {
"command": "lsmcp",
"args": ["--workspace", "/path/to/your/project"]
}
}
}Note: Replace /path/to/your/project with your actual project path, or omit --workspace to auto-detect from git root.
Quick command to edit:
# macOS/Linux
code ~/Library/Application\ Support/Claude/claude_desktop_config.json # or use your editor
# Linux
code ~/.config/Claude/claude_desktop_config.jsonFor Gemini CLI or other MCP clients, add LSMCP to your MCP server configuration:
{
"mcpServers": {
"lsmcp": {
"command": "lsmcp",
"args": ["--workspace", "/path/to/your/project"]
}
}
}Refer to your MCP client's documentation for the specific configuration file location.
If you don't specify --workspace, LSMCP will automatically:
- Search for the nearest git root
- Fall back to the current working directory
Navigate to where a symbol is defined.
Parameters:
file(string): Absolute path to the fileline(integer): Line number (0-indexed)character(integer): Character offset (0-indexed)
Returns: File path and location of the definition(s).
Find all usages of a symbol.
Parameters:
file(string): Absolute path to the fileline(integer): Line number (0-indexed)character(integer): Character offset (0-indexed)includeDeclaration(boolean, optional): Include the declaration (default: true)
Returns: List of all locations where the symbol is referenced.
Get hover information (documentation, type info, signatures).
Parameters:
file(string): Absolute path to the fileline(integer): Line number (0-indexed)character(integer): Character offset (0-indexed)
Returns: Documentation, type information, and function signatures.
Get the symbol outline for a file.
Parameters:
file(string): Absolute path to the file
Returns: Hierarchical structure of all symbols (classes, functions, variables, etc.).
Get diagnostics (errors, warnings, hints) for a file.
Parameters:
file(string): Absolute path to the file
Returns: List of diagnostics with severity, location, and message. Shows compiler errors, linting issues, type errors, and other problems detected by the LSP server.
Search for symbols across the entire workspace by name or pattern.
Parameters:
query(string): Search query (symbol name or pattern)language(string): Language to search in (e.g., 'rust', 'typescript', 'python', 'go')
Returns: List of symbols matching the query with their locations and types. Useful for finding functions, classes, variables, etc. across multiple files.
| Language | LSP Server | Extensions |
|---|---|---|
| TypeScript/JavaScript | typescript-language-server | .ts, .tsx, .js, .jsx, .mjs, .cjs |
| Python | pyright | .py, .pyi |
| Rust | rust-analyzer | .rs |
| Go | gopls | .go |
- Systems: C/C++ (clangd), Zig (zls)
- Scripting: Lua, Ruby (solargraph), Bash
- Functional: Haskell, Elixir
- JVM: Java (jdtls), Scala (metals)
- Web: JSON, CSS, HTML, Svelte, Vue
- Markup/Config: YAML, TOML (taplo), LaTeX (texlab), Markdown (marksman), Dockerfile
See registry/ for complete list and installation instructions.
Create .lsmcp.toml in your project root or ~/.config/lsmcp/config.toml:
[settings]
log_level = "info"
# Override default LSP for Python
[language_overrides]
python = "pylsp" # Use pylsp instead of pyright
# Custom LSP configuration
[lsp.my-lsp]
languages = ["mylang"]
file_extensions = ["ml"]
command = "my-lsp-server"
args = ["--stdio"]
# Override LSP command path
[lsp.rust-analyzer]
command = "/custom/path/to/rust-analyzer"LSMCP uses a 3-tier system:
- User config - Highest priority
- Mason registry (embedded in binary) - Medium priority
- Built-in defaults - Lowest priority
lsmcp [OPTIONS]
Options:
-w, --workspace <WORKSPACE>
Workspace root directory (auto-detects git root if not specified)
-l, --log-level <LOG_LEVEL>
Log level: trace, debug, info, warn, error [default: info]
--log-file <LOG_FILE>
Write logs to file instead of stderr
-h, --help
Print help
-V, --version
Print version┌─────────────────┐
│ Claude Code / │
│ Gemini CLI │
└────────┬────────┘
│ MCP Protocol (stdio)
│
┌────────▼────────────────────────────┐
│ LSMCP (Rust Binary) │
│ ┌──────────────────────────────┐ │
│ │ MCP Server │ │
│ │ - JSON-RPC over stdio │ │
│ │ - Tool handlers │ │
│ └──────────┬───────────────────┘ │
│ │ │
│ ┌──────────▼───────────────────┐ │
│ │ LSP Manager │ │
│ │ - Lazy initialization │ │
│ │ - Process lifecycle │ │
│ └──────────┬───────────────────┘ │
│ │ │
│ ┌──────────▼───────────────────┐ │
│ │ LSP Client Pool │ │
│ │ - Per-language clients │ │
│ │ - JSON-RPC over stdin/out │ │
│ └──────────┬───────────────────┘ │
└─────────────┼────────────────────────┘
│ LSP Protocol
┌────────┴────────┐
│ │
┌────▼─────┐ ┌─────▼──────┐
│typescript│ │ rust- │
│-language-│ │ analyzer │ ...
│ server │ │ │
└───────────┘ └────────────┘
- MCP Client (Claude Code) sends a tool call request via stdin
- MCP Server parses the JSON-RPC request
- LSP Manager routes to the appropriate LSP client (spawns if needed)
- LSP Client communicates with the language server
- Response flows back through the chain, formatted for the MCP client
lsmcp/
├── src/
│ ├── config/ # Configuration system (3-tier)
│ ├── lsp/ # LSP client & manager
│ ├── mcp/ # MCP server & tools
│ ├── types/ # Error types
│ └── utils/ # Utilities
├── registry/ # LSP package definitions (20 LSPs)
├── scripts/ # Registry sync scripts
└── docs/ # Architecture & planning docs
cargo testcargo build --releaseBinary will be in target/release/lsmcp.
Contributions welcome! Areas for improvement:
- Add more MCP tools (workspace symbols, call hierarchy, diagnostics)
- Support more languages
- Improve error messages
- Add integration tests
- Performance optimizations
Dual-licensed under MIT or Apache-2.0.
- Built with the Language Server Protocol
- Inspired by Mason registry
- Implements Model Context Protocol
Made with 🦀