loading…
Search for a command to run...
loading…
MCP server for accessing LSP functionality
MCP server for accessing LSP functionality
MseeP.ai Security Assessment Badge
npm version License: MIT Node.js Version CI npm downloads PRs Welcome
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.
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 dev
# Run tests
bun test
# Run manual integration test
bun run test:manual
# Lint code
bun run lint
# Format code
bun run format
# Type check
bun run typecheck
The server exposes these MCP tools:
find_definitionFind the definition of a symbol by name and kind in a file. Returns definitions for all matching symbols.
Parameters:
file_path: The path to the filesymbol_name: The name of the symbolsymbol_kind: The kind of symbol (function, class, variable, method, etc.) (optional)find_referencesFind all references to a symbol across the entire workspace. Returns references for all matching symbols.
Parameters:
file_path: The path to the file where the symbol is definedsymbol_name: The name of the symbolsymbol_kind: The kind of symbol (function, class, variable, method, etc.) (optional)include_declaration: Whether to include the declaration (optional, default: true)rename_symbolRename a symbol by name and kind in a file. This tool now applies the rename to all affected files by default. If multiple symbols match, returns candidate positions and suggests using rename_symbol_strict.
Parameters:
file_path: The path to the filesymbol_name: The name of the symbolsymbol_kind: The kind of symbol (function, class, variable, method, etc.) (optional)new_name: The new name for the symboldry_run: If true, only preview the changes without applying them (optional, default: false)Note: When dry_run is false (default), the tool will:
.bak extensionrename_symbol_strictRename a symbol at a specific position in a file. Use this when rename_symbol returns multiple candidates. This tool now applies the rename to all affected files by default.
Parameters:
file_path: The path to the fileline: The line number (1-indexed)character: The character position in the line (1-indexed)new_name: The new name for the symboldry_run: If true, only preview the changes without applying them (optional, default: false)get_diagnosticsGet language diagnostics (errors, warnings, hints) for a file. Uses LSP textDocument/diagnostic to pull current diagnostics.
Parameters:
file_path: The path to the file to get diagnostics forrestart_serverManually restart LSP servers. Can restart servers for specific file extensions or all running servers.
Parameters:
extensions: Array of file extensions to restart servers for (e.g., ["ts", "tsx"]). If not provided, all servers will be restarted (optional)When Claude needs to understand how a function works:
Claude: Let me find the definition of the `processRequest` function
> Using cclsp.find_definition with symbol_name="processRequest", symbol_kind="function"
Result: Found definition at src/handlers/request.ts:127:1
When refactoring or understanding code impact:
Claude: I'll find all places where `CONFIG_PATH` is used
> Using cclsp.find_references with symbol_name="CONFIG_PATH"
Results: Found 5 references:
- src/config.ts:10:1 (declaration)
- src/index.ts:45:15
- src/utils/loader.ts:23:8
- tests/config.test.ts:15:10
- tests/config.test.ts:89:12
Safe refactoring across the entire codebase (now with actual file modification!):
Claude: I'll rename `getUserData` to `fetchUserProfile`
> Using cclsp.rename_symbol with symbol_name="getUserData", new_name="fetchUserProfile"
Result: Successfully renamed getUserData (function) to "fetchUserProfile".
Modified files:
- src/api/user.ts
- src/services/auth.ts
- src/components/UserProfile.tsx
... (12 files total)
Preview changes before applying (using dry_run):
Claude: Let me first preview what will be renamed
> Using cclsp.rename_symbol with symbol_name="getUserData", new_name="fetchUserProfile", dry_run=true
Result: [DRY RUN] Would rename getUserData (function) to "fetchUserProfile":
File: src/api/user.ts
- Line 55, Column 10 to Line 55, Column 21: "fetchUserProfile"
File: src/services/auth.ts
- Line 123, Column 15 to Line 123, Column 26: "fetchUserProfile"
... (12 files total)
When multiple symbols match:
Claude: I'll rename the `data` variable to `userData`
> Using cclsp.rename_symbol with symbol_name="data", new_name="userData"
Result: Multiple symbols found matching "data". Please use rename_symbol_strict with one of these positions:
- data (variable) at line 45, character 10
- data (parameter) at line 89, character 25
- data (property) at line 112, character 5
> Using cclsp.rename_symbol_strict with line=45, character=10, new_name="userData"
Result: Successfully renamed symbol at line 45, character 10 to "userData".
Modified files:
- src/utils/parser.ts
When analyzing code quality:
Claude: Let me check for any errors or warnings in this file
> Using cclsp.get_diagnostics
Results: Found 3 diagnostics:
- Error [TS2304]: Cannot find name 'undefinedVar' (Line 10, Column 5)
- Warning [no-unused-vars]: 'config' is defined but never used (Line 25, Column 10)
- Hint: Consider using const instead of let (Line 30, Column 1)
When LSP servers become unresponsive or configuration changes:
Claude: The TypeScript server seems unresponsive, let me restart it
> Using cclsp.restart_server with extensions ["ts", "tsx"]
Result: Successfully restarted 1 LSP server(s)
Restarted servers:
• typescript-language-server --stdio (ts, tsx)
Or restart all servers:
Claude: I'll restart all LSP servers to ensure they're working properly
> Using cclsp.restart_server
Result: Successfully restarted 2 LSP server(s)
Restarted servers:
• typescript-language-server --stdio (ts, tsx)
• pylsp (py)
Problem: The Python Language Server (pylsp) may become slow or unresponsive after extended use (several hours), affecting symbol resolution and code navigation.
Symptoms:
Solution: Use the auto-restart feature to periodically restart the pylsp server:
Add restartInterval to your Python server configuration:
{
"servers": [
{
"extensions": ["py", "pyi"],
"command": ["pylsp"],
"restartInterval": 5
}
]
}
This will automatically restart the Python LSP server every 5 minutes, maintaining optimal performance for long coding sessions.
Alternative: You can also manually restart servers using the restart_server tool when needed:
restart_server with extensions: ["py"]restart_server without parametersNote: The setup wizard automatically configures this for Python servers when detected.
Problem: Error message about LSP server not found
Solution: Ensure the language server is installed:
# For TypeScript
npm install -g typescript-language-server
# For Python
pip install python-lsp-server
# For Go
go install golang.org/x/tools/gopls@latest
Problem: cclsp uses default TypeScript configuration only
Solution: Check that:
cclsp.json (not cclsp.config.json)CCLSP_CONFIG_PATH environment variable points to the correct fileProblem: "Go to definition" returns no results
Solution:
We welcome contributions! Here's how you can help:
Found a bug or have a feature request? Open an issue with:
Want to add support for a new language?
git checkout -b feature/amazing-featurebun testgit commit -m '✨ feat: add amazing feature'git push origin feature/amazing-featureMIT
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"cclsp": {
"command": "npx",
"args": [
"-y",
"cclsp"
]
}
}
}PRs, issues, code search, CI status
Database, auth and storage
Reference / test server with prompts, resources, and tools.
Secure file operations with configurable access controls.