
Lsp Mcp
io.github.theUpsider由 GitHub 账号 theUpsider 发布v0.1.6更新于 Oct 27, 2026
Universal LSP MCP server
概览
本地 MCP 服务器,让助手获得语言服务器协议能力:跨 13 种语言的定义跳转、引用查找、符号、诊断、重命名与格式化。
- 可以做什么
- 代码导航:跳转到定义、类型定义和实现,并在指定位置查找所有引用。
- 符号浏览:列出文件内符号,并在整个工作区搜索符号。
- 代码检查:获取单个文件或整个工作区的错误与警告,并查看语言服务器状态。
- 代码修改:重命名符号、列出或应用代码操作、格式化整个文档或指定范围。
- 项目初始化:设置工作区根目录,自动检测语言,也可预先指定要预热的语言。
- 适用场景
- 适合需要助手基于真实代码库、以接近编译器的精度工作而非纯文本搜索的场景:在大型项目中导航、编辑后检查诊断信息,或对 Python、TypeScript、Go、Rust、Java、C/C++ 等受支持语言执行安全重命名与格式化。
- 运行要求
- 以本地 Node.js 进程运行,通过 npm 安装(npx 或全局安装),且必须与源代码位于同一台机器,因为语言服务器需要直接访问文件系统。需要已安装或可自动安装相应的语言服务器(pyright、gopls、rust-analyzer、clangd 等)。可选环境变量 LSP_MCP_LOG_LEVEL 控制日志级别。
安装
在 SourceWeft 中
- 打开 控制台中的 Lsp Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Universal LSP MCP Server
One MCP server to rule all Language Servers — automatic language detection, zero-config setup.
[License: Apache-2.0] [npm version] [Node.js] [Platform]
Overview
A Model Context Protocol (MCP) server that gives language models access to Language Server Protocol (LSP) functionality across all major programming languages. Unlike existing LSP-MCP servers, this project supports 13 languages out of the box with zero manual configuration — it automatically detects your codebase, selects the right language server, and exposes all LSP operations through a stable, language-independent tool interface.
Supported Languages
Features
- 🔍 Automatic Language Detection — Scans project root for language markers (
package.json,Cargo.toml,go.mod, etc.) - 🔄 Auto Language Server Selection — Hardcoded mapping with fallback servers; installs missing LSPs automatically
- 🤖 Hands-Free Initialization — Clients that support MCP Roots auto-initialize on connect —
lsp_initdisappears from the tool list once all servers start cleanly - 💾 Cross-Session Persistence — Initialized workspaces and their ready languages are remembered across server restarts
- 🔁 Graceful Degradation —
lsp_initreappears if a previously-working server starts failing (e.g. language added, binary missing) - 🛠 12 LSP Tools — Definition, references, symbols, diagnostics, rename, code actions, formatting, and more
- 📝 Read & Write Operations — Both inspection and modification of code via LSP
- 🌐 Polyglot Support — Multiple language servers run simultaneously in the same project
- 📋 Hybrid Responses — Human-readable
textfield + raw LSP data inrawfield - 🔌 MCP Stdio Protocol — Works with any MCP-compatible client
- ⚡ Zero Config — Install and run, no per-language setup required
Installation
Important: Install
lsp-mcpon the same machine where your code lives. The language servers it manages need direct filesystem access to your codebase — they cannot work over a remote connection or on a different machine than your source files.
Quickstart
VS Code / Cursor
Add to your workspace .vscode/mcp.json (recommended — ensures the server runs on the same machine as your code, including SSH remotes, WSL, and Dev Containers):
Why workspace config? VS Code runs servers defined in
.vscode/mcp.jsonwherever the workspace lives. Servers defined in your user profile always run locally — which breaks LSP when your code is on a remote machine.
CLI
The server starts with no active project. Most clients auto-initialize when they support the MCP Roots protocol (VS Code, Copilot, etc.), but lsp_init remains available as a manual override.
For clients without Roots support, the first action the model must take is calling lsp_init:
lsp_init will:
- Scan the root for language markers and start matching language servers (best-effort)
- Disappear from the tool list when you called it explicitly — subsequent calls to any LSP tool trigger lazy server startup for that file's language if no server was detected at init time
- Return health status for all servers that were started eagerly
Optional: pre-warm specific languages (skips detection, faster cold start):
Persistence: Once initialized, the workspace configuration (detected languages) is saved to your OS-standard config directory (~/.config/lsp-mcp/ on Linux, ~/Library/Application Support/lsp-mcp/ on macOS, %APPDATA%\lsp-mcp\ on Windows). On subsequent server startups, the MCP server will automatically reconnect using the last-known root, so you rarely need to call lsp_init again.
Re-emergence: If a language server that was previously healthy fails to start (e.g. you added a new language or removed a binary), lsp_init will reappear in the tool list, signaling the model should re-initialize.
Available Tools
Read-Only Tools
Write Tools
Configuration
Setup Scripts
Two helper scripts are included for setting up a development environment:
setup-languages-ubuntu24.sh— Installs all language runtimes, compilers, and toolchains on Ubuntu 24.04 (Python, Node.js, Java, Go, Rust, Ruby, PHP, Kotlin, Swift, etc.)setup-lsp.sh— Installs all language servers (pyright, typescript-language-server, omnisharp, jdtls, gopls, rust-analyzer, clangd, solargraph, intelephense, kotlin-language-server)
Troubleshooting
Language server not found
If a language server cannot be auto-installed, the server logs a structured error and continues running for other languages. Manually install the missing server:
Server not detecting language
Ensure your project root contains a language marker file (e.g., package.json for TypeScript, Cargo.toml for Rust). The server scans the directory passed to lsp_init for these markers.
High memory usage
Each language server runs as a separate process. For large projects with many languages, consider limiting the workspace or using LSP_MCP_LOG_LEVEL=info to monitor server health.
Architecture
License
来源:README.md,提交 c8ad53f
工具
0版本历史
1- v0.1.6最新Sep 16, 2026
评分
已满足适用检查项的 40%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
请在仓库或注册中心条目中声明许可证。