Provides detailed type information from .NET projects, including assemblies, namespaces, classes, interfaces, methods, properties, fields, and events through reflection of compiled assemblies.
Enables searching for NuGet packages on nuget.org with filtering and pagination, and retrieving version history and dependency information for specific packages.
.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.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
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
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
Try to switch to the mcpdotnet library
Add dependency graph building capabilities
Improve multi-project scenario
Prerequisites
.NET 9.0 SDK or later
A .NET project that you want to explore
Installation
Clone the repository
Build the project:
dotnet build -c ReleasePublish the project:
dotnet publish -c Release -r <runtime-identifier> --self-contained falseReplace
<runtime-identifier>
with your target platform (e.g.,win-x64
,linux-x64
,osx-x64
).
Configuration
To use the .NET Types Explorer MCP Server with an AI agent, you need to configure it in your MCP settings file. Here's an example configuration:
Replace /path/to/DotNetMetadataMcpServer
with the actual path to the published executable, and /home/user
with your home directory.
Important Limitations
The project must be built before scanning. The server relies on compiled assemblies to extract type information, so make sure to build your project before using the tools.
The tool doesn't follow references to other projects. It only inspects the specified project and its NuGet dependencies. If you need to analyze multiple projects, you'll need to scan each one separately.
How project outputs are located
When scanning a project, the server needs the compiled assembly path. MsBuildHelper
evaluates the project and attempts to locate the output assembly by probing configurations in this order:
the requested configuration (by default Debug), then
Release, and if still not found,
falls back to checking Debug again as a safe default.
The first existing output wins. If no output is found, a reasonable default path is assumed and a warning is logged. This makes local runs (often Debug) and CI runs (often Release) behave consistently. Ensure you build the project in one of these configurations before scanning.
Usage
The server provides five main tools that can be used by AI agents:
ReferencedAssembliesExplorer: Retrieves referenced assemblies from a .NET project
NamespacesExplorer: Retrieves namespaces from specified assemblies
NamespaceTypes: Retrieves types from specified namespaces
NuGetPackageSearch: Searches for NuGet packages on nuget.org with filtering and pagination
NuGetPackageVersions: Retrieves version history and dependency information for specific NuGet packages
This tool has been tested with the Roo Code Visual Studio extension, an AI coding assistant that supports the Model Context Protocol. You can find more information about Roo Code on GitHub.
It's possible to use
.clinerules
file to instruct your codding assistant to use the MCP server.
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:
First, make sure the project is built. This tool relies on compiled assemblies to extract type information.
Start by retrieving all assemblies referenced by the project file using the ReferencedAssembliesExplorer tool. This gives you a list of all available assemblies.
Focus on third-party libraries and NuGet packages, not the Base Class Library (BCL) types like System.* or Microsoft.* which are well-documented elsewhere.
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.
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.
Only use filtering when you're overwhelmed by the amount of data or when you know exactly what you're looking for.
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.
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.
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:
Project Evaluation: Uses MSBuild to evaluate the project file and find the compiled assembly
Assembly Loading: Loads the compiled assembly and its dependencies
Type Reflection: Uses reflection to extract detailed information about types
Filtering and Pagination: Applies filters and pagination to the results
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:
Response:
NamespacesExplorer
Retrieves namespaces from specified assemblies supporting filters and pagination.
Input Schema:
Response:
NamespaceTypes
Retrieves types from specified namespaces supporting filters and pagination.
Input Schema:
Response:
NuGetPackageSearch
Searches for NuGet packages on nuget.org with support for filtering and pagination.
Input Schema:
Response:
NuGetPackageVersions
Retrieves version history and dependency information for a specific NuGet package.
Input Schema:
Response:
Example Usage Scenario
Here's an example of how an AI agent might use the .NET Types Explorer MCP Server to explore a UI framework API:
Retrieve Assemblies with Filtering:
{ "ProjectFileAbsolutePath": "/home/user/Projects/MyApp/MyApp.csproj", "PageNumber": 1, "FullTextFiltersWithWildCardSupport": ["Avalonia*"] }Response:
{ "AssemblyNames": [ "Avalonia", "Avalonia.Controls.ColorPicker", "Avalonia.Controls.DataGrid", "Avalonia.Desktop", "Avalonia.Diagnostics", "Avalonia.Fonts.Inter", "Avalonia.FreeDesktop", "Avalonia.Native", "Avalonia.ReactiveUI", "Avalonia.Remote.Protocol" ], "CurrentPage": 1, "AvailablePages": [1, 2] }Retrieve Namespaces with Targeted Filtering:
{ "ProjectFileAbsolutePath": "/home/user/Projects/MyApp/MyApp.csproj", "AssemblyNames": ["Avalonia"], "PageNumber": 1, "FullTextFiltersWithWildCardSupport": ["*Media*", "*Image*"] }Response:
{ "Namespaces": [ "Avalonia.Media", "Avalonia.Media.Transformation", "Avalonia.Media.TextFormatting", "Avalonia.Media.TextFormatting.Unicode", "Avalonia.Media.Immutable", "Avalonia.Media.Imaging", "Avalonia.Media.Fonts" ], "CurrentPage": 1, "AvailablePages": [1] }Retrieve Types from a Specific Namespace:
{ "ProjectFileAbsolutePath": "/home/user/Projects/MyApp/MyApp.csproj", "Namespaces": ["Avalonia.Media.Imaging"], "PageNumber": 1, "FullTextFiltersWithWildCardSupport": [] }Response (partial):
{ "TypeData": [ { "FullName": "Avalonia.Media.Imaging.Bitmap", "Implements": [ "IBitmap", "IImage", "IDisposable", "IImageBrushSource" ], "Constructors": [ "(String fileName)", "(Stream stream)", "(PixelFormat format, AlphaFormat alphaFormat, IntPtr data, PixelSize size, Vector dpi, Int32 stride)" ], "Methods": [ "static Avalonia.Media.Imaging.Bitmap DecodeToWidth(System.IO.Stream stream, System.Int32 width, Avalonia.Media.Imaging.BitmapInterpolationMode? interpolationMode = null)", "static Avalonia.Media.Imaging.Bitmap DecodeToHeight(System.IO.Stream stream, System.Int32 height, Avalonia.Media.Imaging.BitmapInterpolationMode? interpolationMode = null)", "Avalonia.Media.Imaging.Bitmap CreateScaledBitmap(Avalonia.PixelSize destinationSize, Avalonia.Media.Imaging.BitmapInterpolationMode? interpolationMode = null)", "virtual System.Void Dispose()" ], "Properties": [ "virtual Avalonia.Vector Dpi { get; }", "virtual Avalonia.Size Size { get; }", "virtual Avalonia.PixelSize PixelSize { get; }" ] } ], "CurrentPage": 1, "AvailablePages": [1, 2] }Apply Specific Filters to Find Related Types:
{ "ProjectFileAbsolutePath": "/home/user/Projects/MyApp/MyApp.csproj", "Namespaces": ["Avalonia.Platform"], "PageNumber": 1, "FullTextFiltersWithWildCardSupport": ["*Framebuffer*", "*Pixel*"] }Response:
{ "TypeData": [ { "FullName": "Avalonia.Platform.ILockedFramebuffer", "Implements": ["IDisposable"], "Methods": [ "abstract System.IntPtr get_Address()", "abstract Avalonia.PixelSize get_Size()", "abstract System.Int32 get_RowBytes()", "abstract Avalonia.Vector get_Dpi()", "abstract Avalonia.Platform.PixelFormat get_Format()" ], "Properties": [ "abstract System.IntPtr Address { get; }", "abstract Avalonia.PixelSize Size { get; }", "abstract System.Int32 RowBytes { get; }", "abstract Avalonia.Vector Dpi { get; }", "abstract Avalonia.Platform.PixelFormat Format { get; }" ] } ], "CurrentPage": 1, "AvailablePages": [1] }
NuGet Package Examples
Here are examples of how an AI agent might use the NuGet tools to explore package information:
Search for NuGet Packages:
Response:
Search with Filtering:
Response:
Get Package Version Information:
Response:
Get Specific Package Version with Filtering:
Response:
License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
A Model Context Protocol (MCP) server that provides detailed type information from .NET projects for AI coding agents.
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,
Related MCP Servers
- -securityAlicense-qualityMCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.Last updated -14MIT License
- -securityAlicense-qualityMCP Server provides a simpler API to interact with the Model Context Protocol by allowing users to define custom tools and services to streamline workflows and processes.Last updated -03MIT License
- AsecurityFlicenseAqualityAn all-in-one Model Context Protocol (MCP) server that connects your coding AI to numerous databases, data warehouses, data pipelines, and cloud services, streamlining development workflow through seamless integrations.Last updated -3
- -securityAlicense-qualityModel Context Protocol (MCP) server that provides AI assistants with advanced web research capabilities, including Google search integration, intelligent content extraction, and multi-source synthesis.Last updated -114MIT License