62 semantic C#/.NET analysis tools via Roslyn: navigation, refactoring, code generation.
{
"mcpServers": {
"io-github-pzalutski-pixel-sharplens": {
"command": "<see-readme>",
"args": []
}
}
}No install config available. Check the server's README for setup instructions.
Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
A Model Context Protocol (MCP) server providing 62 AI-optimized tools for .NET/C# semantic code analysis, navigation, refactoring, and code generation using Microsoft Roslyn.
Is it safe?
No package registry to scan.
No authentication — any process on your machine can connect.
License not specified.
Is it maintained?
Last commit 0 days ago. 13 stars.
Will it work with my client?
Transport: stdio. Works with Claude Desktop, Cursor, Claude Code, and most MCP clients.
No automated test available for this server. Check the GitHub README for setup instructions.
No known vulnerabilities.
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
An open-source AI agent that brings the power of Gemini directly into your terminal.
XcodeBuildMCP provides tools for Xcode project management, simulator management, and app utilities.
The full-stack TypeScript framework to build, test, and deploy production-ready MCP servers and AI-native apps.
The leading, most token-efficient MCP server for GitHub source code exploration via tree-sitter AST parsing
MCP Security Weekly
Get CVE alerts and security updates for io.github.pzalutski-pixel/sharplens and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
A 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.
dotnet tool install -g SharpLensMcp
Then run with:
sharplens
npx -y sharplens-mcp
dotnet build -c Release
dotnet publish -c Release -o ./publish
dotnet tool install -g SharpLensMcp
# or
npx -y sharplens-mcp
.mcp.json in 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
Claude Code has native LSP support for basic navigation (go-to-definition, find references). SharpLensMcp adds deep semantic analysis:
| Capability | Native LSP | SharpLensMcp | |------------|------------|--------------| | Go to definition | ✅ | ✅ | | Find references | ✅ | ✅ | | Find async methods missing CancellationToken | ❌ | ✅ | | Impact analysis (what breaks?) | ❌ | ✅ | | Dead code detection | ❌ | ✅ | | Complexity metrics | ❌ | ✅ | | Safe refactoring with preview | ❌ | ✅ | | Batch operations | ❌ | ✅ |
| Environment Variable | Description | Default |
|---------------------|-------------|---------|
| DOTNET_SOLUTION_PATH | Path to .sln or .slnx file to auto-load on startup | None (must call load_solution) |
| SHARPLENS_ABSOLUTE_PATHS | Use absolute paths instead of relative | false (relative paths save tokens) |
| ROSLYN_LOG_LEVEL | Logging verbosity: Trace, Debug, Information, Warning, Error | Information |
| ROSLYN_TIMEOUT_SECONDS | Timeout for long-running operations | 30 |
| ROSLYN_MAX_DIAGNOSTICS | Maximum diagnostics to return | 100 |
| ROSLYN_ENABLE_SEMANTIC_CACHE | Enable semantic model caching | true (set to false to disable) |
If DOTNET_SOLUTION_PATH is not set, you must call the load_solution tool before using other tools.
AI models may have trained bias toward using their native tools (Grep, Read, LSP) instead of MCP server tools, even when SharpLensMcp provides better capabilities.
To ensure optimal tool usage:
Claude Code: Add to your project's CLAUDE.md:
For C# code analysis, prefer SharpLensMcp tools over native tools:
- Use `roslyn:search_symbols` instead of Grep for finding symbols
- Use `roslyn:get_method_source` instead of Read for viewing methods
- Use `roslyn:find_references` for semantic (not text) references
Other MCP clients: Configure tool priority in your agent's system prompt
The semantic analysis from Roslyn is more accurate than text-based search, especially for overloaded methods, partial classes, and inheritance hierarchies.
Important: SharpLensMcp maintains an in-memory representation of your solution for fast queries. When files are modified externally (via Edit/Write tools), the agent is responsible for synchronizing changes.
sync_documents:| Action | Call sync_documents? | |--------|---------------------| | Used E