mcp-language-server
by isaacphi·★ 1,527·综合分 55
MCP 语言服务器将 LSP 工具连接到 MCP 客户端,实现代码导航、定义、引用和诊断功能。
概述
mcp-language-server 是一个 MCP 服务器,通过模型上下文协议 (MCP) 将语言服务器协议 (LSP) 功能暴露给 LLM 客户端。它使 AI 模型能够访问语义代码分析工具,包括符号定义、引用、诊断、悬停信息和重命名功能,支持 Go、Rust、Python、TypeScript 和 C++ 等多种编程语言。该实现通过 stdio 处理 LSP 通信,并将环境变量和参数传递给语言服务器。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当您需要将LLM客户端连接到现有的语言服务器,以便在多种编程语言中进行代码分析和导航时,请选择此服务器。
什么时候不要选它
如果您需要超出基本语言服务器功能的高级IDE功能,或者使用的是不通过stdio通信的语言服务器,请避免使用此服务器。
此 server 暴露的工具
从 README 抽取出 6 个工具definitionRetrieves the complete source code definition of any symbol from your codebase.
referencesLocates all usages and references of a symbol throughout the codebase.
diagnosticsProvides diagnostic information for a specific file, including warnings and errors.
hoverDisplay documentation, type hints, or other hover information for a given location.
rename_symbolRename a symbol across a project.
edit_fileAllows making multiple text edits to a file based on line numbers.
可对比工具
安装
安装
- 安装 Go: 请访问 https://golang.org/doc/install 获取说明
- 安装服务器:
go install github.com/isaacphi/mcp-language-server@latest - 安装您选择的语言服务器 (gopls, rust-analyzer, pyright 等)
配置
添加到 Claude Desktop 配置 (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"language-server": {
"command": "mcp-language-server",
"args": ["--workspace", "/your/project/path", "--lsp", "gopls"]
}
}
}FAQ
- 支持哪些语言服务器?
- 该服务器已测试 gopls (Go)、rust-analyzer (Rust)、pyright (Python)、typescript-language-server (TypeScript) 和 clangd (C/C++)。它应该适用于任何通过 stdio 通信的 LSP 服务器。
- 如何调试问题?
- 将 LOG_LEVEL 环境变量设置为 DEBUG,以启用所有组件的详细日志记录,包括与语言服务器的消息。
Hacker News 讨论
开发者社区最近的相关讨论。
- 帖子 by isaacphi · 2025-05-16
- 帖子 by wseqyrku · 2025-03-25
mcp-language-server 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。