
carquiza/roslynmcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
Microsoft Roslyn を使用して C# コード解析機能を提供するモデルコンテキストプロトコル (MCP) サーバー
概要
マイクロソフトのRoslynコンパイラプラットフォームと統合するC# MCP(Model Context Protocol)サーバーは、C#コードベース用のコード解析とナビゲーション機能を備えたClaude Desktopを提供します。 - - パターンマッチング(*Service、Get*Userなど)を使用してクラス、メソッド、プロパティを検索します。 - - - ソリューション全体でシンボルのすべての使用量 - - 種類、方法、特性などの詳細な情報を入手 - プロジェクトの依存性と名前空間の使用法パターンを分析 - cyclomatic複雑性メトリックを使用して、高複雑性方法を特定 - 大規模なコードベースのためのマルチレベルのキャッシュと増分分析 - 入力検証とパスの衛生 - .NET 8.0 SDK 以降 - Visual Studio 2022 または VS コード (開発に推奨) - Claude デスクトップ アプリケーション このMCPサーバーをClaudeデスクトップに接続するには、Claudeデスクトップの設定ファイルを変更する必要があります。 - : %APPDATA%\Claude\claude desktop config.json - : ~/Library/Application Support/Claude/claude desktop config.
概要(AI 翻訳)
マイクロソフトのRoslynコンパイラプラットフォームと統合するC# MCP(Model Context Protocol)サーバーは、C#コードベース用のコード解析とナビゲーション機能を備えたClaude Desktopを提供します。
##特徴
- ワイルドカードシンボル検索 - パターンマッチング([[
*Service]])、[Get*Userなどを使用してクラス、メソッド、プロパティを検索します。 - Reference Tracking - ソリューション全体にわたってシンボルのすべての使用量を割り当てる -Symbol情報 - 種類、方法、特性などの詳細情報を入手 -Dependency Analysis - プロジェクト依存関係と名前空間使用パターンの分析
- コード複雑性分析 - cyclomatic複雑性メトリックを使用して、高複雑性方法を特定する -Performance Optimized - 大規模なコードベース用のマルチレベルのキャッシュと増分解析
- セキュリティ - 入力検証とパスのサニタイズ
前提条件
- .NET 8.0 SDK 以降
- Visual Studio 2022 または VS コード (開発に推奨)
- クロードデスクトップアプリケーション
インストール
1.プロジェクトをクローンまたはダウンロード
2。 NuGetパッケージを復元する
3。プロジェクトを構築する
4.サーバーをテストして下さい (任意)
クイックセットアップ
ウィンドウズ
PowerShell セットアップスクリプトを実行します
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
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
インストール
npx @modelcontextprotocol/inspector dotnet run --project ./RoslynMcpServer設定
{
"mcpServers": {
"roslyn-code-navigator": {
"command": "dotnet",
"args": [
"run",
"--project",
"/path/to/RoslynMCP/RoslynMcpServer"
],
"env": {
"DOTNET_ENVIRONMENT": "Production",
"LOG_LEVEL": "Information"
}
}
}
}