Enable LSP tool to connect to installed language servers

Open 💬 17 comments Opened Dec 28, 2025 by cosmicflow-space

Feature Request

The Claude Code CLI has an LSP tool (LSP with operations like goToDefinition, findReferences, hover, etc.), but it currently returns "No LSP server available for file type" even when language servers are installed globally.

Current Behavior

LSP tool call: goToDefinition on .ts file
Result: "No LSP server available for file type: .ts"

This occurs even with typescript-language-server and pyright installed globally via npm.

Requested Behavior

The LSP tool should:

  1. Auto-discover installed language servers (typescript-language-server, pyright, gopls, etc.)
  2. Or allow configuration in ~/.claude/settings.json to specify server paths
  3. Enable faster, type-aware code navigation vs. grep-based searches

Use Case

When working on large codebases, LSP provides:

  • Precise "Go to Definition" (not just text matching)
  • Type-aware "Find References"
  • Hover documentation
  • Call hierarchy analysis

This would significantly speed up code exploration tasks.

Environment

  • Claude Code CLI (latest)
  • macOS with globally installed: typescript-language-server, pyright
  • Projects: TypeScript/Next.js, Python

View original on GitHub ↗

17 Comments

mihkell · 6 months ago

Same with languages like elm-lang

TrueCrimeDev · 6 months ago
github-actions[bot] · 5 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

wh-zfy · 5 months ago

The issue is still there!

I tried installing the Java LSP, which is not working because of an error in the marketplace configuration. Which is unfixed for weeks and has never worked, so nobody did ever test this officially announced feature. anthropics/claude-plugins-official#245

Once this is worked around, still none of the tools is available. A workaround is to set the ENABLE_LSP_TOOL=1 env variable, so ENABLE_LSP_TOOL=1 claude will run it with LSP tools enabled. But this is not mentioned anywhere in the documentation.

MikaelFangel · 5 months ago

Thank you! Couldn't get it to work either but then Claude Code picked up this thread and suggested you fix.

karanb192 · 4 months ago

@wh-zfy , your workaround didn't work for me. Does it work for everyone else?

<img width="614" height="981" alt="Image" src="https://github.com/user-attachments/assets/e70cb94f-316c-42eb-a14b-c21efa1e27d5" />

karanb192 · 4 months ago

I debugged further and ran this command on terminal -
claude plugin list

Then I reinstalled the plugins and it worked. Along with the environment variable recommended by @wh-zfy of course!

<img width="455" height="522" alt="Image" src="https://github.com/user-attachments/assets/0d04f55e-6cc9-4351-869f-9e92b0630b44" />

<img width="466" height="538" alt="Image" src="https://github.com/user-attachments/assets/17b1d190-b31d-4ace-9e30-7887fe8ff73b" />

730alchemy · 4 months ago

