Skip to main content
Glama
beekamai
by beekamai

mcp-dotnet

러시아어 버전은 아래에 있습니다 / Russian version below

LLM이 .NET 어셈블리를 C#으로 읽을 수 있게 해주는 소규모 MCP(Model Context Protocol) 서버입니다. 공식 ILSpy CLI(ilspycmd)를 stdio를 통해 노출하는 얇은 래퍼로, MCP 호환 클라이언트가 타입을 나열하거나, 단일 클래스를 디컴파일하거나, 전체 어셈블리를 프로젝트 트리로 디컴파일하거나, 디컴파일된 소스 전체에서 grep 검색을 수행할 수 있게 합니다.

왜 필요한가요?

LLM은 원시 IL 바이트코드가 아닌 소스 코드를 읽는 데 능숙합니다. ILSpy는 이미 CIL을 충실한 C#으로 변환하지만, 채팅 에이전트에서 이를 호출하는 것은 번거롭습니다. 매번 수동으로 ilspycmd를 실행하고 결과를 대화창에 붙여넣어야 하기 때문입니다. 이 서버는 해당 루프를 다음과 같이 공식화합니다:

  • list-types: 모델이 컨텍스트에 수 메가바이트의 디컴파일 결과를 덤프하지 않고도 어떤 타입을 살펴봐야 할지 알 수 있도록 먼저 타입을 나열합니다.

  • decompile-type: 정규화된 클래스 하나씩을 대상으로 읽기 위한 용도입니다.

  • decompile-assembly: 모델이 프로젝트 전체 grep을 실행하기 전처럼 전체 프로젝트 트리가 필요할 때 사용합니다.

  • search-source: 한 번 디컴파일하고 결과를 캐싱한 뒤, 생성된 모든 .cs 파일에 대해 grep을 수행합니다. 이후 검색은 캐시된 트리를 재사용합니다.

대상 어셈블리는 절대 실행되지 않습니다. 모든 것은 정적입니다.

또한 현대적인 .NET 6/7/8 단일 파일 배포(single-file deployment) 사례도 처리합니다. path를 게시된 .exe로 지정하면 ILSpy 10+가 자동으로 포함된 코어 어셈블리를 확인합니다.

Related MCP server: RePythonNET-MCP

도구

도구

기능

list-types

어셈블리에 선언된 타입을 나열합니다. 선택적 kinds 필터(c/i/s/d/e)를 지원합니다.

decompile-type

정규화된 타입 하나를 C#으로 디컴파일합니다. includeIl을 통해 IL을 추가할 수 있습니다.

decompile-assembly

.cs 파일 폴더(컴파일 가능한 프로젝트)로 디컴파일합니다.

search-source

(한 번 캐싱된) 디컴파일 결과를 바탕으로 정규식(regex)을 사용하여 C# 트리를 grep합니다. 파일/라인/스니펫을 반환합니다.

설치

# 1. ILSpy CLI (one-time, requires .NET SDK 6+)
dotnet tool install --global ilspycmd

# 2. This server
git clone https://github.com/beekamai/mcp-dotnet.git
cd mcp-dotnet
npm install
npm run build

ilspycmd가 PATH에 없다면 ILSPYCMD 환경 변수를 절대 경로로 설정하세요. 서버는 Windows의 경우 %USERPROFILE%\.dotnet\tools\ilspycmd.exe, POSIX의 경우 ~/.dotnet/tools/ilspycmd 기본 위치를 자동으로 감지합니다.

stdio를 통해 MCP 호환 클라이언트에 연결하세요:

your-mcp-client mcp add dotnet --scope user -- node /absolute/path/to/mcp-dotnet/dist/index.js

참고 사항

  • 모든 도구는 절대 경로를 사용합니다. MCP 클라이언트와 이 서버 간의 작업 디렉터리 차이가 흔하므로, 서버는 경로를 추측하지 않습니다.

  • decompile-assembly와 새로운 어셈블리에 대한 첫 번째 search-source는 크기에 따라 수십 초에서 수 분이 걸릴 수 있습니다. 타임아웃은 10분입니다.

  • search-source는 기본적으로 <assemblyDir>/.mcp-dotnet-<assemblyName>/ 아래에 디컴파일된 트리를 캐시합니다. 위치를 제어하려면 명시적인 outDir을 전달하거나, 캐시를 삭제하여 재디컴파일을 강제할 수 있습니다.

  • 서버는 ilspycmd를 자식 프로세스로 실행하며 stdin을 노출하지 않습니다. 대상 어셈블리의 코드는 어떤 시점에서도 실행되지 않습니다.

라이선스

MIT.


mcp-dotnet (RU)

