Roslyn MCP Server
A C# MCP server using Microsoft's Roslyn compiler for code analysis and navigation in C# codebases.
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
Prerequisites
- .NET 8.0 SDK or later
- Visual Studio 2022 or VS Code (recommended for development)
- Claude Desktop application
Installation
-
Clone or download the project
git clone https://github.com/carquiza/RoslynMCP.git cd RoslynMCP/RoslynMcpServer -
Restore NuGet packages
dotnet restore -
Build the project
dotnet build -
Test the server (optional)
dotnet run
Quick Setup
Windows
Run the PowerShell setup script:
.\setup.ps1
Linux/macOS
Run the installation test:
./test-installation.sh
Claude Desktop Configuration
To connect this MCP server to Claude Desktop, you need to modify the Claude Desktop configuration file:
Configuration File Location
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Configuration Content
Add the following to your claude_desktop_config.json file:
{
"mcpServers": {
"roslyn-code-navigator": {
"command": "dotnet",
"args": [
"run",
"--project",
"/path/to/RoslynMCP/RoslynMcpServer"
],
"env": {
"DOTNET_ENVIRONMENT": "Production",
"LOG_LEVEL": "Information"
}
}
}
}
Important: Replace /path/to/RoslynMCP/RoslynMcpServer with the actual absolute path to your project directory.
Usage
Once configured, restart Claude Desktop. You should see the Roslyn MCP Server appear in the available tools. Here are some example queries:
Search for Symbols
Search for all classes ending with 'Service' in my solution at C:\MyProject\MyProject.sln
Find References
Find all references to the UserRepository class in C:\MyProject\MyProject.sln
Get Symbol Information
Get information about the CalculateTotal method in C:\MyProject\MyProject.sln
Analyze Dependencies
Analyze dependencies for the solution at C:\MyProject\MyProject.sln
Code Complexity Analysis
Find methods with complexity higher than 7 in C:\MyProject\MyProject.sln
Available Tools
- SearchSymbols - Search for symbols using wildcard patterns
- FindReferences - Find all references to a specific symbol
- GetSymbolInfo - Get detailed information about a symbol
- AnalyzeDependencies - Analyze project dependencies and usage patterns
- 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
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Christopher Arquiza
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Verwandte Server
Scout Monitoring MCP
SponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
SponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Blockchain Vulnerability Analyzer
Analyzes blockchain smart contracts for vulnerabilities using Mythril and Slither.
CLI MCP Server
A secure MCP server for executing controlled command-line operations with comprehensive security features.
depwire
Code dependency graph and AI context engine. 10 MCP tools that give Claude, Cursor, and any MCP client full codebase context — impact analysis, dependency tracing, architecture summaries, and interactive arc diagram visualization. Supports TypeScript, JavaScript, Python, and Go.
Drupal Tools
A server providing resources, tools, and prompts for Drupal development.
pip Package README MCP Server
Fetch READMEs, metadata, and search for Python packages on PyPI.
npm Package README
Fetch READMEs, metadata, and search for packages on the npm registry.
Console Automation
Production-ready MCP server for AI-driven console automation and monitoring. 40+ tools for session management, SSH, testing, and background jobs.
MCP JS Debugger
Debug JavaScript and TypeScript applications through the Chrome DevTools Protocol with full source map support.
MCP Startup Framework
A framework for building MCP servers on Cloudflare Workers with OAuth, PostgreSQL, and Stripe.
Cursor Chat History MCP
Provides local access to Cursor chat history for AI analysis and insights, with no external services or API keys required.