MCP Catalogs
首页

mcp-language-server

by isaacphi·1,527·综合分 55

MCP 语言服务器将 LSP 工具连接到 MCP 客户端,实现代码导航、定义、引用和诊断功能。

developer-toolsai-llmproductivity
128
Forks
56
活跃 Issue
3 个月前
最近提交
2 天前
收录于

概述

mcp-language-server 是一个 MCP 服务器,通过模型上下文协议 (MCP) 将语言服务器协议 (LSP) 功能暴露给 LLM 客户端。它使 AI 模型能够访问语义代码分析工具,包括符号定义、引用、诊断、悬停信息和重命名功能,支持 Go、Rust、Python、TypeScript 和 C++ 等多种编程语言。该实现通过 stdio 处理 LSP 通信,并将环境变量和参数传递给语言服务器。

试试问 AI

装完之后,这里有 5 个你可以让 AI 做的事:

:AI 助手对不熟悉代码的代码库导航
:大型项目中的自动代码重构和重命名
:智能代码分析和问题检测
:支持哪些语言服务器?
:如何调试问题?

什么时候选它

当您需要将LLM客户端连接到现有的语言服务器,以便在多种编程语言中进行代码分析和导航时,请选择此服务器。

什么时候不要选它

如果您需要超出基本语言服务器功能的高级IDE功能,或者使用的是不通过stdio通信的语言服务器,请避免使用此服务器。

此 server 暴露的工具

从 README 抽取出 6 个工具
  • definition

    Retrieves the complete source code definition of any symbol from your codebase.

  • references

    Locates all usages and references of a symbol throughout the codebase.

  • diagnostics

    Provides diagnostic information for a specific file, including warnings and errors.

  • hover

    Display documentation, type hints, or other hover information for a given location.

  • rename_symbol

    Rename a symbol across a project.

  • edit_file

    Allows making multiple text edits to a file based on line numbers.

可对比工具

mcp-server-templatemcp-toolsvscode-mcp

安装

安装

  1. 安装 Go: 请访问 https://golang.org/doc/install 获取说明
  2. 安装服务器: go install github.com/isaacphi/mcp-language-server@latest
  3. 安装您选择的语言服务器 (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 讨论

开发者社区最近的相关讨论。

mcp-language-server 对比

GitHub →

最后更新于 · 由 README + GitHub 公开数据自动生成。