@claude wtf is going on with the LSP server plugins in the marketplace? All of them have only 2 files: license and readme. The Claude Code documents indicate that LSP server plugins are available (https://code.claude.com/docs/en/plugins-reference#lsp-servers) but they aren't. People are trying hacks to get these LSP server plugins available, there are at least a dozen issues open regarding LSP plugins ... in short, a lot of wasted time and no official acknowledgement of this problem or how to solve/workaround. What is going on? What should we do?

mrclrchtr · 4 months ago

https://www.reddit.com/r/ClaudeCode/s/tHaHcFPdvY

TLDR

Add this to your ~/.claude/settings.json:

"env": { "ENABLE_LSP_TOOL": "1" }

730alchemy · 4 months ago

holy shit, that did the trick! Thank you @mrclrchtr

dbtreasure · 4 months ago

Workaround: Using ty (Astral's new type checker) as the LSP backend

For anyone wanting to use ty (Astral's Rust-based Python type checker, now in beta) instead of pyright, here's what worked:

1. Set the env var in ~/.claude/settings.json

{
  "env": {
    "ENABLE_LSP_TOOL": "1"
  }
}

2. Fix the pyright-lsp plugin manifest

The installed plugin at ~/.claude/plugins/cache/claude-plugins-official/pyright-lsp/1.0.0/.claude-plugin/plugin.json has unrecognized keys that cause validation errors (source, category, strict). Remove them so it looks like:

{
  "name": "pyright-lsp",
  "description": "Python language server (Pyright) for type checking and code intelligence",
  "version": "1.0.0",
  "author": {
    "name": "Anthropic",
    "email": "support@anthropic.com"
  },
  "lspServers": {
    "pyright": {
      "command": "pyright-langserver",
      "args": ["--stdio"],
      "extensionToLanguage": {
        ".py": "python",
        ".pyi": "python"
      }
    }
  }
}

3. Install ty and create a shim

Install ty globally:

uv tool install ty@latest

Create a shim at /usr/local/bin/pyright-langserver that redirects to ty's LSP:

#!/bin/sh
exec ty server
chmod +x /usr/local/bin/pyright-langserver

The plugin calls pyright-langserver --stdio, the shim intercepts and runs ty server instead. ty's LSP speaks the same protocol over stdio. The --stdio arg is silently ignored by ty which is fine.

4. Restart Claude Code

After restart, the LSP tool becomes available with full support for goToDefinition, findReferences, hover, documentSymbol, workspaceSymbol, etc. — all powered by ty.

You can verify with ps aux | grep "ty server" to confirm it's actually ty running.

jotadepicas · 4 months ago

I applied the same fix @dbtreasure suggests (adding env var, reconstructing the plugin manifest - in my case the manifest was completely absent like @730alchemy mentions, installing plugin, restart Claude) and it worked also for typescript-language-server. For anyone needing this, this is the manifest Claude itself suggested. Also, I added a line in my CLAUDE.md to make Claude always try using the LSP tool, and warn the user if its not available (helps ensuring every dev has this configured properly):

mkdir -p ~/.claude/plugins/marketplaces/claude-plugins-official/plugins/typescript-lsp/.claude-plugin

cat > ~/.claude/plugins/marketplaces/claude-plugins-official/plugins/typescript-lsp/.claude-plugin/plugin.json << 'EOF'
{
  "name": "typescript-lsp",
  "description": "TypeScript/JavaScript language server for code intelligence",
  "version": "1.0.0",
  "author": {
    "name": "Anthropic",
    "email": "support@anthropic.com"
  },
  "lspServers": {
    "typescript": {
      "command": "typescript-language-server",
      "args": ["--stdio"],
      "extensionToLanguage": {
        ".ts": "typescript",
        ".tsx": "typescriptreact",
        ".js": "javascript",
        ".jsx": "javascriptreact",
        ".mts": "typescript",
        ".cts": "typescript",
        ".mjs": "javascript",
        ".cjs": "javascript"
      }
    }
  }
}
EOF

Claude says:

● There it is, I have the LSP tool available for all operations:

  - goToDefinition
  - findReferences
  - hover
  - documentSymbol
  - workspaceSymbol
  - goToImplementation
  - prepareCallHierarchy / incomingCalls / outgoingCalls
kiankyars · 4 months ago

status?

KingMob · 4 months ago

Given the age of this issue, can anyone from Anthropic comment on why LSPs are not better-supported? Do LSPs not work as well in practice as hoped? It seems odd.

jotadepicas · 3 months ago

Same fix works for Python (pylsp / python-lsp-server). Sharing in case anyone needs it:

  1. Install the language server:
pip install python-lsp-server
  1. Reconstruct the plugin manifest (the pyright-lsp plugin directory exists but has no plugin.json):
mkdir -p ~/.claude/plugins/marketplaces/claude-plugins-official/plugins/pyright-lsp/.claude-plugin

cat > ~/.claude/plugins/marketplaces/claude-plugins-official/plugins/pyright-lsp/.claude-plugin/plugin.json << 'PLUGIN'
{
  "name": "pyright-lsp",
  "description": "Python language server for code intelligence",
  "version": "1.0.0",
  "author": {
    "name": "Anthropic",
    "email": "support@anthropic.com"
  },
  "lspServers": {
    "python": {
      "command": "pylsp",
      "args": [],
      "extensionToLanguage": {
        ".py": "python",
        ".pyi": "python"
      }
    }
  }
}
PLUGIN
  1. Enable the plugin in ~/.claude/settings.json:
{
  "enabledPlugins": {
    "pyright-lsp@claude-plugins-official": true
  }
}
  1. Restart Claude Code.

Verified working — documentSymbol, hover, goToDefinition etc. all operational. Same pattern as my TypeScript fix above.

patrikhuber · 3 months ago

This https://github.com/anthropics/claude-plugins-official/pull/378 fixed it for me, LSP plugins now working.

rosdi · 2 months ago

I prodded Claude about why it used grep instead of LSP when searching for certain information. Here is its answer:

<img width="1656" height="128" alt="Image" src="https://github.com/user-attachments/assets/d2f90f17-da6b-47e9-9b2d-3e7ecb45ec52" />