by ktnyt
Claude Code LSP: enhance your Claude Code experience with non-IDE dependent LSP integration.
# Add to your Claude Code skills
git clone https://github.com/ktnyt/cclspcclsp is a Model Context Protocol (MCP) server that seamlessly integrates LLM-based coding agents with Language Server Protocol (LSP) servers. LLM-based coding agents often struggle with providing accurate line/column numbers, which makes naive attempts to integrate with LSP servers fragile and frustrating. cclsp solves this by intelligently trying multiple position combinations and providing robust symbol resolution that just works, no matter how your AI assistant counts lines.
https://github.com/user-attachments/assets/52980f32-64d6-4b78-9cbf-18d6ae120cdd
When using AI-powered coding assistants like Claude, you often need to navigate codebases to understand symbol relationships. cclsp bridges the gap between Language Server Protocol capabilities and Model Context Protocol, enabling:
cclsp provides an interactive setup wizard that automates the entire configuration process. Choose your preferred method:
Run the interactive setup wizard:
# One-time setup (no installation required)
npx cclsp@latest setup
# For user-wide configuration
npx cclsp@latest setup --user
The setup wizard will:
.claude/cclsp.json in current directory--user): Creates global config in ~/.config/claude/cclsp.jsonIf you prefer manual configuration:
Install cclsp:
npm install -g cclsp
Install language servers (see Language Server Installation)
Create configuration file:
# Use the interactive generator
cclsp setup
# Or create manually (see Configuration section)
Add to Claude MCP:
claude mcp add cclsp npx cclsp@latest --env CCLSP_CONFIG_PATH=/path/to/cclsp.json
The setup wizard shows installation commands for each LSP, but you can also install them manually:
npm install -g typescript-language-server typescript
pip install "python-lsp-server[all]"
# Or basic installation: pip install python-lsp-server
go install golang.org/x/tools/gopls@latest
rustup component add rust-analyzer
rustup component add rust-src
# Ubuntu/Debian
sudo apt install clangd
# macOS
brew install llvm
# Windows: Download from LLVM releases
gem install solargraph
npm install -g intelephense
For more languages and detailed instructions, run npx cclsp@latest setup and select "Show detailed installation guides".
Configure in your MCP client (e.g., Claude Code):
{
"mcpServers": {
"cclsp": {
"command": "cclsp",
"env": {
"CCLSP_CONFIG_PATH": "/path/to/your/cclsp.json"
}
}
}
}
{
"mcpServers": {
"cclsp": {
"command": "node",
"args": ["/path/to/cclsp/dist/index.js"],
"env": {
"CCLSP_CONFIG_PATH": "/path/to/your/cclsp.json"
}
}
}
}
For easy setup, use the interactive configuration generator:
# Using npx (recommended for one-time setup)
npx cclsp@latest setup
# If installed globally
cclsp setup
# Or run directly with the development version
bun run setup
The interactive tool will:
Alternatively, create an cclsp.json configuration file manually:
{
"servers": [
{
"extensions": ["py", "pyi"],
"command": ["uvx", "--from", "python-lsp-server", "pylsp"],
"rootDir": ".",
"initializationOptions": {
"settings": {
"pylsp": {
"plugins": {
"jedi_completion": { "enabled": true },
"jedi_definition": { "enabled": true },
"jedi_hover": { "enabled": true },
"jedi_references": { "enabled": true },
"jedi_signature_help": { "enabled": true },
"jedi_symbols": { "enabled": true },
"pylint": { "enabled": false },
"pycodestyle": { "enabled": false },
"pyflakes": { "enabled": false }
}
}
}
}
},
{
"extensions": ["js", "ts", "jsx", "tsx"],
"command": ["npx", "--", "typescript-language-server", "--stdio"],
"rootDir": "."
}
]
}
Configuration Options:
extensions: Array of file extensions this server handlescommand: Command array to spawn the LSP serverrootDir: Working directory for the LSP server (optional, defaults to ".")restartInterval: Auto-restart interval in minutes (optional)initializationOptions: LSP server initialization options (optional)The initializationOptions field allows you to customize how each LSP server initializes. This is particularly useful for servers like pylsp (Python) that have extensive plugin configurations, or servers like devsense-php-ls that require specific settings.
{
"servers": [
{
"extensions": ["go"],
"command": ["gopls"],
"rootDir": "."
},
{
"extensions": ["rs"],
"command": ["rust-analyzer"],
"rootDir": "."
},
{
"extensions": ["c", "cpp", "cc", "h", "hpp"],
"command": ["clangd"],
"rootDir": "."
},
{
"extensions": ["java"],
"command": ["jdtls"],
"rootDir": "."
},
{
"extensions": ["rb"],
"command": ["solargraph", "stdio"],
"rootDir": "."
},
{
"extensions": ["php"],
"command": ["intelephense", "--stdio"],
"rootDir": "."
},
{
"extensions": ["cs"],
"command": ["omnisharp", "-lsp"],
"rootDir": "."
},
{
"extensions": ["swift"],
"command": ["sourcekit-lsp"],
"rootDir": "."
}
]
}
# Run in development mode
bun run d
No comments yet. Be the first to share your thoughts!