SharpLensMcp
A Model Context Protocol (MCP) server providing 67 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.
Installation
Via NuGet (Recommended)
dotnet tool install -g SharpLensMcpThen run with:
sharplensVia npm
npx -y sharplens-mcpBuild from Source
dotnet build -c Release
dotnet publish -c Release -o ./publishClaude Code Setup
- Install the tool (pick one):
dotnet tool install -g SharpLensMcp
# or
npx -y sharplens-mcp- Create
.mcp.jsonin your project root:
{
"mcpServers": {
"sharplens": {
"type": "stdio",
"command": "npx",
"args": ["-y", "sharplens-mcp"],
"env": {
"DOTNET_SOLUTION_PATH": "/path/to/your/Solution.sln (or .slnx)"
}
}
}
}Restart Claude Code to load the MCP server
Verify by asking Claude to run a health check on the Roslyn server





