
MCP 服务器为 Claude 等 AI 助手提供 C# 和 XAML 语言智能
概览
一款MCP(模型上下文协议)服务器,为像Claude这样的AI助手提供C#和XAML语言智能。它通过标准化MCP协议提供IntelliSense、诊断和代码分析,弥合了LLM与.NET开发之间的鸿沟。 - - 实时获取编译器错误和警告 - - 查看类型信息和文档 - 获取上下文感知代码建议 - - 导航到符号定义 - - 查找符号的所有用法 - - 列出文件中的所有符号 - - 访问快速修复和重构 - - 在工作区中预览符号重命名 - - 在重建前暂停 LSP 服务器释放文件锁 - - 检查XAML的错误和问题 - - 提取和分析数据绑定 - - 列出并验证资源引用 - - 查找所有x:Name声明 - - 查看元素树层级结构 - - 识别绑定问题 - - 从绑定生成ViewModels。 添加到你的Claude桌面配置中: 配置完成后,MCP服务器提供......
概述(AI 翻译)
一款MCP(模型上下文协议)服务器,为像Claude这样的AI助手提供C#和XAML语言智能。它通过标准化MCP协议提供IntelliSense、诊断和代码分析,弥合了LLM与.NET开发之间的鸿沟。
特色
C# 语言智能(通过 csharp-ls)
- 诊断 - 实时获取编译器错误和警告
- 悬停信息 - 查看类型信息和文档
- IntelliSense 补全 - 获取上下文感知代码建议
- 前往定义 - 导航到符号定义
- 查找引用 - 查找符号的所有用法
- 文档符号 - 列出文件中的所有符号
- 代码操作 - 访问快速修复和重构
- 重命名预览 - 在工作区内重命名预览符号
- 停止/重启 - 在重建前停止LSP服务器释放文件锁
XAML 分析(内置)
- 验证 - 检查XAML是否有错误和问题
- 绑定分析 - 提取和分析数据绑定
- 资源检查 - 列出并验证资源引用
- 名称发现 - 查找所有 x:Name 声明
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
csharp-lsp-mcp
An MCP (Model Context Protocol) server that provides C# and XAML language intelligence for AI assistants like Claude. It bridges the gap between LLMs and .NET development by exposing IntelliSense, diagnostics, and code analysis through the standardized MCP protocol.
Features
C# Language Intelligence (via csharp-ls)
- Diagnostics - Get compiler errors and warnings in real-time
- Hover Information - View type information and documentation
- IntelliSense Completions - Get context-aware code suggestions
- Go to Definition - Navigate to symbol definitions
- Find References - Locate all usages of a symbol
- Document Symbols - List all symbols in a file
- Code Actions - Access quick fixes and refactorings
- Rename Preview - Preview symbol renames across the workspace
- Stop/Restart - Stop the LSP server to release file locks before rebuilding
XAML Analysis (built-in)
- Validation - Check XAML for errors and issues
- Binding Analysis - Extract and analyze data bindings
- Resource Inspection - List and verify resource references
- Name Discovery - Find all x:Name declarations
- Structure Visualization - View element tree hierarchy
- Binding Error Detection - Identify binding problems
- ViewModel Generation - Generate ViewModels from bindings
Prerequisites
- .NET 8.0 SDK or later
- csharp-ls - The C# Language Server
Install csharp-ls globally:
dotnet tool install --global csharp-ls
Installation
From Source
git clone https://github.com/HYMMA/csharp-lsp-mcp.git
cd csharp-lsp-mcp/csharp-lsp-mcp/src/CSharpLspMcp
dotnet build -c Release
From NuGet (coming soon)
dotnet tool install --global CSharpLspMcp
Configuration
Claude Code
Add to your ~/.claude.json:
{
"mcpServers": {
"csharp": {
"command": "path/to/csharp-lsp-mcp.exe"
}
}
}
Or if installed as a global tool:
{
"mcpServers": {
"csharp": {
"command": "csharp-lsp-mcp"
}
}
}
Claude Desktop
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"csharp": {
"command": "path/to/csharp-lsp-mcp.exe"
}
}
}