From plugin-dev
Guides integration of LSP servers into Claude Code plugins via plugin.json or .lsp.json for code intelligence like go-to-definition, references, hovers, and completions.
npx claudepluginhub sjnims/plugin-dev --plugin plugin-devThis skill uses the workspace's default tool permissions.
Language Server Protocol (LSP) servers provide code intelligence features like go-to-definition, find references, and hover information. Claude Code plugins can bundle or configure LSP servers to enhance Claude's understanding of code.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Language Server Protocol (LSP) servers provide code intelligence features like go-to-definition, find references, and hover information. Claude Code plugins can bundle or configure LSP servers to enhance Claude's understanding of code.
Key capabilities:
Plugins can provide LSP servers in the plugin manifest:
{
"name": "my-plugin",
"lspServers": {
"python": {
"command": "pyright-langserver",
"args": ["--stdio"],
"extensionToLanguage": {
".py": "python",
".pyi": "python"
}
}
}
}
LSP servers can also be configured in a separate .lsp.json file at the plugin root:
{
"go": {
"command": "gopls",
"args": ["serve"],
"extensionToLanguage": {
".go": "go"
}
}
}
Reference this file in plugin.json:
{
"name": "my-plugin",
"lspServers": "./.lsp.json"
}
command (required): The LSP server executable
args (optional): Command-line arguments for the server
extensionToLanguage (required): Maps file extensions to language IDs
{
"extensionToLanguage": {
".py": "python",
".pyi": "python",
".pyw": "python"
}
}
env (optional): Environment variables for the server process
{
"env": {
"PYTHONPATH": "${CLAUDE_PLUGIN_ROOT}/lib"
}
}
transport (optional): Communication transport - stdio (default) or socket
{
"lspServers": {
"dart": {
"transport": "socket",
"command": "dart",
"args": ["language-server", "--port", "8123"],
"extensionToLanguage": { ".dart": "dart" }
}
}
}
Socket transport connects to the server via TCP port instead of stdin/stdout.
initializationOptions (optional): Options passed to the server during LSP initialization
{
"initializationOptions": {
"typescript": {
"tsdk": "./node_modules/typescript/lib"
},
"diagnostics": true,
"formatting": { "tabSize": 2 }
}
}
settings (optional): Settings passed via workspace/didChangeConfiguration
workspaceFolder (optional): Workspace folder path for the server
startupTimeout (optional): Maximum time to wait for server startup in milliseconds
shutdownTimeout (optional): Maximum time to wait for graceful shutdown in milliseconds
restartOnCrash (optional): Whether to automatically restart the server if it crashes
maxRestarts (optional): Maximum number of restart attempts before giving up
When an LSP plugin is installed and its language server binary is available, Claude gains two key capabilities:
After every file edit Claude makes, the language server analyzes the changes and reports errors and warnings back automatically. Claude sees type errors, missing imports, and syntax issues without needing to run a compiler or linter. If Claude introduces an error, it notices and fixes the issue in the same turn.
Claude can use the language server to:
These operations give Claude more precise navigation than grep-based search.
Claude Code provides official LSP plugins for common languages. Install from the marketplace:
| Language | Plugin | Binary Required |
|---|---|---|
| C/C++ | clangd-lsp | clangd |
| C# | csharp-lsp | csharp-ls |
| Go | gopls-lsp | gopls |
| Java | jdtls-lsp | jdtls |
| Kotlin | kotlin-lsp | kotlin-language-server |
| Lua | lua-lsp | lua-language-server |
| PHP | php-lsp | intelephense |
| Python | pyright-lsp | pyright-langserver |
| Rust | rust-analyzer-lsp | rust-analyzer |
| Swift | swift-lsp | sourcekit-lsp |
| TypeScript | typescript-lsp | typescript-language-server |
Install the language server binary first, then install the plugin:
# Example: Python
pip install pyright # or: npm install -g pyright
claude /install-plugin pyright-lsp
Troubleshooting: If you see Executable not found in $PATH in the /plugin Errors tab, install the required binary from the table above.
Options:
{
"name": "go-lsp",
"version": "1.0.0",
"description": "Go language server integration",
"lspServers": {
"go": {
"command": "gopls",
"args": ["serve"],
"extensionToLanguage": {
".go": "go",
".mod": "go.mod"
}
}
}
}
For self-contained plugins, bundle the server:
my-lsp-plugin/
├── .claude-plugin/
│ └── plugin.json
└── servers/
└── my-lsp-server
Use ${CLAUDE_PLUGIN_ROOT} for the command path:
{
"lspServers": {
"mylang": {
"command": "${CLAUDE_PLUGIN_ROOT}/servers/my-lsp-server",
"args": ["--stdio"]
}
}
}
In your plugin README:
The extensionToLanguage field maps file extensions to LSP language identifiers:
{
"extensionToLanguage": {
".py": "python",
".js": "javascript",
".ts": "typescript",
".jsx": "javascriptreact",
".tsx": "typescriptreact",
".rs": "rust",
".go": "go",
".java": "java",
".rb": "ruby",
".php": "php",
".c": "c",
".cpp": "cpp",
".h": "c",
".hpp": "cpp",
".cs": "csharp"
}
}
A single language can have multiple extensions:
{
"extensionToLanguage": {
".ts": "typescript",
".mts": "typescript",
".cts": "typescript",
".d.ts": "typescript"
}
}
LSP servers start automatically when:
Servers terminate when:
Check:
${CLAUDE_PLUGIN_ROOT} is used for bundled serversCheck:
extensionToLanguage mappingEnable debug logging:
claude --debug
Look for:
{
"lspServers": {
"language": {
"command": "server-command",
"extensionToLanguage": {
".ext": "language-id"
}
}
}
}
{
"lspServers": {
"language": {
"command": "${CLAUDE_PLUGIN_ROOT}/servers/lsp-server",
"args": ["--stdio", "--log-level", "warn"],
"extensionToLanguage": {
".ext1": "language",
".ext2": "language"
},
"env": {
"CONFIG_PATH": "${CLAUDE_PLUGIN_ROOT}/config"
},
"transport": "stdio",
"initializationOptions": {},
"settings": {},
"workspaceFolder": ".",
"startupTimeout": 10000,
"shutdownTimeout": 5000,
"restartOnCrash": true,
"maxRestarts": 3
}
}
}
DO:
${CLAUDE_PLUGIN_ROOT} for bundled server pathsDON'T:
For detailed information, consult:
references/popular-lsp-servers.md - Curated list of LSP servers by language with installation commandsreferences/lsp-capabilities.md - LSP protocol capabilities and what they enableexamples/minimal-lsp-plugin/ - Complete directory structure for a minimal LSP pluginexamples/lsp-json-configs.md - Various .lsp.json configuration patterns