cclsp
ktnyt · ktnyt/cclsp
An MCP server that bridges coding agents like Claude Code with Language Server Protocol (LSP) for accurate symbol definitions and refactoring.
Claude Code LSP: enhance your Claude Code experience with non-IDE dependent LSP integration.
Preview
What you can do with it
- Helping Claude Code find the exact definition of a function across a large codebase
- Safely renaming symbols across multiple files using LSP's semantic intelligence
- Retrieving real-time diagnostics and error highlights directly into the agent's context
Safety check
No risky patterns found in the files we scanned.
Automated scan of the repo files. Always review code you run.
From the README
cclsp - not your average LSP adapter
cclsp 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.
Setup & Usage Demo
https://github.com/user-attachments/assets/52980f32-64d6-4b78-9cbf-18d6ae120cdd
Table of Contents
- Why cclsp?
- Features
- 📋 Prerequisites
- ⚡ Setup
- 🚀 Usage
- 🛠️ Development
- 🔧 MCP Tools
- 💡 Real-world Examples
- 🔍 Troubleshooting
- 🤝 Contributing
- 📄 License
Why cclsp?
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:
- 🔍 Instant symbol navigation - Jump to definitions without manually searching
- 📚 Complete reference finding - Find all usages of functions, variables, and types
- ✏️ Safe symbol renaming - Rename across entire codebases with confidence
- 🌍 Universal language support - Works with any LSP-compatible language server
- 🤖 AI-friendly interface - Designed for LLMs to understand and use effectively
Features
- Go to Definition: Find where symbols are defined
- Find References: Locate all references to a symbol
- Multi-language Support: Configurable LSP servers for different file types
- TypeScript: Built-in support via typescript-language-server
- Python: Support via python-lsp-server (pylsp)
- Go: Support via gopls
- And many more: Extensive language server configurations
📋 Prerequisites
- Node.js 18+ or Bun runtime
- Language servers for your target languages (installed separately)
⚡ Setup
cclsp provides an interactive setup wizard that automates the entire configuration process. Choose your preferred method:
Automated Setup (Recommended)
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:
- 🔍 Auto-detect languages in your project by scanning files
- 📋 Show pre-selected LSP servers based on detected languages
- 📦 Display installation requirements with detailed guides
- ⚡ Install LSPs automatically (optional, with user confirmation)
- 🔗 Add to Claude MCP (optional, with user confirmation)
- ✅ Verify setup and show available tools
Setup Options
- Project Configuration (default): Creates
.claude/cclsp.jsonin current directory - User Configuration (
--user): Creates global config in~/.config/claude/cclsp.json
Manual Setup
If 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
Language Server Installation
The setup wizard shows installation commands for each LSP, but you can also install them manually:
📦 Common Language Servers
TypeScript/JavaScript
npm install -g typescript-language-server typescript
Python
pip install "python-lsp-server[all]"
# Or basic installation: pip install python-lsp-server
Go
go install golang.org/x/tools/gopls@latest
Rust
rustup component add rust-analyzer
rustup component add rust-src
C/C++
# Ubuntu/Debian
sudo apt install clangd
# macOS
brew install llvm
# Windows: Download from LLVM releases
Ruby
gem install solargraph
PHP
npm install -g intelephense
For more languages and detailed instructions, run npx cclsp@latest setup and select "Show detailed installation guides".
🚀 Usage
As MCP Server
Configure in your MCP client (e.g., Claude Code):
Using npm package (after global install)
{
"mcpServers": {
"cclsp": {
"command": "cclsp",
"env": {
"CCLSP_CONFIG_PATH": "/path/to/your/cclsp.json"
}
}
}
}
Using local installation
{
"mcpServers": {
"cclsp": {
"command": "node",
"args": ["/path/to/cclsp/dist/index.js"],
"env": {
"CCLSP_CONFIG_PATH": "/path/to/your/cclsp.json"
}
}
}
}
Configuration
Interactive Configuration Generator
For easy setup, use the interactive configuration generator:
# Using npx (recommended f