ReflectionMcpServer
C# Roslyn MCP Server - Analyze C# source code using Roslyn and Model Context Protocol
Ask AI about ReflectionMcpServer
Powered by Claude ยท Grounded in docs
I know everything about ReflectionMcpServer. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
C# Roslyn MCP Server
Roslyn (Microsoft.CodeAnalysis)์ ์ฌ์ฉํ์ฌ C# ์์ค ์ฝ๋๋ฅผ ๋ถ์ํ๋ MCP(Model Context Protocol) ์๋ฒ์ ๋๋ค.
๊ฐ์
์ด MCP ์๋ฒ๋ Roslyn API๋ฅผ ํ์ฉํ์ฌ C# ์์ค ์ฝ๋ ๋ฐ ํ๋ก์ ํธ๋ฅผ ๋ถ์ํ๊ณ , ํ์ ์ ๋ณด, ์ฌ๋ณผ ์ ๋ณด, ์ฝ๋ ์ง๋จ, NuGet ํจํค์ง ํ์ ๋ฑ์ ์ ๊ณตํฉ๋๋ค. Claude Desktop์ด๋ ๋ค๋ฅธ MCP ํด๋ผ์ด์ธํธ์ ํจ๊ป ์ฌ์ฉํ์ฌ C# ์ฝ๋๋ฒ ์ด์ค๋ฅผ ํจ์จ์ ์ผ๋ก ์ดํดํ๊ณ ๋ถ์ํ ์ ์์ต๋๋ค.
์ ๊ณต ๊ธฐ๋ฅ
1. list_types - ํ์
๋ชฉ๋ก ์กฐํ
C# ์์ค ํ์ผ์ ์ ์๋ ๋ชจ๋ ํ์ (ํด๋์ค, ์ธํฐํ์ด์ค, ์ด๊ฑฐํ, ๊ตฌ์กฐ์ฒด)์ ๋์ดํฉ๋๋ค.
ํ๋ผ๋ฏธํฐ:
filePath(ํ์): C# ์์ค ํ์ผ ๊ฒฝ๋ก
์์ ์ถ๋ ฅ:
file: Calculator.cs
types:
- public class: Calculator
- public enum: CalculationType
2. get_symbol_info - ์ฌ๋ณผ ์ ๋ณด ์กฐํ
C# ์์ค ํ์ผ์์ ํน์ ์ฌ๋ณผ(ํด๋์ค, ๋ฉ์๋, ํ๋กํผํฐ ๋ฑ)์ ์์ธ ์ ๋ณด๋ฅผ ์กฐํํฉ๋๋ค.
ํ๋ผ๋ฏธํฐ:
filePath(ํ์): C# ์์ค ํ์ผ ๊ฒฝ๋กsymbolName(ํ์): ๊ฒ์ํ ์ฌ๋ณผ ์ด๋ฆ (๋์๋ฌธ์ ๋ฌด์, ๋ถ๋ถ ์ผ์น)
์์ ์ถ๋ ฅ:
- kind: Method
name: Add
fullName: Calculator.Add(int, int)
returnType: int
parameters:
- int a
- int b
3. get_type_info - ํ์
์ ๋ณด ์กฐํ
ํ์ ์ ์์ธ ์ ๋ณด(๋ฉ์๋, ํ๋กํผํฐ, ํ๋, ์์ ๊ด๊ณ ๋ฑ)๋ฅผ ์กฐํํฉ๋๋ค.
ํ๋ผ๋ฏธํฐ:
filePath(ํ์): C# ์์ค ํ์ผ ๊ฒฝ๋กtypeName(ํ์): ๊ฒ์ํ ํ์ ์ด๋ฆ (๋์๋ฌธ์ ๋ฌด์, ๋ถ๋ถ ์ผ์น)
์์ ์ถ๋ ฅ:
- name: Calculator
fullName: Calculator
kind: Class
namespace: TestApp
accessibility: Public
methods:
- int Add(int a, int b)
- int Subtract(int a, int b)
properties:
- string Name { get set }
4. analyze_code - ์ฝ๋ ๋ถ์
C# ์ฝ๋์ ๊ตฌ๋ฌธ ์ค๋ฅ, ๊ฒฝ๊ณ , ์ปดํ์ผ ์ง๋จ ์ ๋ณด๋ฅผ ๋ถ์ํฉ๋๋ค.
ํ๋ผ๋ฏธํฐ:
filePath(ํ์): C# ์์ค ํ์ผ ๊ฒฝ๋ก
์์ ์ถ๋ ฅ:
file: Calculator.cs
errors: 0
warnings: 2
warningList:
- [10,5] CS0168: The variable 'temp' is declared but never used
- [15,12] CS0219: The variable 'result' is assigned but its value is never used
5. analyze_project - ํ๋ก์ ํธ ๋ถ์
.csproj ํ์ผ์ ๊ธฐ๋ฐ์ผ๋ก ์ ์ฒด ํ๋ก์ ํธ๋ฅผ ๋ถ์ํฉ๋๋ค. NuGet ํจํค์ง๋ฅผ ํฌํจํ ๋ชจ๋ ์ฐธ์กฐ๋ฅผ ๋ก๋ํ์ฌ ํ๋ก์ ํธ ์ ์ฒด ์ปจํ ์คํธ์์ ์ฌ๋ณผ ๊ฒ์์ด ๊ฐ๋ฅํฉ๋๋ค.
ํ๋ผ๋ฏธํฐ:
projectPath(ํ์): .csproj ํ์ผ ๊ฒฝ๋กsymbolName(์ ํ): ๊ฒ์ํ ์ฌ๋ณผ ์ด๋ฆ
์์ ์ถ๋ ฅ:
project: ReflectionMcp
files: 1
references: 224
symbols:
- kind: NamedType
name: RoslynTools
fullName: RoslynTools
assembly: ReflectionMcp
typeKind: Class
6. find_nuget_symbol - NuGet ํจํค์ง์์ ์ฌ๋ณผ ์ฐพ๊ธฐ
ํ๋ก์ ํธ๊ฐ ์ฐธ์กฐํ๋ NuGet ํจํค์ง์์ ํ์ ์ด๋ ๋ฉ์๋๋ฅผ ์ฐพ์ต๋๋ค. ์ธ๋ถ ๋ผ์ด๋ธ๋ฌ๋ฆฌ API๋ฅผ ํ์ํ ๋ ์ ์ฉํฉ๋๋ค.
ํ๋ผ๋ฏธํฐ:
projectPath(ํ์): .csproj ํ์ผ ๊ฒฝ๋กsymbolName(ํ์): ๊ฒ์ํ ํ์ /๋ฉ์๋์ ์ ์ฒด ๋๋ ๋ถ๋ถ ์ด๋ฆ
์์ ์ถ๋ ฅ:
Searching for: IHost
In project: ReflectionMcp
found: 15
showing: 15
kinds: [Interface:5, Class:3, Method:7]
symbols:
- assembly: Microsoft.Extensions.Hosting.Abstractions
items:
- kind: Interface
name: Microsoft.Extensions.Hosting.IHost
base: System.IDisposable
- kind: Method
name: Microsoft.Extensions.Hosting.IHost.Start()
returnType: void
์ค์น ๋ฐฉ๋ฒ
๋ฐฉ๋ฒ 1: dnx๋ก ๋ฐ๋ก ์คํ (.NET 10+, ๊ถ์ฅ)
.NET 10 ์ด์์์๋ dnx ๋ช
๋ น์ด๋ก ์ค์น ์์ด ๋ฐ๋ก ์คํํ ์ ์์ต๋๋ค:
dnx ReflectionMcpServer
ํน์ ๋ฒ์ ์ง์ :
dnx ReflectionMcpServer@1.0.0
๋ฐฉ๋ฒ 2: .NET ๋๊ตฌ๋ก ์ค์น
์ ์ญ ๋๊ตฌ๋ก ์ค์นํ์ฌ ์ด๋์๋ ์ฌ์ฉ:
dotnet tool install -g ReflectionMcpServer
์ ๋ฐ์ดํธ:
dotnet tool update -g ReflectionMcpServer
๋ฐฉ๋ฒ 3: ์์ค์์ ๋น๋
git clone https://github.com/seungyongshim/ReflectionMcpServer.git
cd ReflectionMcpServer/src
dotnet build -c Release
Claude Desktop ์ค์
Claude Desktop์์ ์ด MCP ์๋ฒ๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ์ค์ ํ์ผ์ ์์ ํด์ผ ํฉ๋๋ค.
์ค์ ํ์ผ ์์น:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
dnx ์ฌ์ฉ (.NET 10+, ๊ถ์ฅ)
{
"mcpServers": {
"reflection": {
"command": "dnx",
"args": ["ReflectionMcpServer", "--yes"]
}
}
}
์ ์ญ ๋๊ตฌ๋ก ์ค์นํ ๊ฒฝ์ฐ
{
"mcpServers": {
"reflection": {
"command": "reflection-mcp"
}
}
}
์์ค์์ ๋น๋ํ ๊ฒฝ์ฐ
๊ฐ๋ฐ/๋๋ฒ๊น ์ฉ์ผ๋ก ํ๋ก์ ํธ์์ ์ง์ ์คํ:
{
"mcpServers": {
"reflection": {
"command": "dotnet",
"args": [
"run",
"--project",
"Z:\\2025\\ReflectionMcpServer\\src\\ReflectionMcp.csproj"
]
}
}
}
๋๋ ๋น๋๋ ์คํ ํ์ผ์ ์ง์ ์ฌ์ฉ:
{
"mcpServers": {
"reflection": {
"command": "Z:\\2025\\ReflectionMcpServer\\src\\bin\\Release\\net9.0\\ReflectionMcp.exe"
}
}
}
์ฃผ์: Windows ๊ฒฝ๋ก๋ ๋ฐฑ์ฌ๋์๋ฅผ ์ด์ค์ผ์ดํ(\\)ํด์ผ ํฉ๋๋ค.
์ฌ์ฉ ์์
Claude Desktop์์ ์ด MCP ์๋ฒ๋ฅผ ์ฌ์ฉํ์ฌ ๋ค์ํ ๋ถ์ ์์ ์ ์ํํ ์ ์์ต๋๋ค:
๊ธฐ๋ณธ ์ฝ๋ ๋ถ์
Calculator.cs ํ์ผ์ ์๋ ๋ชจ๋ ํ์
์ ๋์ดํด์ค
Calculator ํด๋์ค์ ์์ธ ์ ๋ณด๋ฅผ ๋ณด์ฌ์ค
Add ๋ฉ์๋์ ์ ๋ณด๋ฅผ ์๋ ค์ค
์ฝ๋ ํ์ง ๊ฒ์ฌ
Calculator.cs ํ์ผ์ ์ฝ๋๋ฅผ ๋ถ์ํด์ ์ค๋ฅ์ ๊ฒฝ๊ณ ๋ฅผ ์ฐพ์์ค
ํ๋ก์ ํธ ๋ ๋ฒจ ๋ถ์
ReflectionMcp.csproj ํ๋ก์ ํธ๋ฅผ ๋ถ์ํด์ค
ํ๋ก์ ํธ์์ IHost ์ธํฐํ์ด์ค๋ฅผ ์ฐพ์์ค
NuGet ํจํค์ง ํ์
ํ๋ก์ ํธ๊ฐ ์ฐธ์กฐํ๋ ํจํค์ง์์ IHostBuilder๋ฅผ ์ฐพ์์ค
Microsoft.Extensions.Hosting ํจํค์ง์์ ์ฌ์ฉ ๊ฐ๋ฅํ ํ์ฅ ๋ฉ์๋๋ฅผ ๋ณด์ฌ์ค
ํ ์คํธ
๋จ์ ํ ์คํธ ์คํ
cd test/ReflectionMcp.Tests
dotnet test
ํตํฉ ํ ์คํธ
cd test/TestRunner
dotnet run
์๋ ํ ์คํธ
PowerShell ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํ ๊ธฐ๋ฅ ํ ์คํธ:
# Roslyn ๊ธฐ๋ณธ ๊ธฐ๋ฅ ํ
์คํธ
.\test\test_roslyn.ps1
# MCP ์๋ฒ ํต์ ํ
์คํธ
.\test\test_mcp.ps1
# ์ฌ๋ณผ ๋ฐฉ๋ฌธ์ ํ
์คํธ
.\test\test_symbol_visitor.cs
๊ธฐ์ ์คํ
- .NET 9.0: ์ต์ .NET ๋ฐํ์
- ModelContextProtocol 0.4.0-preview.3: MCP ์๋ฒ ๊ตฌํ
- Microsoft.CodeAnalysis.CSharp 4.11.0: Roslyn ์ปดํ์ผ๋ฌ API
- Microsoft.CodeAnalysis.CSharp.Workspaces 4.11.0: ์์ ๊ณต๊ฐ ๋ฐ ํ๋ก์ ํธ ๋ถ์
- Microsoft.Build.Locator 1.7.8: MSBuild ์์น ํ์ธ
- Microsoft.CodeAnalysis.Workspaces.MSBuild 4.11.0: MSBuild ํ๋ก์ ํธ ๋ก๋ฉ
- stdio transport: ํ์ค ์ ์ถ๋ ฅ ๊ธฐ๋ฐ ํต์
์ํคํ ์ฒ
์ด ์๋ฒ๋ ๋ค์๊ณผ ๊ฐ์ ๊ณ์ธต ๊ตฌ์กฐ๋ก ๋์ํฉ๋๋ค:
- MCP Server Layer: stdio๋ฅผ ํตํด Claude Desktop๊ณผ ํต์
- Tool Layer: 6๊ฐ์ ๋๊ตฌ(๋ฉ์๋)๋ฅผ ํตํด ๊ธฐ๋ฅ ์ ๊ณต
- Roslyn Layer: Microsoft.CodeAnalysis API๋ฅผ ์ฌ์ฉํ ์ฝ๋ ๋ถ์
- MSBuild Layer: ํ๋ก์ ํธ ๋ฐ ์ฐธ์กฐ ๋ก๋ฉ
๋ฐฐํฌ
NuGet.org ๋ฐฐํฌ
ํจํค์ง๋ GitHub Release ์์ฑ ์ ์๋์ผ๋ก NuGet.org์ ๋ฐฐํฌ๋ฉ๋๋ค.
์๋ ๋ฐฐํฌ ํ๋ก์ธ์ค:
- GitHub ์ ์ฅ์์์ Releases โ Draft a new release ํด๋ฆญ
- ํ๊ทธ ์์ฑ:
v1.0.0(๋ฒ์ ๋ฒํธ) - Release ์ ๋ชฉ๊ณผ ์ค๋ช ์์ฑ
- Publish release ํด๋ฆญ
- GitHub Actions๊ฐ ์๋์ผ๋ก ๋น๋ ๋ฐ NuGet.org ๋ฐฐํฌ
๋ก์ปฌ์์ ํจํค์ง ์์ฑ
cd src
dotnet pack -c Release -o ../artifacts
์์ฑ๋ ํจํค์ง:
ReflectionMcpServer.{version}.nupkg: ์ผ๋ฐ ํจํค์งReflectionMcpServer.{version}.snupkg: ์ฌ๋ณผ ํจํค์ง
GitHub Packages ๋ฐฐํฌ (์ ํ์ฌํญ)
GitHub Packages๋ฅผ ํตํ ๋ฐฐํฌ๋ ์ง์๋ฉ๋๋ค:
# GitHub Packages ์์ค ์ถ๊ฐ
dotnet nuget add source "https://nuget.pkg.github.com/seungyongshim/index.json" \
--name github \
--username YOUR_USERNAME \
--password YOUR_GITHUB_PAT
# ํจํค์ง ์ค์น
dotnet tool install -g ReflectionMcpServer --add-source github
์ฐธ๊ณ : GitHub PAT(Personal Access Token)์ read:packages ๊ถํ์ด ํ์ํฉ๋๋ค.
๋ผ์ด์ ์ค
MIT License - ์์ธํ ๋ด์ฉ์ LICENSE ํ์ผ์ ์ฐธ์กฐํ์ธ์.
๊ธฐ์ฌ
์ด์ ์ ๊ธฐ์ ํ ๋ฆฌํ์คํธ๋ฅผ ํ์ํฉ๋๋ค!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
