LSP-MCP
Bridges a Roslyn C# language server to AI agents via the GitHub Copilot CLI, enabling code intelligence tools such as diagnostics, call hierarchy, and type hierarchy queries.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LSP-MCP find callers of the Main method in Program.cs"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LSP-MCP
Minimal MCP server that bridges any Language Server Protocol (LSP) server to AI agents (e.g. GitHub Copilot CLI). Exposes diagnostics (errors, warnings, info) as lightweight tool calls.
Tools
Tools are generated per server entry, prefixed by the config key:
Tool pattern | Description |
| Compilation errors for a file (or all open files) |
| Warnings for a file |
| Info/hint diagnostics (style rules, analyzers) |
| All LSP servers' state for debugging |
Example with "cs" prefix: cs_get_errors, cs_get_warnings, cs_get_info
Related MCP server: sharplens-mcp
Setup
pip install -e .Configuration
Create .github/lsp.json in your workspace root. Each key is the tool prefix — keep it short:
{
"lspServers": {
"cs": {
"command": "path/to/Microsoft.CodeAnalysis.LanguageServer.exe",
"args": ["--stdio", "--autoLoadProjects"],
"fileExtensions": {".cs": "csharp"}
}
}
}Multiple servers generate prefixed tools automatically:
{
"lspServers": {
"cs": { "command": "...", "args": [...], "fileExtensions": {".cs": "csharp"} },
"py": { "command": "pyright-langserver", "args": ["--stdio"], "fileExtensions": {".py": "python"} }
}
}This exposes: cs_get_errors, cs_get_warnings, py_get_errors, py_get_warnings, etc.
The fileExtensions map tells the server which languageId to send in textDocument/didOpen. Common extensions (.py, .ts, .go, .rs, etc.) are detected automatically if omitted.
Usage with Copilot CLI
Add to ~/.copilot/mcp-config.json:
{
"mcpServers": {
"lsp": {
"type": "stdio",
"command": "python",
"args": ["-m", "lsp_mcp", "--workspace", "/path/to/your/project"]
}
}
}CLI Options
lsp-mcp [--workspace PATH]--workspace,-w: Workspace root containing.github/lsp.json(defaults to cwd)
How It Works
Reads
.github/lsp.jsonto find the LSP server commandSpawns the language server with
--stdioand performs the LSP initialize handshakeOn tool call: opens the file, pulls diagnostics via
textDocument/diagnostic, filters by severityFalls back to push diagnostics (
publishDiagnostics) if pull returns emptyReturns concise JSON with line, column, severity, message, and diagnostic code
Available Tools
1 toollsp_statusA
Get LSP server status: initialization state, open documents, diagnostics cache.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
With only one tool, there is no possibility of confusion between tools. The tool's purpose is clear and singular.
The single tool name 'lsp_status' follows a consistent verb_noun pattern, which is clear and predictable.
The server's name suggests broader LSP interaction capabilities, but it exposes only a single tool for status. This is too few tools for the implied scope, limiting its usefulness.
The server only provides a status check, lacking essential LSP operations like initialization, document management, or diagnostics retrieval. The tool surface is severely incomplete for any real LSP interaction.
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Lean 4 MCP server: compile, prove theorems, and formalize math with Mathlib.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server to expose VS Code editing features to an LLM for AI coding9561 npm392MIT
- AlicenseAqualityBmaintenanceA Model Context Protocol (MCP) server providing 62 AI-optimized tools for .NET/C# semantic code analysis, navigation, refactoring, and code generation using Microsoft Roslyn. Built for AI coding agents - provides compiler-accurate code understanding that AI cannot infer from reading source files alone.6242MIT
- AlicenseNot gradedqualityBmaintenanceLocal-first MCP server for semantic C# analysis, navigation, validation, and refactoring using Roslyn on real .NET workspaces.1MIT
- AlicenseNot gradedqualityBmaintenanceProvides Roslyn-based code intelligence for AI coding agents via MCP, enabling efficient navigation and surgical edits of C# solutions.7MIT