MCP Hub
Back to servers

LSP-MCP

Bridges the Model Context Protocol with Language Server Protocol to provide AI agents with persistent access to code intelligence features including navigation, diagnostics, refactoring, and completion across 7+ programming languages.

glama
Updated
Apr 6, 2026

lsp-mcp

Blackwell Systems CI LSP 3.17 Languages Tools License

The most complete MCP server for language intelligence — built for agents, not just protocol passthrough. 24 tools spanning navigation, diagnostics, refactoring, and formatting. CI-verified across 7 languages. Built directly against the LSP 3.17 specification.

Unlike typical MCP-LSP bridges, lsp-mcp maintains a persistent language server session — agents operate on a fully indexed, stateful workspace with real-time diagnostics and cross-file reasoning, not a cold-started stub that forgets context between calls.

Designed for agentic workflows where correctness, persistence, and cross-language reliability are required.

Most MCP-LSP bridges are stateless and loosely implemented. They lose workspace context between calls, skip parts of the spec, and behave inconsistently across languages.

That makes them unreliable for agents operating on real codebases.

lsp-mcp fixes that.

Why lsp-mcp

lsp-mcpother MCP-LSP implementations
Languages (CI-verified)71–2
Tools243–5
LSP spec compliance3.17, built to specad hoc
Connection modelpersistentper-request
Cross-file referencesrarely
Real-time diagnostic subscriptions
Test coverage76% statements, 86% functionsrarely tested

Use Cases

  • Agent-driven analysis across large, multi-language repositories
  • Safe, workspace-wide refactoring with full context
  • CI pipelines that validate against real language server behavior
  • Code intelligence without relying on an IDE

Quick Start

{
  "mcpServers": {
    "lsp": {
      "type": "stdio",
      "command": "npx",
      "args": ["blackwell-systems/LSP-MCP", "<language-id>", "<path-to-lsp-binary>", "<lsp-args>"]
    }
  }
}

TypeScript:

{ "args": ["blackwell-systems/LSP-MCP", "typescript", "typescript-language-server", "--stdio"] }

Go:

{ "args": ["blackwell-systems/LSP-MCP", "go", "gopls"] }

Rust:

{ "args": ["blackwell-systems/LSP-MCP", "rust", "rust-analyzer"] }

Multi-Language Support

Every language below is integration-tested on every CI run — start_lsp, open_document, get_diagnostics, and get_info_on_location all verified against the real language server binary:

LanguageServerInstall
TypeScript / JavaScripttypescript-language-servernpm i -g typescript-language-server typescript
Pythonpyright-langservernpm i -g pyright
Gogoplsgo install golang.org/x/tools/gopls@latest
Rustrust-analyzerrustup component add rust-analyzer
Javajdtlseclipse.jdt.ls snapshots
C / C++clangdapt install clangd / brew install llvm
PHPintelephensenpm i -g intelephense

Tools

All tools require start_lsp to be called first.

Session

ToolDescription
start_lspStart the language server with a project root
restart_lsp_serverRestart without restarting the MCP server
open_documentOpen a file for tracking (required before position queries)
close_documentStop tracking a file

Analysis

ToolDescription
get_diagnosticsErrors and warnings — omit file_path for whole project
get_info_on_locationHover info (type signatures, docs) at a position
get_completionsCompletion suggestions at a position
get_signature_helpFunction signature and active parameter at a call site
get_code_actionsQuick fixes and refactors for a range
get_document_symbolsAll symbols in a file (functions, classes, variables)
get_workspace_symbolsSearch symbols by name across the workspace

Navigation

ToolDescription
get_referencesAll references to a symbol across the workspace
go_to_definitionJump to where a symbol is defined
go_to_type_definitionJump to the type definition of a symbol
go_to_implementationJump to all implementations of an interface or abstract method
go_to_declarationJump to the declaration of a symbol (distinct from definition — e.g. C/C++ headers)

Refactoring

ToolDescription
rename_symbolGet a WorkspaceEdit for renaming a symbol across the workspace
prepare_renameValidate a rename is possible before committing
format_documentGet TextEdit[] formatting edits for a file
format_rangeGet TextEdit[] formatting edits for a selection
apply_editApply a WorkspaceEdit to disk (use with rename_symbol or format_document)
execute_commandExecute a server-side command (e.g. from a code action)

Utilities

ToolDescription
did_change_watched_filesNotify the server when files change on disk outside the editor
set_log_levelChange log verbosity at runtime

Recommended agent workflow:

start_lsp(root_dir="/your/project")
open_document(file_path=..., language_id=...)
get_diagnostics()                          # whole project, no file_path
get_info_on_location(...) / get_references(...)
close_document(...)

Language IDs: typescript, typescriptreact, javascript, javascriptreact, python, go, rust, java, c, cpp, php

Resources

Diagnostic resources support real-time subscriptions — the server sends notifications/resources/updated when diagnostics change.

SchemeDescription
lsp-diagnostics://All open files
lsp-diagnostics:///path/to/fileSpecific file (subscribable)
lsp-hover:///path/to/file?line=N&column=N&language_id=XHover at position
lsp-completions:///path/to/file?line=N&column=N&language_id=XCompletions at position

LSP 3.17 Conformance

lsp-mcp is implemented directly against the LSP 3.17 specification and validated through integration testing against real language servers. Coverage includes:

  • Full lifecycle (initializeinitializedshutdown) with graceful SIGINT/SIGTERM handling
  • Progress protocol — workspace-ready detection waits for all $/progress tokens to complete before sending references
  • Server-initiated requests (workspace/configuration, window/workDoneProgress/create, dynamic registration) — all correctly responded to, unblocking servers that gate workspace loading on these responses
  • Correct JSON-RPC framing, error code handling, and response shape normalization across hover, completion, code actions, and diagnostics

See docs/lsp-conformance.md for the full method coverage matrix and spec section references.

Extensions

Language-specific extensions add tools, prompts, and resource handlers, loaded automatically by language ID at startup.

To add an extension, create src/extensions/<language-id>.ts implementing any subset of getToolHandlers, getToolDefinitions, getResourceHandlers, getSubscriptionHandlers, getPromptDefinitions, and getPromptHandlers. All features are namespaced by language ID.

Development

git clone https://github.com/blackwell-systems/LSP-MCP.git
cd LSP-MCP && npm install && npm run build
npm test                   # all unit test suites
npm run test:multi-lang    # 7-language integration test (requires language servers)

Coverage: ~76% statements, ~86% functions. To inspect MCP traffic: claude --mcp-debug.

License

MIT

Reviews

No reviews yet

Sign in to write a review