dotnet-sherlock-mcp

dotnet-sherlock-mcp

ILSpy for LLM coding agents. Reflection-based MCP server with 31+ tools to explore .NET assemblies, NuGet packages, types, members, attributes, and XML docs.

Category
访问服务器

README

Sherlock MCP for .NET

Sherlock MCP for .NET is a comprehensive Model Context Protocol (MCP) server that provides deep introspection capabilities for .NET assemblies. It enables Language Learning Models (LLMs) to analyze and understand your .NET code with precision, delivering accurate and context-aware responses for complex development scenarios.

This tool is essential for developers who want to harness LLM capabilities for:

  • Deep codebase analysis - Understanding complex .NET architectures and dependencies
  • Precise type information - Getting detailed metadata about types, members, and their signatures
  • Automated documentation - Extracting and utilizing XML documentation and attributes
  • Custom tooling - Building sophisticated tools that interact with .NET assemblies
  • Code generation - Creating accurate code based on existing type structures

Key Features

  • Comprehensive MCP Server: Provides 31+ specialized tools for .NET assembly analysis
  • Advanced Assembly Introspection: Deep reflection-based analysis of types, members, and metadata
  • Rich Member Analysis: Detailed inspection of methods, properties, fields, events, and constructors
  • Smart Filtering & Pagination: Advanced filtering by name/attributes with efficient pagination for large datasets
  • XML Documentation Integration: Automatic extraction of summary, parameters, returns, and remarks
  • Performance Optimized: Caching, streaming, and memory-efficient processing
  • Stable JSON API: Consistent envelopes with versioning and structured error codes
  • .NET 9.0 Native: Built on the latest .NET platform with modern C# features
  • Project Integration: Solution and project file analysis with dependency resolution

Installation

Install the global tool from NuGet (adds sherlock-mcp to your PATH):

dotnet tool install -g Sherlock.MCP.Server

Alternatively, during development you can run the server locally:

dotnet run --project src/server/Sherlock.MCP.Server.csproj

Configure Your MCP Client

Sherlock runs as a standard MCP server that communicates over stdio.

  • Cursor: Settings → MCP / Custom tools → Add tool → Command: sherlock-mcp
  • Claude Desktop / other MCP clients: Add a server entry pointing to the sherlock-mcp command. Example JSON entry (refer to your client’s docs for exact file location/format):
{
  "servers": {
    "sherlock": {
      "command": "sherlock-mcp"
    }
  }
}

No arguments are required. The server self-registers all tools when launched.

Auto-Configure for .NET Projects

To automatically use Sherlock when working with .NET code, add these configurations:

Claude Code (CLAUDE.md)

Add this to your project's CLAUDE.md file:

## .NET Assembly Analysis

This project uses Sherlock MCP for .NET assembly analysis. When analyzing .NET types, methods, or assemblies:

1. Use sherlock-mcp tools instead of guessing about .NET APIs
2. For type analysis: `GetTypeInfo`, `GetTypeMethods`, `GetTypeProperties`
3. For assembly overview: `AnalyzeAssembly` or `GetTypesFromAssembly`
4. For project structure: `AnalyzeProject`, `AnalyzeSolution`
5. Assembly paths are typically: `./bin/Debug/net9.0/ProjectName.dll`

Always include assembly path, prefer full type names, and use pagination for large results.

Cursor (.cursorrules)

Add this to your project's .cursorrules file:

