io.github.jcucci/dotnet-sherlock-mcp

平台与服务

by jcucci

.NET assembly introspection MCP server with advanced reflection and type analysis capabilities

什么是 io.github.jcucci/dotnet-sherlock-mcp

.NET assembly introspection MCP server with advanced reflection and type analysis capabilities

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 28+ 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):

bash
dotnet tool install -g Sherlock.MCP.Server

Alternatively, during development you can run the server locally:

bash
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):
jsonc
{
  "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:

markdown
## .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:

code
# .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:

text
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

text
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

text
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

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

Find types and drill in

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

Tune paging and filters

text
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

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:

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

Errors use a consistent shape:

jsonc
{ "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:

code
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:

bash
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

bash
# 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:

bash
# 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.

常见问题

io.github.jcucci/dotnet-sherlock-mcp 是什么?

.NET assembly introspection MCP server with advanced reflection and type analysis capabilities

相关 Skills

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描114.1k

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描114.1k

MCP服务构建器

by alirezarezvani

Universal
热门

从 OpenAPI 一键生成 Python/TypeScript MCP server 脚手架,并校验 tool schema、命名规范与版本兼容性,适合把现有 REST API 快速发布成可生产演进的 MCP 服务。

帮你快速搭建 MCP 服务与后端 API,脚手架完善、扩展顺手,尤其适合想高效验证服务能力的开发者。

平台与服务
未扫描10.2k

相关 MCP Server

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
83.4k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
78.4k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
35.4k

评论