Небольшой MCP-сервер, который даёт языковой модели возможность читать .NET-сборки как C#-исходники. Это тонкая обёртка над официальной консольной утилитой ILSpy (ilspycmd) поверх stdio: модель может получить список типов, декомпилировать один класс, развернуть всю сборку в дерево .cs-файлов или прогнать regex по исходнику.

Зачем это нужно

LLM хорошо читают исходный код и плохо — IL. ILSpy и так умеет превращать CIL в адекватный C#, но дёргать ilspycmd руками из чата неудобно — каждый раз shell-out и копипаст в контекст. Этот сервер формализует цикл:

  • Сначала list-types, чтобы модель не тащила мегабайты декомпила в контекст ради того, чтобы выяснить какой класс ей нужен.

  • decompile-type — точечно один полностью-квалифицированный тип.

  • decompile-assembly — когда нужен весь проектный tree (например, чтобы потом сделать project-wide grep).

  • search-source — декомпилирует один раз, кэширует результат и ищет regex по всем .cs. Повторные поиски используют кэш.

Целевую сборку никто не запускает. Всё статично.

Сервер также корректно работает с single-file deployment .NET 6/7/8 — указываешь path на опубликованный .exe, ILSpy 10+ сам находит встроенный основной assembly.

Тулы

Тул

Что делает

list-types

Список типов сборки. Опциональный фильтр kinds (c/i/s/d/e).

decompile-type

Декомпиляция одного типа в C#. С опциональным IL через includeIl.

decompile-assembly

Развёртывает сборку в папку .cs-файлов (компилируемый проект).

search-source

Один раз декомпилирует (с кэшем), потом regex-grep по .cs — возвращает file/line/snippet.

Установка

# 1. ILSpy CLI (один раз, нужен .NET SDK 6+)
dotnet tool install --global ilspycmd

# 2. Сам сервер
git clone https://github.com/beekamai/mcp-dotnet.git
cd mcp-dotnet
npm install
npm run build

Если ilspycmd не попал в PATH — выставь переменную окружения ILSPYCMD с абсолютным путём. Сервер также автоматически находит дефолтные пути: %USERPROFILE%\.dotnet\tools\ilspycmd.exe на Windows и ~/.dotnet/tools/ilspycmd на POSIX.

Подключение к MCP-клиенту через stdio:

your-mcp-client mcp add dotnet --scope user -- node /абсолютный/путь/к/mcp-dotnet/dist/index.js

Заметки

  • Все тулы принимают абсолютные пути. Рабочая директория MCP-клиента и сервера часто различаются, поэтому сервер ничего не угадывает.

  • decompile-assembly и первый search-source на свежей сборке могут занимать от десятков секунд до нескольких минут — таймаут 10 минут.

  • search-source кэширует декомпилированное дерево в <dir-сборки>/.mcp-dotnet-<имя-сборки>/. Если хочется в другое место — передай outDir явно. Удаление каталога заставит декомпилировать заново.

  • ilspycmd запускается дочерним процессом, его stdin не пробрасывается. Код целевой сборки нигде не исполняется.

Лицензия

MIT.

Available Tools

4 tools
decompile-assemblyA

Decompile the entire assembly into a folder of .cs files (a compilable project). Use this when you want to grep across the whole codebase. Returns the output directory and a flat list of generated files. Heavy - prefer list-types + decompile-type for targeted lookups.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the assembly.
outDirYesAbsolute path where the decompiled project tree should be written.

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description discloses that the tool is 'Heavy' (resource-intensive) and returns an output directory and flat list of files. It implies writing to disk but does not specify overwrite behavior or permissions needed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, all essential: purpose, use case, return info, and caveat. Front-loaded and concise with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with two simple parameters and no output schema, the description covers the return format ('output directory and flat list of generated files') and hints at the output being a compilable project, making it complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description does not add meaning beyond the schema's parameter descriptions, which are already clear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'decompile' and the resource 'entire assembly into .cs files', and differentiates from sibling tools by specifying that it is for grepping across the whole codebase and that alternatives are better for targeted lookups.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use ('when you want to grep across the whole codebase') and when not ('prefer list-types + decompile-type for targeted lookups'), providing clear guidance for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

decompile-typeA

