Labsco
V0v1kkk logo

.NET Types Explorer

27

from V0v1kkk

Provides detailed type information from .NET projects including assembly exploration, type reflection, and NuGet integration for AI coding agents

🔥🔥🔥✓ VerifiedFreeAdvanced setup

.NET Types Explorer MCP Server

A Model Context Protocol (MCP) server that provides detailed type information from .NET projects for AI coding agents.

Overview

The .NET Types Explorer MCP Server is a powerful tool designed to help AI coding agents understand and work with .NET codebases. It provides a structured way to explore assemblies, namespaces, and types in .NET projects, making it easier for AI agents to generate accurate and context-aware code suggestions.

The server uses reflection to extract detailed type information from compiled .NET assemblies, including classes, interfaces, methods, properties, fields, and events. This information is then made available through a set of tools that can be used by AI agents to explore the codebase in a systematic way.

Features

  • Assembly Exploration: Retrieve a list of all assemblies referenced by a .NET project
  • Namespace Exploration: Discover all namespaces within specified assemblies
  • Type Exploration: Get detailed information about types within specified namespaces, including:
    • Full type names with generic parameters
    • Implemented interfaces
    • Constructors with parameters
    • Methods with return types and parameters
    • Properties with types and accessors
    • Fields with types and modifiers
    • Events with handler types
  • NuGet Package Search: Search for NuGet packages on nuget.org with filtering and pagination
  • NuGet Package Version Information: Retrieve version history and dependency information for specific NuGet packages
  • Configurable Assembly Resolution: Resolve assemblies from build output, NuGet global packages cache (restore-only, no build required), or automatically try both
  • Filtering: Apply wildcard filters to narrow down results
  • Pagination: Handle large result sets with built-in pagination

Roadmap

  • Add NuGet integration to provide information about actual package versions
  • Migrate to official Model Context Protocol C# SDK (modelcontextprotocol/csharp-sdk)
  • Support for multiple NuGet package sources (custom/private feeds)
  • Add dependency graph building capabilities
  • Improve multi-project scenario

AI Code Assistant Instructions

If you work with .NET projects that have NuGet package references and need to write code using those packages, you should explore the API of those packages systematically using the Dotnet Type Explorer MCP server. This is especially important when you're not familiar with the package's API or when documentation is limited.

When working with a .NET project:

  1. First, make sure the project is built. This tool relies on compiled assemblies to extract type information.

  2. Start by retrieving all assemblies referenced by the project file using the ReferencedAssembliesExplorer tool. This gives you a list of all available assemblies.

  3. Focus on third-party libraries and NuGet packages, not the Base Class Library (BCL) types like System.* or Microsoft.* which are well-documented elsewhere.

  4. Once you've identified the relevant assemblies, use the NamespacesExplorer tool to discover the namespaces within those assemblies. This helps you understand how the library is organized.

  5. After identifying the relevant namespaces, use the NamespaceTypes tool to retrieve detailed information about the types within those namespaces in which you are interested in. This includes methods, properties, fields, events, and more.

  6. Only use filtering when you're overwhelmed by the amount of data or when you know exactly what you're looking for.

  7. If you need to find specific NuGet packages or explore their versions and dependencies, use the NuGetPackageSearch tool to search for packages by name or keywords.

  8. When you need detailed information about a specific NuGet package, including its version history and dependencies, use the NuGetPackageVersions tool. This is particularly useful when you need to understand compatibility requirements or dependency chains.

  9. Use the filtering capabilities of the NuGet tools to narrow down results when searching for specific versions or packages with particular naming patterns.

Remember that this tool only inspects the specified project and its NuGet dependencies. It doesn't follow references to other projects in the solution. If you need to analyze multiple projects, you'll need to scan each one separately.

This top-down approach (assemblies → namespaces → types) is the most efficient way to explore and understand .NET libraries when you need to write code that uses them. It's particularly valuable for third-party libraries where the API might not be immediately obvious or well-documented. The NuGet tools complement this approach by providing direct access to package information without requiring the packages to be already referenced in the project.

How It Works

The server uses the following process to extract type information:

  1. Project Evaluation: Uses MSBuild to evaluate the project file and find the compiled assembly
  2. Assembly Loading: Loads the compiled assembly and its dependencies
  3. Type Reflection: Uses reflection to extract detailed information about types
  4. Filtering and Pagination: Applies filters and pagination to the results
  5. Response Formatting: Formats the results as JSON and returns them to the client

API Reference

ReferencedAssembliesExplorer

Retrieves referenced assemblies based on filters and pagination.

Input Schema:

{
  "type": "object",
  "properties": {
    "ProjectFileAbsolutePath": {
      "type": "string"
    },
    "PageNumber": {
      "type": "integer"
    },
    "FullTextFiltersWithWildCardSupport": {
      "type": "array",
      "items": {
        "type": [
          "string",
          "null"
        ]
      }
    }
  },
  "required": [
    "ProjectFileAbsolutePath"
  ]
}

Response:

{
  "AssemblyNames": ["Assembly1", "Assembly2", ...],
  "CurrentPage": 1,
  "AvailablePages": [1, 2, ...]
}

NamespacesExplorer

Retrieves namespaces from specified assemblies supporting filters and pagination.

Input Schema:

{
  "type": "object",
  "properties": {
    "ProjectFileAbsolutePath": {
      "type": "string"
    },
    "AssemblyNames": {
      "type": "array",
      "items": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "PageNumber": {
      "type": "integer"
    },
    "FullTextFiltersWithWildCardSupport": {
      "type": "array",
      "items": {
        "type": [
          "string",
          "null"
        ]
      }
    }
  },
  "required": [
    "ProjectFileAbsolutePath"
  ]
}

Response:

{
  "Namespaces": ["Namespace1", "Namespace2", ...],
  "CurrentPage": 1,
  "AvailablePages": [1, 2, ...]
}

NamespaceTypes

Retrieves types from specified namespaces supporting filters and pagination.

Input Schema:

{
  "type": "object",
  "properties": {
    "ProjectFileAbsolutePath": {
      "type": "string"
    },
    "Namespaces": {
      "type": "array",
      "items": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "PageNumber": {
      "type": "integer"
    },
    "FullTextFiltersWithWildCardSupport": {
      "type": "array",
      "items": {
        "type": [
          "string",
          "null"
        ]
      }
    }
  },
  "required": [
    "ProjectFileAbsolutePath"
  ]
}

Response:

{
  "TypeData": [
    {
      "FullName": "Namespace.TypeName",
      "Implements": ["Interface1", "Interface2", ...],
      "Constructors": ["(param1, param2)", ...],
      "Methods": ["ReturnType MethodName(param1, param2)", ...],
      "Properties": ["PropertyType PropertyName { get; set; }", ...],
      "Fields": ["FieldType FieldName", ...],
      "Events": ["event EventHandlerType EventName", ...]
    },
    ...
  ],
  "CurrentPage": 1,
  "AvailablePages": [1, 2, ...]
}

NuGetPackageSearch

Searches for NuGet packages on nuget.org with support for filtering and pagination.

Input Schema:

{
  "type": "object",
  "properties": {
    "SearchQuery": {
      "type": "string"
    },
    "IncludePrerelease": {
      "type": "boolean"
    },
    "PageNumber": {
      "type": "integer"
    },
    "FullTextFiltersWithWildCardSupport": {
      "type": "array",
      "items": {
        "type": [
          "string",
          "null"
        ]
      }
    }
  },
  "required": [
    "SearchQuery"
  ]
}

Response:

{
  "Packages": [
    {
      "Id": "Newtonsoft.Json",
      "Version": "13.0.3",
      "Description": "Json.NET is a popular high-performance JSON framework for .NET",
      "Authors": "James Newton-King",
      "DownloadCount": 1000000,
      "Published": "2023-03-08T00:00:00Z"
    },
    ...
  ],
  "CurrentPage": 1,
  "AvailablePages": [1, 2, ...]
}

NuGetPackageVersions

Retrieves version history and dependency information for a specific NuGet package.

Input Schema:

{
  "type": "object",
  "properties": {
    "PackageId": {
      "type": "string"
    },
    "IncludePrerelease": {
      "type": "boolean"
    },
    "PageNumber": {
      "type": "integer"
    },
    "FullTextFiltersWithWildCardSupport": {
      "type": "array",
      "items": {
        "type": [
          "string",
          "null"
        ]
      }
    }
  },
  "required": [
    "PackageId"
  ]
}

Response:

{
  "PackageId": "Newtonsoft.Json",
  "Versions": [
    {
      "Id": "Newtonsoft.Json",
      "Version": "13.0.3",
      "Description": "Json.NET is a popular high-performance JSON framework for .NET",
      "Authors": "James Newton-King",
      "DownloadCount": 1000000,
      "Published": "2023-03-08T00:00:00Z",
      "DependencyGroups": [
        {
          "TargetFramework": ".NETStandard2.0",
          "Dependencies": [
            {
              "Id": "System.Text.Json",
              "VersionRange": "6.0.0"
            }
          ]
        }
      ]
    },
    ...
  ],
  "CurrentPage": 1,
  "AvailablePages": [1, 2, ...]
}

NuGet Package Examples

Here are examples of how an AI agent might use the NuGet tools to explore package information:

  1. Search for NuGet Packages:
{
  "SearchQuery": "EntityFrameworkCore",
  "IncludePrerelease": false,
  "PageNumber": 1,
  "FullTextFiltersWithWildCardSupport": []
}

Response:

{
  "Packages": [
    {
      "Id": "Microsoft.EntityFrameworkCore",
      "Version": "7.0.0",
      "Description": "Entity Framework Core is a lightweight and extensible version of the popular Entity Framework data access technology.",
      "Authors": "Microsoft",
      "DownloadCount": 42000000,
      "Published": "2022-11-08T00:00:00Z"
    },
    {
      "Id": "Microsoft.EntityFrameworkCore.SqlServer",
      "Version": "7.0.0",
      "Description": "Microsoft SQL Server database provider for Entity Framework Core.",
      "Authors": "Microsoft",
      "DownloadCount": 38000000,
      "Published": "2022-11-08T00:00:00Z"
    }
  ],
  "CurrentPage": 1,
  "AvailablePages": [1, 2, 3, 4, 5]
}
  1. Search with Filtering:
{
  "SearchQuery": "Json",
  "IncludePrerelease": false,
  "PageNumber": 1,
  "FullTextFiltersWithWildCardSupport": ["Newtonsoft*"]
}

Response:

{
  "Packages": [
    {
      "Id": "Newtonsoft.Json",
      "Version": "13.0.3",
      "Description": "Json.NET is a popular high-performance JSON framework for .NET",
      "Authors": "James Newton-King",
      "DownloadCount": 1250000000,
      "Published": "2023-03-08T00:00:00Z"
    },
    {
      "Id": "Newtonsoft.Json.Bson",
      "Version": "1.0.2",
      "Description": "Json.NET BSON adds support for reading and writing BSON",
      "Authors": "James Newton-King",
      "DownloadCount": 120000000,
      "Published": "2020-01-01T00:00:00Z"
    }
  ],
  "CurrentPage": 1,
  "AvailablePages": [1]
}
  1. Get Package Version Information:
{
  "PackageId": "Newtonsoft.Json",
  "IncludePrerelease": false,
  "PageNumber": 1,
  "FullTextFiltersWithWildCardSupport": []
}

Response:

{
  "PackageId": "Newtonsoft.Json",
  "Versions": [
    {
      "Id": "Newtonsoft.Json",
      "Version": "13.0.3",
      "Description": "Json.NET is a popular high-performance JSON framework for .NET",
      "Authors": "James Newton-King",
      "DownloadCount": 1250000000,
      "Published": "2023-03-08T00:00:00Z",
      "DependencyGroups": [
        {
          "TargetFramework": ".NETStandard2.0",
          "Dependencies": []
        },
        {
          "TargetFramework": ".NETFramework4.5",
          "Dependencies": []
        }
      ]
    },
    {
      "Id": "Newtonsoft.Json",
      "Version": "13.0.2",
      "Description": "Json.NET is a popular high-performance JSON framework for .NET",
      "Authors": "James Newton-King",
      "DownloadCount": 980000000,
      "Published": "2022-11-24T00:00:00Z",
      "DependencyGroups": [
        {
          "TargetFramework": ".NETStandard2.0",
          "Dependencies": []
        },
        {
          "TargetFramework": ".NETFramework4.5",
          "Dependencies": []
        }
      ]
    }
  ],
  "CurrentPage": 1,
  "AvailablePages": [1, 2, 3, 4, 5]
}
  1. Get Specific Package Version with Filtering:
{
  "PackageId": "Microsoft.EntityFrameworkCore",
  "IncludePrerelease": false,
  "PageNumber": 1,
  "FullTextFiltersWithWildCardSupport": ["7.0.0"]
}

Response:

{
  "PackageId": "Microsoft.EntityFrameworkCore",
  "Versions": [
    {
      "Id": "Microsoft.EntityFrameworkCore",
      "Version": "7.0.0",
      "Description": "Entity Framework Core is a lightweight and extensible version of the popular Entity Framework data access technology.",
      "Authors": "Microsoft",
      "DownloadCount": 42000000,
      "Published": "2022-11-08T00:00:00Z",
      "DependencyGroups": [
        {
          "TargetFramework": "net6.0",
          "Dependencies": [
            {
              "Id": "Microsoft.Extensions.Caching.Memory",
              "VersionRange": "7.0.0"
            },
            {
              "Id": "Microsoft.Extensions.DependencyInjection",
              "VersionRange": "7.0.0"
            },
            {
              "Id": "Microsoft.Extensions.Logging",
              "VersionRange": "7.0.0"
            }
          ]
        }
      ]
    }
  ],
  "CurrentPage": 1,
  "AvailablePages": [1]
}