RoslynCSMCP
A Model Context Protocol (MCP) server that provides C# code analysis capabilities using Microsoft Roslyn by Claude code
Ask AI about RoslynCSMCP
Powered by Claude Β· Grounded in docs
I know everything about RoslynCSMCP. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Roslyn CSharp MCP Server
A C# MCP (Model Context Protocol) server that integrates with Microsoft's Roslyn compiler platform to provide Vibe-coding tools like Claude Desktop and Claude CLI with powerful code analysis and navigation capabilities for C# codebases.
Notice: most codes after forked from original repository was completed by Claude code.
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 (Memory, Redis, File system) and incremental analysis for large codebases
- Security Hardened - Input validation, path sanitization, and safe file operations
- Modular Architecture - Load only the tools you need to minimize token overhead (350-2,275 tokens per module vs 7,350 for full)
- ...and more!
What is RoslynCSMCP?
RoslynCSMCP is a specialized application built on top of Microsoft's MCP SDK, not a replacement for it.
Relationship with Microsoft MCP C# SDK
| Component | Role | What It Provides |
|---|---|---|
| Microsoft MCP C# SDK | π§ Infrastructure | MCP protocol implementation, transport layer, serialization |
| RoslynCSMCP (This Project) | Application | Ready-to-use C# code analysis tools powered by Roslyn |
Analogy:
- Microsoft MCP SDK = Kitchen equipment (stove, refrigerator, knives)
- RoslynCSMCP = A restaurant with complete menu (using that equipment to serve specific dishes)
RoslynCSMCP major tools and benefits:
- Roslyn Integration: Deep integration with Microsoft's Roslyn compiler platform for semantic code analysis
- Specialized Tools: From symbol search to test discovery, compilation errors to class hierarchies
- Token Optimization: Intelligent filtering and output formatting reduces token usage by 60-98%
- Production Ready: Security validation, multi-level caching, incremental analysis
- Claude Native: Designed specifically for Claude Desktop and Claude CLI workflows
Bottom Line: Microsoft provides the foundation (SDK), RoslynCSMCP provides the complete, ready-to-use C# code analysis solution.
π§© Modular Architecture (NEW)
RoslynCSMCP now supports modular MCP servers for optimized token usage. Instead of loading all 51 tools (~8,925 tokens), you can load only the modules you need.
Available Modules
| Module | Tools | Tokens | Description |
|---|---|---|---|
| Full | 51 | ~8,925 | Complete toolset (backward compatible) |
| Navigation | 6 | ~1,050 | Symbol search, references, file outline |
| Quality | 8 | ~1,400 | Code smells, complexity, concurrency, magic numbers |
| Security | 3 | ~525 | Security issues, thread safety, exception handling |
| Dependencies | 5 | ~875 | Dependency analysis, packages, DI container |
| Refactoring | 5 | ~875 | Rename, extract interface, source generator opportunities |
| Testing | 2 | ~350 | Test discovery, coverage analysis |
| Metrics | 4 | ~700 | Code metrics, file statistics, memory allocation |
| Advanced | 15 | ~2,625 | Batch queries, cross-solution, IPC/integrity patterns |
| Interop | 3 | ~525 | AOT compatibility, P/Invoke migration, unsafe code |
Quick Start - Modular Configuration
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"roslyn-nav": {
"command": "dotnet",
"args": ["run", "--project", "D:/RoslynCSMCP/src/RoslynMcpServer.Navigation"]
},
"roslyn-quality": {
"command": "dotnet",
"args": ["run", "--project", "D:/RoslynCSMCP/src/RoslynMcpServer.Quality"]
}
}
}
Claude CLI:
# Add Navigation module
claude mcp add roslyn-nav --scope user -- dotnet run --project /path/to/RoslynCSMCP/src/RoslynMcpServer.Navigation
# Add Quality module
claude mcp add roslyn-quality --scope user -- dotnet run --project /path/to/RoslynCSMCP/src/RoslynMcpServer.Quality
Module Selection Guide
| Use Case | Recommended Modules | Token Savings |
|---|---|---|
| Code navigation only | Navigation | 86% |
| Code review | Navigation + Quality | 71% |
| Security audit | Security | 93% |
| Full analysis | Full (or all modules) | 0% |
π‘ Tip: Start with Navigation module. Add more modules as needed.
Prerequisites
Common Requirements
- .NET 10.0 SDK or later - Download
- Visual Studio 2026 or VS Code (recommended for development)
- Git (for cloning the repository)
Platform-Specific Requirements
For Claude Desktop:
- Claude Desktop application installed
For Claude CLI:
- Claude CLI (Claude Code) installed
- Native Install via: (for example)
curl -fsSL https://claude.ai/install.sh | bash(macOS, Linux, WSL) or PSirm https://claude.ai/install.ps1 | iex(Windows).- Please refer to the Claude CLI Installation Guide for detailed / updated instructions.
- Verify:
claude --version(should show version 2.1.2 or later)
- Native Install via: (for example)
Installation
1. Clone the Repository
git clone https://github.com/bbfox0703/RoslynCSMCP.git
cd RoslynCSMCP
2. Build the Project
# Restore NuGet packages
dotnet restore
# Build the project
dotnet build -c Release
3. Verify Installation (Optional but Recommended)
# Windows
.\test-installation.bat
# Linux/macOS
./test-installation.sh
This script will:
- β Check .NET version (must be 10.0+)
- β Verify all required files exist
- β Build the project
- β Test server startup
- β Check test project (if present)
For manual testing:
# Run the server (should show MCP protocol initialization)
cd RoslynMcpServer
dotnet run
Press Ctrl+C to stop the server after verifying it starts successfully.
π₯οΈ Claude Desktop Setup
Click to expand Claude Desktop setup instructions
Automated Setup (Recommended)
Windows
.\install\setup-claude-desktop.ps1
Linux/macOS
chmod +x install/setup-claude-desktop.sh
./install/setup-claude-desktop.sh
The automated scripts will:
- Check .NET installation
- Build the project
- Configure Claude Desktop automatically
- Test server startup
Manual Setup
1. Locate Claude Desktop Config File
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
2. Edit Configuration
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"roslyn-code-navigator": {
"command": "dotnet",
"args": [
"run",
"--project",
"C:\\absolute\\path\\to\\RoslynCSMCP\\RoslynMcpServer"
],
"env": {
"DOTNET_ENVIRONMENT": "Production",
"LOG_LEVEL": "Information"
}
}
}
}
Important: Replace C:\\absolute\\path\\to\\RoslynCSMCP\\RoslynMcpServer with your actual absolute path.
- Windows example:
C:\\Users\\YourName\\Projects\\RoslynCSMCP\\RoslynMcpServer - macOS/Linux example:
/Users/YourName/Projects/RoslynCSMCP/RoslynMcpServer
See claude-desktop-config.example.json for a complete example.
3. Restart Claude Desktop
Close and restart the Claude Desktop application to load the new configuration.
Verification
Once restarted, you should see a small hammer icon (π¨) or MCP indicator in Claude Desktop. You can now use natural language to analyze C# code:
Search for all classes ending with 'Service' in C:\MyProject\MyProject.sln
Find all references to UserRepository in C:\MyProject\MyProject.sln
Analyze code complexity in C:\MyProject\MyProject.sln
π» Claude CLI Setup
Click to expand Claude CLI setup instructions
Prerequisites Check
Before configuring, ensure Claude CLI is installed:
# Check Claude CLI installation
claude --version
# Should output: claude version 2.1.2 (or later)
If not installed: Please refer to the Claude CLI Installation Guide for detail.
Automated Setup (Recommended)
Windows
.\install\setup-claude-cli.ps1
Options:
# Interactive mode (choose scope: user/project/local)
.\install\setup-claude-cli.ps1
# User scope (available in all your projects)
.\install\setup-claude-cli.ps1 -Scope user
# Project scope (team-shared via .mcp.json)
.\install\setup-claude-cli.ps1 -Scope project
# Skip build step
.\install\setup-claude-cli.ps1 -SkipBuild
Linux/macOS
chmod +x install/setup-claude-cli.sh
./install/setup-claude-cli.sh
Options:
# Interactive mode
./install/setup-claude-cli.sh
# User scope
./install/setup-claude-cli.sh --scope user
# Project scope
./install/setup-claude-cli.sh --scope project
# Skip build
./install/setup-claude-cli.sh --skip-build
Manual Setup
Choose the configuration scope that fits your needs:
| Scope | Storage | Use Case | Team Sharing |
|---|---|---|---|
| User | ~/.config/claude/ | Personal use across all projects | β No |
| Project | .mcp.json in repo | Team collaboration (committed to git) | β Yes |
| Local | .mcp.local.json in repo | Project-specific, not shared (gitignored) | β No |
User Scope (Personal Use)
Available in all your projects:
claude mcp add --transport stdio roslyn --scope user \
--env DOTNET_ENVIRONMENT=Production \
--env LOG_LEVEL=Information \
-- dotnet run --project /absolute/path/to/RoslynCSMCP/RoslynMcpServer
Project Scope (Team Sharing)
Best for shared projects - configuration is committed to .mcp.json:
# From the RoslynCSMCP directory
claude mcp add --transport stdio roslyn --scope project \
--env DOTNET_ENVIRONMENT=Production \
--env LOG_LEVEL=Information \
-- dotnet run --project ./RoslynMcpServer
This creates/updates .mcp.json which can be committed to version control.
Local Scope (Project-Specific, Private)
For project-specific configuration that won't be shared:
claude mcp add --transport stdio roslyn --scope local \
--env DOTNET_ENVIRONMENT=Production \
--env LOG_LEVEL=Information \
-- dotnet run --project ./RoslynMcpServer
See claude-cli-config.example.json for a complete configuration example.
Verification
# List all configured MCP servers
claude mcp list
# Check RoslynCSMCP configuration
claude mcp get roslyn
# Should show: roslyn (stdio) with command and environment details
Using RoslynCSMCP in Claude CLI
Start Claude CLI and use natural language to analyze C# code:
claude
> Search for all classes implementing IRepository in MySolution.sln
> Find all references to UserService in MySolution.sln
> Analyze code complexity in src/Services/*.cs
> Show me the dependency graph for this solution
> Get information about the CalculateTotal method in MyProject.sln
π For detailed Claude CLI integration guide, see CLAUDE_CLI_INTEGRATION.md
Usage Examples
Once configured with either Claude Desktop or Claude CLI, you can use natural language queries:
Search for Symbols
Search for all classes ending with 'Service' in C:\MyProject\MyProject.sln
Find all methods starting with 'Calculate' in /path/to/MySolution.sln
Find References
Find all references to the UserRepository class in C:\MyProject\MyProject.sln
Where is the ProcessOrder method used in MySolution.sln?
Get Symbol Information
Get information about the CalculateTotal method in C:\MyProject\MyProject.sln
Show me details about the UserService class
Analyze Dependencies
Analyze dependencies for the solution at C:\MyProject\MyProject.sln
What are the namespace dependencies in MySolution.sln?
Code Complexity Analysis
Find methods with complexity higher than 7 in C:\MyProject\MyProject.sln
Identify complex methods in src/Services/*.cs with threshold 10
Available MCP Tools
The server exposes 51 MCP tools for comprehensive C# code analysis, organized into 9 modules:
π‘ Modular Loading: Each module can be loaded independently. See Modular Architecture for configuration.
Core Analysis Tools
-
SearchSymbols - Search for symbols using wildcard patterns (
*Service,Get*, etc.)- Supports filtering by symbol kind (class, interface, method, property, field, event)
- Returns top results ranked by relevance
-
FindReferences - Find all references to a specific symbol with configurable detail levels β‘ NEW
- Summary mode - Only file names and line numbers (95% token savings)
- Locations mode - File names with code lines (80% token savings)
- Full mode - Complete 5-line context around each reference
- Distinguishes between definitions and usages
-
GetSymbolInfo - Get detailed information about a symbol
- Returns type information, accessibility, location
- Shows method signatures, property types, etc.
Token Optimization Tools β‘ NEW
-
GetProjectStructure - Get hierarchical overview of projects, namespaces, and types
- Shows project organization at a glance (90% token savings)
- Optional member signatures
- Filter by namespace pattern
- ~300 tokens vs ~3,000 tokens for multiple searches
-
GetTypeSignature - Get type signatures without implementation
- Shows class/interface structure with all members (90% token savings)
- Includes XML documentation comments
- Option to include private members
- ~200 tokens vs ~2,000 tokens for reading full file
Advanced Analysis Tools
-
AnalyzeDependencies - Analyze project dependencies and namespace usage
- Identifies inter-project dependencies
- Shows most-used namespaces
- Counts public vs internal symbols
-
AnalyzeCodeComplexity - Identify high-complexity methods
- Calculates cyclomatic complexity
- Configurable threshold (default: 5)
- Helps identify refactoring candidates
Advanced Analysis Tools
-
GetCodeMetrics - Comprehensive code statistics and quality metrics
- Lines of code (total, code, comments, blank)
- Type statistics (classes, interfaces, structs, enums)
- Cyclomatic complexity analysis with hotspot identification
- Project-by-project breakdown
- Largest types and complexity hotspots
- ~400 tokens for complete solution analysis
-
GetDependencyGraph - Project dependency visualization in multiple formats
- Text format - Simple, readable dependency tree
- DOT format - Graphviz visualization (for professional diagrams)
- Mermaid format - Markdown diagrams (renders in GitHub/docs)
- Optional package dependency inclusion
- ~200-350 tokens depending on format
-
GetCallHierarchy - Method call chain analysis
- Shows callers (who calls this method)
- Shows callees (what this method calls)
- Configurable direction (both, callers, callees)
- Depth-limited traversal (default: 3 levels)
- Call count tracking for frequently called methods
- ~250-500 tokens depending on direction
-
BatchQuery - Execute multiple queries in a single request
- Combine any MCP tools in one batch
- Parallel or sequential execution
- Graceful error handling (partial failures don't stop others)
- Saves ~50-100 tokens per additional query vs separate requests
- Reduces MCP protocol overhead
Advanced Filtering
- FindReferencesFiltered - Find references with intelligent filtering
- excludeTests: Exclude test projects (Test, Tests, Testing, Spec) β Most useful
- crossProjectOnly: Only cross-project references (API usage analysis)
- publicOnly: Only public API references
- writesOnly: Only write operations (assignments, increments)
- projectFilter: Filter by project name pattern (supports wildcards)
- Combines with detail levels (summary/locations/full)
- Token savings: 60-90% by filtering out irrelevant references
- Use case: "Find who uses DeleteUser in production code (exclude tests)" β 88% token savings
Diagnostics & File Analysis
-
GetCompilationErrors - Get compilation errors and warnings without running full build
- severity: Filter by Error, Warning, Info, or All
- projectFilter: Filter by project name pattern (supports wildcards)
- errorCodes: Filter by specific error codes (e.g., CS0103, CS0246)
- Provides error location, message, and source code line
- Groups by project and severity for easy navigation
- Token savings: 97.5% vs reading files to find errors manually
- Use case: "Get all CS0103 errors in MySolution.sln" β Quick missing variable detection
-
GetFileOutline - Get structural outline of C# files without implementation details
- Shows file statistics (lines of code, comments, blanks)
- Lists using statements and namespaces
- Shows all types with inheritance and attributes
- Lists members (constructors, fields, properties, methods, events)
- Includes XML documentation comments
- Option to include/exclude members and documentation
- Token savings: 95% vs reading full file implementation
- Use case: "Get outline of UserService.cs" β Understand file structure in 400 tokens instead of 8,000
Navigation & Testing
-
FindImplementations - Find all implementations of interfaces or abstract classes
- Discovers all concrete classes implementing an interface
- Finds all classes inheriting from abstract base classes
- Option to include abstract implementations
- Shows inheritance hierarchy and implemented interfaces
- Groups results by project
- Token savings: 70-80% vs manual file searching
- Use case: "Find implementations of IUserRepository" β Quickly discover all repository implementations
-
FindTestsForType - Find test classes and methods for a given type
- Discovers test classes using naming conventions ({Type}Tests, Test{Type}, etc.)
- Detects test frameworks (xUnit, NUnit, MSTest)
- Lists all test methods with attributes
- Supports partial name matching
- Shows test display names and descriptions
- Groups by test project and framework
- Token savings: 90%+ vs reading test files manually
- Use case: "Find tests for UserService" β See complete test coverage with 28 tests in 800 tokens
Hierarchy & Attribute Analysis
-
GetClassHierarchy - Get complete class hierarchy showing ancestors and descendants
- Shows inheritance chain (base classes and interfaces)
- Displays derived types (classes that inherit from or implement the type)
- Configurable direction (ancestors/descendants/both)
- Recursive traversal with max depth control
- Visual tree structure with type information
- Token savings: 60-70% vs reading multiple files to understand hierarchy
- Use case: "Get hierarchy for UserService" β See complete inheritance tree with ancestors and descendants
-
FindAttributeUsages - Find all usages of specific attributes across the solution
- Discovers all types/members decorated with an attribute
- Supports all attribute targets (class, method, property, field, parameter, etc.)
- Shows attribute arguments (positional and named)
- Filter by target type for focused results
- Groups by target type and project
- Token savings: 80-90% vs searching and reading files manually
- Use case: "Find all [Obsolete] attributes" β Identify all deprecated code quickly
Code Quality & Detection
- FindUnusedCode - Detect unused code in your solution
- FindDuplicateCode - Find duplicate or similar code blocks
- AnalyzeDocumentationCoverage - Check XML documentation coverage
- FindSecurityIssues - Detect potential security vulnerabilities
- FindUnusedDependencies - Find unused NuGet packages
Package Analysis
- AnalyzePackages - Analyze NuGet package usage and versions
Testing & Quality
- GetTestCoverage - Analyze test coverage metrics
- GetChangeImpact - Analyze impact of code changes
Code Maintenance
- FindTODOComments - Find TODO, FIXME, HACK comments
- FindLargeFiles - Find files exceeding size thresholds
- FindDeprecatedAPIs - Find usage of deprecated APIs
- GetFileStatistics - Get detailed statistics for files
Batch Operations
- BatchQuery - Execute multiple queries in a single request
Performance, Security & Standards
- FindPerformanceIssues - Detect C# performance anti-patterns
- AnalyzeNamingConventions - Check naming convention compliance
- AnalyzeAPIChanges - Track API changes between versions
Interop & Modernization β‘ NEW
-
AnalyzeAotCompatibility - Detect AOT/trimming incompatibilities for .NET NativeAOT publishing
- Identifies reflection usage,
[DynamicallyAccessedMembers]gaps,[RequiresUnreferencedCode]violations - Checks
JsonSerializerContext,TypeDescriptor, and runtime emit patterns
- Identifies reflection usage,
-
AnalyzePInvoke - Audit P/Invoke and native interop for migration and safety
- Finds
[DllImport]methods that should migrate to[LibraryImport](AOT-compatible) - Detects
Marshal.PtrToStringAuto, missing[MarshalAs]on bool params,SetLastErrorgaps - Reports
GCHandle/Marshal.AllocHGlobalresource leaks andIntPtr/UIntPtrmodernization opportunities
- Finds
-
AnalyzeUnsafeCode - Review unsafe pointer usage, fixed blocks, and stackalloc patterns
- Highlights unguarded pointer arithmetic and suspicious memory access patterns
Quality Analysis β‘ NEW
-
AnalyzeConcurrencyPatterns - Detect thread safety and async/await issues
- Finds
async void, blocking.Result/.Wait(), missingConfigureAwait, lock anti-patterns
- Finds
-
AnalyzeMagicNumbers - Detect hard-coded numeric literals that should be named constants
- Reports array index literals, arithmetic magic values, hard-coded capacities, comparison literals
Metrics & Memory β‘ NEW
- AnalyzeMemoryAllocation - Find allocation hot spots and modernization opportunities
- Detects
ArrayPoolcandidates, boxing viaArrayList/Hashtable,SubstringβSpanmigrations - Identifies
string +=loops that should useStringBuilder
- Detects
Advanced Patterns β‘ NEW
-
AnalyzeIntegrityPatterns - Audit integrity check and anti-tamper code patterns
- Identifies SHA/MD5 compute sentinels, XOR string obfuscation, hardcoded checksums, anti-debug patterns
-
AnalyzeIpcPatterns - Review named pipe and StreamJsonRpc IPC patterns
- Finds missing error handling, synchronous pipe I/O in async methods, missing timeouts, hardcoded pipe names
Refactoring β‘ NEW
- FindSourceGeneratorOpportunities - Identify boilerplate patterns suitable for source generators
- Detects repetitive
INotifyPropertyChanged, builder patterns, and serialization boilerplate
- Detects repetitive
π Complete Usage Examples - Comprehensive guide with 100+ examples organized by feature category
Development and Testing
Using MCP Inspector
For development and testing without Claude Desktop/CLI:
# Install the MCP Inspector
npm install -g @modelcontextprotocol/inspector
# Run the inspector
npx @modelcontextprotocol/inspector dotnet run --project ./RoslynMcpServer
The inspector opens a web interface where you can:
- Test all MCP tools interactively
- View request/response JSON
- Debug server behavior
Running Tests
# Run from the project root
dotnet test
Building for Release
dotnet build -c Release
dotnet publish -c Release -o ./publish
Architecture
The server features a modular, layered architecture that supports both full and selective tool loading:
RoslynCSMCP.sln
βββ src/
β βββ RoslynMcpServer.Core/ # Shared library (services, models)
β βββ RoslynMcpServer.Navigation/ # Navigation MCP (6 tools)
β βββ RoslynMcpServer.Quality/ # Quality MCP (8 tools)
β βββ RoslynMcpServer.Security/ # Security MCP (3 tools)
β βββ RoslynMcpServer.Dependencies/ # Dependencies MCP (5 tools)
β βββ RoslynMcpServer.Refactoring/ # Refactoring MCP (5 tools)
β βββ RoslynMcpServer.Testing/ # Testing MCP (2 tools)
β βββ RoslynMcpServer.Metrics/ # Metrics MCP (4 tools)
β βββ RoslynMcpServer.Advanced/ # Advanced MCP (15 tools)
β βββ RoslynMcpServer.Interop/ # Interop MCP (3 tools)
βββ RoslynMcpServer/ # Full version (51 tools)
βββ RoslynMcpServer.Tests/ # Unit & integration tests
Layer Structure
- MCP Server Layer (
Program.csin each module) - Handles MCP protocol communication via stdio transport - Tools Layer (
Tools/*.cs) - Exposes MCP tools with[McpServerTool]attributes - Core Library (
RoslynMcpServer.Core/):- Services: All analysis services (SymbolSearchService, CodeAnalysisService, etc.)
- Models: DTOs for all tool results
- Configuration: Tool profile configuration
- Utilities: SecurityValidator, DiagnosticLogger, CacheManager
- Roslyn Integration - MSBuildWorkspace for loading .sln files and performing semantic analysis
Key Features
Performance Optimization:
- Multi-level caching (L1: Memory 10min, L2: Redis 1hr, L3: File 7days)
- Incremental analysis with file timestamp tracking
- Parallel project processing
- Throttled concurrent operations (CPU count limit)
Security:
- Path traversal prevention
- Allowed file extensions (.sln, .csproj only)
- Input sanitization for search patterns
- Safe regex pattern compilation
Roslyn Integration:
- MSBuild workspace for solution loading
- Semantic model for symbol analysis
- SymbolFinder for reference tracking
- Compilation caching for performance
For detailed architecture documentation, see CLAUDE.md.
Troubleshooting
Server Not Appearing in Claude Desktop
- Check the config file path is correct for your OS
- Verify the project path is absolute, not relative
- Ensure the JSON syntax is valid (no trailing commas)
- Restart Claude Desktop completely (check system tray on Windows)
- Check Claude Desktop logs:
- Windows:
%APPDATA%\Claude\logs\ - macOS:
~/Library/Logs/Claude/
- Windows:
Server Not Appearing in Claude CLI
# List configured servers
claude mcp list
# Check specific server configuration
claude mcp get roslyn
# Test MCP connection
claude mcp test roslyn
Build Errors
# Clean and rebuild
dotnet clean
dotnet restore
dotnet build -c Release
Ensure you have .NET 10.0 SDK installed:
dotnet --version
# Should show 10.0.x
Server Fails to Start
- Check .NET installation:
dotnet --versionshould show 10.0.x - Check MSBuild: Ensure MSBuild 17.11+ is available
- Review logs: Check stderr output for error messages
- Test manually: Run
dotnet run --project ./RoslynMcpServerand check for errors
Permission Issues (Linux/macOS)
# Make scripts executable
chmod +x install/setup-claude-desktop.sh
chmod +x install/setup-claude-cli.sh
chmod +x RoslynMcpServer/test-installation.sh
Debugging with File Logs π
Problem: When running as an MCP server from Claude Desktop/CLI, debug output goes to stderr and may be hard to view.
Solution: Enable Development mode to write detailed logs to file.
Enable Debug Logging
For Claude Desktop, edit your config file:
{
"mcpServers": {
"roslyn": {
"command": "dotnet",
"args": ["run", "--project", "/path/to/RoslynCSMCP/RoslynMcpServer"],
"env": {
"DOTNET_ENVIRONMENT": "Development"
}
}
}
}
For Claude CLI, add the environment variable:
claude mcp add --transport stdio roslyn --scope user \
--env DOTNET_ENVIRONMENT=Development \
-- dotnet run --project /path/to/RoslynCSMCP/RoslynMcpServer
Locate Log Files
After enabling Development mode, logs are written to:
-
Windows:
%TEMP%\RoslynCSMCP\logs\debug-YYYYMMDD.log# View in PowerShell Get-Content "$env:TEMP\RoslynCSMCP\logs\debug-$(Get-Date -Format yyyyMMdd).log" -Wait -Tail 50 -
Linux/macOS:
/tmp/RoslynCSMCP/logs/debug-YYYYMMDD.log# View in terminal tail -f /tmp/RoslynCSMCP/logs/debug-$(date +%Y%m%d).log
Log Contents
Debug logs include:
- All MCP tool invocations with parameters
- Operation timing from DiagnosticLogger
- MSBuild workspace loading events
- Symbol search and analysis details
- Cache hits/misses
- Full error stack traces
Production Logs
In Production mode (default), only warnings and errors are logged to:
- Windows:
%TEMP%\RoslynCSMCP\logs\roslyn-mcp-YYYYMMDD.log - Linux/macOS:
/tmp/RoslynCSMCP/logs/roslyn-mcp-YYYYMMDD.log - Retained for 30 days (vs 7 days for debug logs)
Documentation
| Document | Description |
|---|---|
| CLAUDE.md | Development guide and architecture for Claude Code |
| docs/FEATURES.md | Complete API reference for all 42 tools |
| docs/EXAMPLES.md | Comprehensive usage guide with 100+ examples |
| docs/TESTING.md | Testing guide (Desktop & CLI setup, MCP tests) |
| docs/AGENT_SKILLS.md | Agent skills guide for effective tool usage |
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Fork from RoslynMCP, originally by Chris Arquiza. Here is for personal playground.
- Not all scripts (installation, test, PowerShell script) are tested!
- Built with Roslyn - The .NET Compiler Platform
- Uses Model Context Protocol for Claude integration
- Powered by .NET 10.0