Decompile a single fully-qualified type into C# source. Pass the fully qualified name as printed by list-types (e.g. 'Acme.Bot.LicenseManager').

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the assembly.
typeYesFully-qualified type name to decompile.
languageVersionNoC# language version. Default: Latest. Useful values: CSharp7_3, CSharp10_0, Latest.
includeIlNoAppend IL alongside the C# (ilspycmd -il). Default: false.

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must carry the full burden. It only states the basic action and parameter format, but omits information about output, errors, permissions, or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no redundancy, action-first structure provides maximum information with minimal text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequately describes the tool's core function and input requirements, but lacks details about output format, error handling, and usage context relative to siblings.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema descriptions cover all parameters (100% coverage), and the description adds value by specifying that the type name should come from list-types, which clarifies the expected format beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'Decompile a single fully-qualified type into C# source', which is a specific verb-resource combination. Distinguishes from sibling 'decompile-assembly' by targeting a single type rather than a whole assembly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides a hint to use the output of list-types for the type name, but does not explicitly say when to use this tool vs alternatives or when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list-typesA

List declared types in a .NET assembly (classes, interfaces, structs, delegates, enums). Use this first to find candidates before calling decompile-type. Works on .dll, .exe, and .NET 6+ single-file deployments (the embedded core assembly is decompiled directly).

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the assembly.
kindsNoComma-separated subset of: c (class), i (interface), s (struct), d (delegate), e (enum). Default: 'c,i,s,d,e'.

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description discloses supported file types and special handling for single-file deployments. It implies read-only operation but does not explicitly state safety or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no wasted words. Purpose and usage are front-loaded. Highly concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Completely covers the tool's purpose and relationship to sibling. Lacks output format details, but for a list tool with no output schema, this is acceptable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds mapping from letters to full type names but does not provide significant additional meaning beyond the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it lists declared types in a .NET assembly, specifying categories (classes, interfaces, structs, delegates, enums). It distinguishes from sibling 'decompile-type' by advising to use this first.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says 'Use this first to find candidates before calling decompile-type', providing clear context. Also notes compatibility with .dll, .exe, and .NET 6+ single-file deployments, but does not mention exclusions or alternatives for other siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search-sourceA

Decompile the assembly to a temporary directory then grep its C# source for a pattern. Returns the matching files with line snippets. The decompiled tree is preserved on disk for follow-up queries (path returned in 'outDir').

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the assembly.
outDirNoOptional output directory to reuse; otherwise a temp dir under the assembly's directory is created.
patternYesJavaScript regex pattern. Case-insensitive flag is implied.
maxMatchesNo

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It discloses that decompilation writes to a temporary directory, preserves the tree on disk for follow-up, and returns the outDir path. It does not mention safety or permissions, but the main behaviors are transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, all informative and front-loaded. The first sentence captures the core action, the second explains output, and the third adds key behavioral detail. No extraneous words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite no output schema, the description explains both return values and disk persistence. It covers the necessary context for an agent to invoke the tool correctly, given the sibling tool set.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is high (75%), but the description adds value by explaining the purpose of outDir (optional reuse, returned path) and the pattern's case-insensitive nature. This provides context beyond the schema definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool decompiles an assembly and then greps its C# source for a pattern, distinguishing it from sibling tools like decompile-assembly (decompilation only) and decompile-type (specific type decompilation). It specifies the output (matching files with line snippets) and the preserved disk state.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for searching decompiled code but does not explicitly compare with siblings or state when not to use. It lacks guidance on alternatives or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.1.0
    • First observeddecompile-assembly
    • First observeddecompile-type
    • First observedlist-types
    • First observedsearch-source

TDQS

A4.2/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: list-types for browsing, decompile-type for a single type, decompile-assembly for full project, and search-source for pattern matching. No functional overlap.

Naming Consistency5/5

All tool names follow a consistent lowercase hyphenated verb_noun pattern (e.g., list-types, decompile-assembly), ensuring predictability.

Tool Count5/5

With 4 tools, the server is well-scoped for its domain—covering browsing, targeted decompilation, full decompilation, and source search without unnecessary redundancy.

Completeness4/5

The set covers core decompilation workflows (list, decompile single, decompile all, search). A minor gap exists for decompiling specific members without the full type, but the overall surface is sufficient for typical use.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    ILSpy for LLM coding agents. Reflection-based MCP server with 31+ tools to explore .NET assemblies, NuGet packages, types, members, attributes, and XML docs.
    8
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables static analysis and patching of .NET binaries through decompilation, IL analysis, renaming, and IL patching over the Model Context Protocol.
    27
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    An MCP server that decompiles and inspects .NET assemblies to C# source, wrapping ILSpy. Enables querying .NET DLLs via natural language to decompile types, list members, and search symbols.
    7
    -
  • A
    license
    A
    quality
    D
    maintenance
    Code context for AI coding agents. Progressive, on-demand access to your internal .NET / NuGet package source — agents browse, search, and read private C# libraries autonomously, with zero workspace pollution.
    2
    41 npm
    MIT