
一个模型上下文协议(MCP)服务器,提供代码编辑的语言支持。
概览
一个模型上下文协议(MCP)服务器,提供代码编辑的语言支持。 这是一个基于TypeScript的MCP服务器,旨在通过提供悬停信息、代码补全和诊断等功能,提升代码编辑体验。它通过提供以下内容演示MCP的核心概念: - 针对代码分析和操作的专用语言工具- 与模型上下文协议集成,实现无缝通信 - 提供代码中符号的悬停信息 - 提供代码完成建议 - 报告诊断信息(错误、警告)- 仅用 TypeScript 测试,理论上应支持 Python。如果可能的话,希望增加更多语言服务器或更中立。
概述(AI 翻译)
一个模型上下文协议(MCP)服务器,提供代码编辑的语言支持。
这是一个基于TypeScript的MCP服务器,旨在通过提供悬停信息、代码补全和诊断等功能,提升代码编辑体验。它通过提供以下内容演示MCP的核心概念:
- 针对代码分析和操作的专用语言工具
- 与模型上下文协议集成,实现无缝通信
特色
语言支持
- 为代码中的符号提供悬停信息
- 提供代码补全建议
- 报告诊断信息(错误、警告)
- 仅用 TypeScript 测试,理论上应该支持 Python。如果可能的话,我很想增加额外的语言服务器,或者更中立一些。
MCP集成
- 实现与客户端通信的MCP协议
- 以MCP工具形式展示语言特性
工具
get_hover:获取文档中位置的悬停信息- 将 languageId、filePath、内容、行和字符作为必要参数
get_completions:获取文档中职位的完成建议- 将 languageId、filePath、内容、行和字符作为必要参数
本页由 AI 翻译,技术细节请以原文为准。
README
language-server-mcp MCP Server
A Model Context Protocol (MCP) server providing language support for code editing.
This is a TypeScript-based MCP server designed to enhance code editing experiences by providing features such as hover information, code completion, and diagnostics. It demonstrates core MCP concepts by providing:
- Language-specific tools for code analysis and manipulation
- Integration with the Model Context Protocol for seamless communication
Features
Language Support
- Provides hover information for symbols in code
- Offers code completion suggestions
- Reports diagnostic information (errors, warnings)
- Only tested with typescript, theoretically should support Python. Would love to add additional language servers or be more agnostic if possible.
MCP Integration
- Implements the MCP protocol for communication with clients
- Exposes language features as MCP tools
Tools
get_hover: Get hover information for a position in a document- Takes languageId, filePath, content, line, and character as required parameters
get_completions: Get completion suggestions for a position in a document- Takes languageId, filePath, content, line, and character as required parameters
get_diagnostics: Get diagnostic information for a document- Takes languageId, filePath, and content as required parameters
Development
Install dependencies:
npm install
Build the server:
npm run build
For development with auto-rebuild:
npm run watch
Installation
To use with Claude Desktop, add the server config:
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"language-server-mcp": {
"command": "/path/to/language-server-mcp/build/index.js"
}
}
}
Debugging
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:
npm run inspector
The Inspector will provide a URL to access debugging tools in your browser.
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"language-server-mcp": {
"command": "/path/to/language-server-mcp/build/index.js"
}
}
}