# .NET Analysis Rules
When working with .NET code, assemblies, or types:
- Use sherlock-mcp tools for accurate type/member information
- Assembly paths: ./bin/Debug/net9.0/*.dll or ./bin/Release/net9.0/*.dll
- For unknown types: GetTypesFromAssembly -> GetTypeInfo -> GetTypeMethods/Properties
- For code analysis: AnalyzeAssembly for overview, GetTypeInfo for details
- Use pagination (maxItems=50) for large results to avoid token limits

Global Configuration

For system-wide usage, add to your global Claude Code settings or Cursor configuration:

For .NET development: Use sherlock-mcp tools when analyzing assemblies, types, methods, or project structure. Prefer these over guessing .NET API details.

How To Prompt It

Below are compact prompt snippets you can paste into your chat to get productive fast. Adjust paths to your local DLLs.

General setup

You have access to an MCP server named "sherlock" that can analyze .NET assemblies. Prefer these tools for .NET questions and include short reasoning for which tool you chose. Ask me for the assembly path if missing.

Enumerate members for a type

Analyze: /absolute/path/to/MyLib/bin/Debug/net9.0/MyLib.dll
Type: MyNamespace.MyType
List methods, including non-public, filter name contains "Async", include attributes, return JSON.

Get XML docs for a member

Use GetXmlDocsForMember on /abs/path/MyLib.dll, type MyNamespace.MyType, member TryParse. Summarize the summary + params.

Find types and drill in

List types from /abs/path/MyLib.dll; then get type info for the first result and list its nested types.

Tune paging and filters

Use GetTypeMethods on /abs/path/MyLib.dll, type MyNamespace.MyType, sortBy name, sortOrder asc, skip 0, take 25, hasAttributeContains Obsolete.

Tools Overview

Assembly Discovery & Analysis

  • AnalyzeAssembly: Complete assembly overview with public types and metadata
  • FindAssemblyByClassName: Locate assemblies containing specific class names
  • FindAssemblyByFileName: Find assemblies by file name in common build paths

Type Introspection

  • GetTypesFromAssembly: List all public types with metadata (paginated)
  • AnalyzeType: Comprehensive type analysis with all members
  • GetTypeInfo: Detailed type metadata (accessibility, generics, nested types)
  • GetTypeHierarchy: Inheritance chain and interface implementations
  • GetGenericTypeInfo: Generic parameters, arguments, and variance information
  • GetTypeAttributes: Custom attributes declared on types
  • GetNestedTypes: Nested type declarations

Member Analysis (Filterable & Paginated)

  • GetAllTypeMembers: All members across all categories
  • GetTypeMethods: Method signatures, overloads, and metadata
  • GetTypeProperties: Property details including getters/setters and indexers
  • GetTypeFields: Field information including constants and readonly fields
  • GetTypeEvents: Event declarations with handler types
  • GetTypeConstructors: Constructor signatures and parameters
  • AnalyzeMethod: Deep method analysis with overloads and attributes

Reverse Lookup

  • FindImplementationsOf: Types implementing an interface or deriving from a base class
  • FindMethodsReturning: Methods whose return type matches a given type (open-generic match supported)
  • FindReferencesTo: Broader sweep across parameters, fields, properties, events, and generic arguments

Attributes & Metadata

  • GetMemberAttributes: Attributes for specific members
  • GetParameterAttributes: Parameter-level attribute information

XML Documentation

  • GetXmlDocsForType: Extract type-level XML documentation
  • GetXmlDocsForMember: Member-specific documentation (summary/params/returns/remarks)

Project & Solution Analysis

  • AnalyzeSolution: Parse .sln files and enumerate projects
  • AnalyzeProject: Project metadata, references, and build configuration
  • GetProjectOutputPaths: Resolve output directories for different configurations
  • ResolvePackageReferences: Map NuGet packages to cached assemblies
  • FindDepsJsonDependencies: Parse deps.json for runtime dependencies

Configuration & Runtime

  • GetRuntimeOptions: Current server configuration and defaults
  • UpdateRuntimeOptions: Modify pagination, caching, and search behavior

Advanced Filtering & Pagination

All member analysis tools support comprehensive filtering and pagination:

Filtering Options:

  • caseSensitive (bool): Case-sensitive type/member matching
  • nameContains (string): Filter by member name substring
  • hasAttributeContains (string): Filter by attribute type substring
  • includePublic / includeNonPublic (bool): Visibility filtering
  • includeStatic / includeInstance (bool): Member type filtering

Pagination:

  • skip / take (int): Standard offset pagination
  • maxItems (int): Maximum results per request
  • continuationToken (string): Token-based pagination for large datasets
  • sortBy / sortOrder (string): Sort by name/access in asc/desc order

Type Resolution:

  • Supports full names (Namespace.Type), simple names (Type), and nested types (Outer+Inner)
  • Case sensitivity controlled by caseSensitive parameter
  • Automatic fallback resolution for ambiguous type names

Response Schema

All tools return a stable JSON envelope:

{ "kind": "type.list|member.methods|...", "version": "1.0.0", "data": { /* result */ } }

Errors use a consistent shape:

{ "kind": "error", "version": "1.0.0", "code": "AssemblyNotFound|TypeNotFound|InvalidArgument|InternalError", "message": "...", "details": { } }

Common error codes include `AssemblyNotFound`, `TypeNotFound`, `MemberNotFound`, `InvalidArgument`, and `InternalError`.

Contributing

Contributions are welcome. This repo includes an .editorconfig with modern C# preferences (file-scoped namespaces, expression-bodied members, 4-space indentation).

Commit Message Format

This project uses Conventional Commits for automated changelog generation. All commits must follow this format:

type(scope): description

Valid types:

  • feat - A new feature
  • fix - A bug fix
  • docs - Documentation only changes
  • style - Code style changes (formatting, semicolons, etc)
  • refactor - Code change that neither fixes a bug nor adds a feature
  • perf - Performance improvement
  • test - Adding or correcting tests
  • build - Changes to build system or dependencies
  • ci - Changes to CI configuration
  • chore - Other changes that don't modify src or test files
  • revert - Reverts a previous commit

Examples:

git commit -m "feat(tools): add new assembly analysis tool"
git commit -m "fix: resolve null reference in type loader"
git commit -m "docs(readme): update installation instructions"

Development Setup

# Restore .NET tools (versionize, husky)
dotnet tool restore

# Install git hooks for commit validation
dotnet husky install

Guidelines

  • Keep changes small and focused; add unit tests for new behavior.
  • Follow the response envelope and error code conventions when adding tools.
  • Run dotnet build and dotnet test locally before opening a PR.

Creating a Release

Maintainers can create releases using:

# Restore tools if not already done
dotnet tool restore

# Preview what will change
dotnet versionize --dry-run

# Create release (bumps version, updates changelog, creates git tag)
dotnet versionize

# Push changes and tag to trigger release workflow
git push --follow-tags

The release workflow will automatically:

  1. Build and test the project
  2. Create a GitHub Release with changelog notes
  3. Publish the NuGet package
  4. Update server.json with the new version

MCP Registry

mcp-name: io.github.jcucci/dotnet-sherlock-mcp

License

Sherlock MCP for .NET is licensed under the MIT License.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选