A powerful command-line interface for the Language Server Agent Protocol (LSAP). lsp-cli provides a bridge between traditional Language Server Protocol (LSP) servers and high-level agentic workflows, offering structured data access and a robust background server management system.
Built on top of lsp-client and LSAP, this tool is designed for developers and AI agents who need reliable, fast, and structured access to language intelligence.
- 🚀 Instant Analysis: Quickly get definitions, references, hover info, and completions from the terminal.
- 🏢 Managed Server Lifecycle: A background manager automatically handles language server processes, reusing them across requests for maximum performance.
- 🧩 LSAP Integration: Leverages the Language Server Agent Protocol for structured, agent-friendly responses with built-in pagination and text-based location finding.
- ⚡ Async-First: Built with
anyioandasyncerfor high-performance concurrent operations. - 🎨 Rich Output: Beautifully formatted terminal output using
rich.
uv tool install lsp-cliThe main entry point is the lsp command. It automatically detects the appropriate language server for your project.
lsp definition main.py --line 10 --find "my_function"lsp completion src/utils.py --line 5 --find "obj."lsp reference models.py --line 20 --find "UserClass"lsp symbol "MyClass" .| Command | Description | Alias |
|---|---|---|
definition |
Find symbol definition, declaration, or type definition | def |
completion |
Get code completion suggestions with pagination | comp |
hover |
Get hover information (type info, documentation) | - |
reference |
Find symbol references or implementations | ref |
outline |
Get a structured symbol outline for a file | - |
symbol |
Search for symbols across the entire workspace | sym |
server |
Manage background LSP server processes | - |
lsp-cli uses a background manager process to keep language servers alive between command invocations. This significantly reduces latency for repeated queries.
# List all running LSP servers
lsp server list
# Manually start a server for a path
lsp server start .
# Stop a server
lsp server stop .The manager starts automatically when you run any analysis command.
lsp-cli can be configured via environment variables or a config.toml file.
- Config File:
~/.config/lsp-cli/config.toml(on Linux) or~/Library/Application Support/lsp-cli/config.toml(on macOS). - Environment Variables: Prefix with
LSP_(e.g.,LSP_LOG_DIR=/tmp/logs).
Contributions are welcome! Please see our Contributing Guide for details on:
- Development setup
- Adding new CLI commands
- Improving the server manager
- Development workflow
This project is licensed under the MIT License - see the LICENSE file for details.
- lsp-client: The underlying LSP client library.
- LSAP: The Language Server Agent Protocol.
- lsprotocol: LSP type definitions.