About CSharpLspMcp
CSharpLspMcp is an MCP server in the Commerce category: mCP (Model Context Protocol) server providing C# and XAML language intelligence for AI assistants like Claude. Exposes IntelliSense, diagnostics, and code analysis through the standardized MCP protocol.
Install
git clone https://github.com/HYMMA/csharp-lsp-mcpThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Tools (17)
csharp_code_actionsGet available code actions
Parameters not published.
csharp_completionsGet IntelliSense completions
Parameters not published.
csharp_definitionGo to definition
Parameters not published.
csharp_diagnosticsGet compiler errors and warnings
Parameters not published.
csharp_hoverGet type info at a position
Parameters not published.
csharp_referencesFind all references
Parameters not published.
csharp_renamePreview symbol rename
Parameters not published.
csharp_set_workspaceSet the solution/project directory (restarts LSP if workspace changes)
Parameters not published.
csharp_stopStop the LSP server to release file locks for rebuilding
Parameters not published.
csharp_symbolsGet document symbols
Parameters not published.
Show all 17 tools
xaml_bindingsExtract data bindings
Parameters not published.
xaml_extract_viewmodelGenerate ViewModel from bindings
Parameters not published.
xaml_find_binding_errorsFind binding errors
Parameters not published.
xaml_namesList x:Name declarations
Parameters not published.
xaml_resourcesList resource references
Parameters not published.
xaml_structureShow element tree
Parameters not published.
xaml_validateValidate XAML for errors
Parameters not published.
Ask AI
Ask AI about CSharpLspMcp
Powered by Claude · Grounded in docs
Security checks
- ✓README presentThe repository ships documentation.
5 checks have not been run yet.
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
Add to your Claude Desktop configuration:
{
"mcpServers": {
"csharp": {
"command": "csharp-lsp-mcp",
"args": []
}
}
}
Usage
Once configured, the MCP server provides the following tools to your AI assistant:
Setting Up the Workspace
Before using C# tools, set the workspace directory:
Use csharp_set_workspace with path: "C:/path/to/your/solution"
Stopping the LSP for Rebuilds
The LSP server holds file locks on project DLLs. To rebuild your project, stop the server first:
Stop the C# LSP server so I can rebuild
After rebuilding, call csharp_set_workspace again to restart it. Switching workspaces via csharp_set_workspace automatically restarts the server.
Example Interactions
Get diagnostics for a file:
Check for errors in Program.cs
Get type information:
What type is the variable at line 15, column 10 in MyClass.cs?
Find all references:
Find all usages of the GetCustomer method
Analyze XAML bindings:
Show me all data bindings in MainWindow.xaml
Available Tools
| Tool | Description |
|---|---|
csharp_set_workspace |
Set the solution/project directory (restarts LSP if workspace changes) |
csharp_stop |
Stop the LSP server to release file locks for rebuilding |
csharp_diagnostics |
Get compiler errors and warnings |
csharp_hover |
Get type info at a position |
csharp_completions |
Get IntelliSense completions |
csharp_definition |
Go to definition |
csharp_references |
Find all references |
csharp_symbols |
Get document symbols |
csharp_code_actions |
Get available code actions |
csharp_rename |
Preview symbol rename |
xaml_validate |
Validate XAML for errors |
xaml_bindings |
Extract data bindings |
xaml_resources |
List resource references |
xaml_names |
List x:Name declarations |
xaml_structure |
Show element tree |
xaml_find_binding_errors |
Find binding errors |
xaml_extract_viewmodel |
Generate ViewModel from bindings |
Command Line Options
csharp-lsp-mcp [OPTIONS]
OPTIONS:
-h, --help Show help message
-v, --version Show version information
-V, --verbose Enable verbose logging (to stderr)
ENVIRONMENT VARIABLES:
MCP_DEBUG=1 Enable trace-level logging
Architecture
┌─────────────────┐ MCP Protocol ┌──────────────────┐
│ Claude / LLM │◄────────────────────►│ csharp-lsp-mcp │
└─────────────────┘ └────────┬─────────┘
│
┌──────────────┴──────────────┐
│ │
┌─────▼─────┐ ┌───────▼───────┐
│ csharp-ls │ │ XAML Parser │
│ (LSP) │ │ (built-in) │
└─────┬─────┘ └───────────────┘
│
┌─────▼─────┐
│ Roslyn │
│ Compiler │
└───────────┘
Building from Source
# Clone the repository
git clone https://github.com/HYMMA/csharp-lsp-mcp.git
cd csharp-lsp-mcp
# Build
cd csharp-lsp-mcp/src/CSharpLspMcp
dotnet build -c Release
# Run tests (if available)
dotnet test
# Create a release build
dotnet publish -c Release -o ./publish
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Changelog
See CHANGELOG.md for a history of changes.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Model Context Protocol - The protocol specification
- csharp-ls - The C# Language Server
- Microsoft MCP C# SDK - The official C# SDK for MCP
Related Projects
- Claude Code - Anthropic's CLI for Claude
- MCP Servers - Official MCP server implementations
README copy captured when this server was indexed; it may lag the repository. The original is authoritative.