Labsco
carquiza logo

Roslyn MCP Server

โ˜… 55

from carquiza

A C# MCP server using Microsoft's Roslyn compiler for code analysis and navigation in C# codebases.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

Roslyn MCP Server

A C# MCP (Model Context Protocol) server that integrates with Microsoft's Roslyn compiler platform to provide Claude Desktop with code analysis and navigation capabilities for C# codebases.

Features

  • Wildcard Symbol Search - Find classes, methods, and properties using pattern matching (*Service, Get*User, etc.)
  • Reference Tracking - Locate all usages of symbols across entire solutions
  • Symbol Information - Get detailed information about types, methods, properties, and more
  • Dependency Analysis - Analyze project dependencies and namespace usage patterns
  • Code Complexity Analysis - Identify high-complexity methods using cyclomatic complexity metrics
  • Performance Optimized - Multi-level caching and incremental analysis for large codebases
  • Security - Input validation and path sanitization

Available Tools

  1. SearchSymbols - Search for symbols using wildcard patterns
  2. FindReferences - Find all references to a specific symbol
  3. GetSymbolInfo - Get detailed information about a symbol
  4. AnalyzeDependencies - Analyze project dependencies and usage patterns
  5. AnalyzeCodeComplexity - Identify high-complexity methods

Development and Testing

Using MCP Inspector

For development and testing, you can use the MCP Inspector:

# Install the inspector
npm install -g @modelcontextprotocol/inspector

# Test your server
npx @modelcontextprotocol/inspector dotnet run --project ./RoslynMcpServer

Architecture

The server features a modular architecture with:

  • MCP Server Layer: Handles communication with Claude Desktop
  • Roslyn Integration Layer: Manages workspaces and compilations
  • Search Engine Layer: Implements symbol search and analysis
  • Multi-level Caching: Performance optimization for large codebases
  • Security Layer: Input validation and sanitization

Author

Christopher Arquiza