● Communauté
isaacphi
⚡ Instantané
mcp-language-server
par isaacphi · isaacphi/mcp-language-server
Give your agent real LSP semantics — go-to-definition, references, rename, diagnostics — via any stdio language server.
isaacphi/mcp-language-server is a Go binary that bridges MCP to any stdio LSP (gopls, rust-analyzer, pyright, typescript-language-server, clangd). Agents get symbol-accurate operations instead of text-search approximations.
Pourquoi l'utiliser
Fonctionnalités clés
- LSP semantic operations: definition, references, rename, hover, diagnostics
- Works with any stdio LSP (gopls, rust-analyzer, pyright, tsserver, clangd)
- Single Go binary, easy install
- edit_file uses LSP-backed rename for correctness
- One MCP instance per LSP; compose multiple for polyglot repos
Démo en direct
Aperçu en pratique
language-server.replay
▶ prêt
Cas d'usage
Usages concrets : mcp-language-server
Quand l'utiliser : You want a rename that understands scope, not a find-replace.
Prérequis
- Go installed — brew install go
- The LSP for your language — gopls: go install golang.org/x/tools/gopls@latest; pyright: pip install pyright; etc.
- Install the MCP — go install github.com/isaacphi/mcp-language-server@latest
Déroulement
-
Start the MCP pointed at your workspace + LSP
Add MCP config: command=mcp-language-server, args=['--workspace','.','--lsp','gopls'].✓ Copié
→ Tools appear
-
Find references first
references for symbol 'LegacyAuth' in file auth.go.✓ Copié
→ Precise cross-repo references
-
Rename
rename_symbol 'LegacyAuth' -> 'Auth' at the definition site.✓ Copié
→ All callsites updated correctly
Résultat : Semantically-correct rename across the repo.
Pièges
- Agent falls back to text find-replace when the tool fails — Verify diagnostics after rename — compile errors mean the LSP refused and the agent cheated
Quand l'utiliser : Agent keeps reading whole files to find one function.
Déroulement
-
Query definition
definition for 'computeTax' in src/billing.ts.✓ Copié
→ Exact file:line location
-
Pull diagnostics
diagnostics for the current file.✓ Copié
→ Red squigglies from the LSP
Résultat : Agent navigates like an IDE user.
Pièges
- LSP not initialized — slow first call — Warm up with a list of files in the workspace; pyright especially is slow to index
Quand l'utiliser : You want semantic ops in every language.
Déroulement
-
Register one MCP per LSP
Add 3 MCP entries: lsp-go (gopls), lsp-ts (tsserver), lsp-py (pyright), each scoped to its workspace subfolder.✓ Copié
→ 3 sets of language-specific tools
-
Use them in turn
For TypeScript questions use lsp-ts:definition; for Go use lsp-go:definition.✓ Copié
→ Correct semantics per language
Résultat : Semantically-aware navigation across all languages.
Pièges
- Agent forgets which MCP handles which language — Rename tool prefixes descriptively and mention in your project memory
Combinaisons
Associez-le à d'autres MCPs pour un effet X10
Combine LSP navigation with semantic/embedding search for broader queries
Use language-server's references for exact usages of computeTax, then contextplus semantic search to find conceptually-related functions.✓ Copié
Rename + commit + PR
Rename LegacyAuth to Auth via the LSP, commit to a new branch, open a PR.✓ Copié
Coût et limites
Coût d'exécution
- Quota d'API
- None — local LSP
- Tokens par appel
- Small — LSP responses are compact
- Monétaire
- Free
- Astuce
- Use LSP-backed tools before embedding search — often cheaper and more precise.
Sécurité
Permissions, secrets, portée
Portées minimales : Filesystem read/write to the workspace
Stockage des identifiants : None
Sortie de données : Localhost only; LSP runs in-process
Ne jamais accorder : Don't point it at workspaces with secrets — LSPs sometimes index them
- edit_file respects LSP validation but doesn't guarantee atomicity across multi-file edits.
Dépannage
Erreurs courantes et correctifs
tool returns 'LSP not ready'
First call triggers initialization — retry after 2-5 seconds, or warm up with a hover call.
gopls: 'no packages found'
Point workspace at the module root (where go.mod is), not a subfolder.
Vérifier : go env GOMOD
pyright slow on big repos
Configure pyrightconfig.json to exclude vendored dirs.
rename_symbol reports success but compile still fails
Rename touched a string literal or reflection-based code the LSP can't see. Check grep for the old name.
Alternatives
mcp-language-server vs autres
| Alternative | Quand l'utiliser | Compromis |
| Context+ | You want embedding + memory graph rather than LSP semantics | Not as precise on rename/references |
| Serena MCP | You want LSP with higher-level refactors | Different setup; Python-based |