VOOZH about

URL: https://glama.ai/mcp/servers/isaacphi/mcp-language-server?locale=zh-CN

⇱ MCP 语言服务器 by isaacphi | Glama


MCP 语言服务器

👁 Go 测试
👁 围棋成绩单
👁 GoDoc
👁 Go 版本

这是一个运行语言服务器并向 LLM 开放的MCP服务器。它不是 MCP 的语言服务器,无论 MCP 是什么。

演示

mcp-language-server通过为启用 MCP 的客户端提供访问语义工具(如获取定义、引用、重命名和诊断)来帮助它们更轻松地导航代码库。

👁 演示

Related MCP server: lsp-mcp-server

设置

  1. 安装 Go :按照https://golang.org/doc/install上的说明进行操作

  2. 安装或更新此服务器go install github.com/isaacphi/mcp-language-server@latest

  3. 安装语言服务器按照以下指南之一进行操作

  4. 配置您的 MCP 客户端请按照以下指南之一进行操作

<p><strong>Note</strong>:</p>
<ul>
 <li>Replace <code>/path/to/your/clangd_binary</code> with the actual path to your clangd executable.</li>
 <li><code>--compile-commands-dir</code> should point to the directory containing your <code>compile_commands.json</code> file (e.g., <code>./build</code>, <code>./cmake-build-debug</code>).</li>
 <li>Ensure <code>compile_commands.json</code> is generated for your project for clangd to work effectively.</li>
</ul>

工具

  • definition :从代码库中检索任何符号(函数、类型、常量等)的完整源代码定义。

  • references :在整个代码库中定位符号的所有用法和引用。

  • diagnostics :提供特定文件的诊断信息,包括警告和错误。

  • hover :显示给定位置的文档、类型提示或其他悬停信息。

  • rename_symbol :在项目中重命名符号。

  • edit_file :允许根据行号对文件进行多项文本编辑。与基于搜索和替换的编辑工具相比,它提供了一种更可靠、更经济的文件编辑方式。

关于

此代码库使用gopls编辑的代码来处理 LSP 通信。详情请参阅 ATTRIBUTION。此处所有内容均受 BSD 风格许可证的保护。

mcp-go用于 MCP 通信。感谢您的服务。

这是测试版软件。如果您遇到任何问题或有任何建议,请通过创建问题来告知我。

贡献

请保持 PR 规模较小,并优先开放 Issues 以应对任何实质性问题。AI 漏洞只要经过测试、检查,且问题不大,就没问题。

设置

克隆仓库:

git clone https://github.com/isaacphi/mcp-language-server.git
cd mcp-language-server

为了方便起见,包含了一个justfile

just -l
Available recipes:
 build # Build
 check # Run code audit checks
 fmt # Format code
 generate # Generate LSP types and methods
 help # Help
 install # Install locally
 snapshot # Update snapshot tests
 test # Run tests

配置您的 Claude Desktop(或类似桌面)以使用本地二进制文件:

{
 "mcpServers": {
 "language-server": {
 "command": "/full/path/to/your/clone/mcp-language-server/mcp-language-server",
 "args": [
 "--workspace",
 "/path/to/workspace",
 "--lsp",
 "language-server-executable"
 ],
 "env": {
 "LOG_LEVEL": "DEBUG"
 }
 }
 }
}

进行更改后重建。

日志记录

LOG_LEVEL环境变量设置为 DEBUG 可将所有组件的详细日志记录到 stderr,包括往返于语言服务器的消息以及语言服务器的日志。

LSP 交互

  • internal/lsp/methods.go包含用于调用所连接的语言服务器的生成代码。

  • internal/protocol/tsprotocol.go包含 LSP 类型的生成代码。我从gopls的源代码中借鉴了这些代码。感谢您的服务。

  • LSP 允许语言服务器为相同的方法返回不同的类型。Go 语言不支持这种做法,因此在internal/protocol/interfaces.go中引入了一些不太好用的变通方法。

本地开发和快照测试

有一个快照测试套件,可以更轻松地测试工具的更改。它们在模拟工作区上运行真实的语言服务器,并捕获输出和日志。

您需要在本地安装语言服务器才能运行它们。这里有针对 Go、Rust、Python 和 TypeScript 的测试。

integrationtests/
├── tests/ # Tests are in this folder
├── snapshots/ # Snapshots of tool outputs
├── test-output/ # Gitignored folder showing the final state of each workspace and logs after each test run
└── workspaces/ # Mock workspaces that the tools run on

要更新快照,请运行UPDATE_SNAPSHOTS=true go test ./integrationtests/...

F
license - not found
-
quality - not tested
F
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity
Issues opened vs closed

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/isaacphi/mcp-language-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server