winget install --id=DimonSmart.NugetMcpServer -e
MCP server for searching interfaces and their methods inside NuGet packages
DimonSmart.NugetMcpServer is a Model Context Protocol (MCP) server designed to enable communication between language models and external tools. It provides functionality for searching interfaces and their methods within NuGet packages, facilitating seamless integration between AI-driven applications and existing codebases.
Key Features:
Audience & Benefit: Ideal for developers working with NuGet packages, AI-driven applications, or MCP protocol implementations. The server enables efficient integration of external tools and services into language model workflows, reducing the complexity of tool interaction while maintaining scalability.
The software can be installed via winget, ensuring straightforward setup and deployment across compatible environments.
A powerful MCP server for getting accurate interface and enum definitions from NuGet packages. It helps reduce LLM hallucinations by giving precise information about real package APIs. Certified by MCPHub
This application is not just a demo. It is a useful MCP server that reduces LLM hallucinations by giving accurate, up-to-date information about methods and types in specific NuGet package versions. Instead of using old training data, language models can ask for real package metadata and interface definitions directly from NuGet.
The server uses the Model Context Protocol (MCP). This makes it easy to connect with AI assistants and development tools. It gives real-time access to package information, helping developers and AI systems make better decisions about API usage.
You can use this server with OllamaChat, VS Code with Copilot, and other MCP-compatible clients.
You can install NugetMcpServer using WinGet:
winget install DimonSmart.NugetMcpServer
After installation, you can add the server to VS Code and other MCP-compatible clients. For VS Code:
NugetMcpServer.exe
) will be in your system PATH.dotnet build
dotnet run
Program.cs
- Main entry point that configures and runs the MCP serverTimeTool.cs
- Utility tool for time-related functions (namespace NugetMcpServer
)Tools/GetInterfaceDefinitionTool.cs
- Extracts interface definitions from NuGet packagesTools/ListInterfacesTool.cs
- Lists all interfaces in NuGet packagesTools/GetEnumDefinitionTool.cs
- Extracts enum definitions from NuGet packagesServices/NuGetPackageService.cs
- Works with NuGet packagesServices/InterfaceFormattingService.cs
- Formats interface definitionsServices/EnumFormattingService.cs
- Formats enum definitionsServices/InterfaceInfo.cs
- Model for interface informationServices/InterfaceListResult.cs
- Response model for interface listingCommon/McpToolBase.cs
- Base class for MCP toolsExtensions/
- Extension methods for string formatting and exception handlingThe server uses the .NET Generic Host and includes:
get_current_time()
- Returns the current server time in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ)get_interface_definition(packageId, interfaceName?, version?)
- Gets the C# interface definition from a NuGet package. Parameters: packageId (NuGet package ID), interfaceName (optional, short name without namespace), version (optional, defaults to latest)list_interfaces(packageId, version?)
- Lists all public interfaces in a NuGet package. Returns package ID, version, and the list of interfacesget_enum_definition(packageId, enumName, version?)
- Gets the C# enum definition from a NuGet package. Parameters: packageId (NuGet package ID), enumName (short name without namespace), version (optional, defaults to latest)get_class_definition(packageId, className, version?)
- Gets the C# class definition from a NuGet package. Parameters: packageId (NuGet package ID), className (short or full name), version (optional, defaults to latest)list_classes(packageId, version?)
- Lists all public classes in a NuGet package. Returns package ID, version, and the list of classessearch_packages(query, maxResults?, fuzzySearch?)
- Searches for NuGet packages by description or functionality.
get_package_info(packageId, version?)
- Gets comprehensive information about a NuGet package including metadata, dependencies, and meta-package status. Shows clear warnings for meta-packages and guidance on where to find actual implementations.get_package_dependencies(packageId, version?)
- Gets the dependencies of a NuGet package to help understand what other packages contain the actual implementationsHere are examples of server responses from the MCP tools using DimonSmart.MazeGenerator as a sample package:
A user might ask:
> "I want to generate mazes in my .NET application. Is there a package for that? Can you show me the interface for DimonSmart.MazeGenerator so I can see how to use it?"
The agent would use the MCP server to get the interface definition:
Request:
{
"name": "f1e_GetInterfaceDefinition",
"parameters": {
"packageId": "DimonSmart.MazeGenerator",
"interfaceName": "IMazeGenerator",
"version": ""
}
}
Response (actual MCP server output):
{
"result": "namespace DimonSmart.MazeGenerator\n{\n /// \n /// Interface for maze generation algorithms\n /// \n public interface IMazeGenerator\n {\n /// \n /// Creates a new maze with the specified dimensions\n /// \n /// Width of the maze\n /// Height of the maze\n /// A 2D array representing the maze\n bool[,] Generate(int width, int height);\n \n /// \n /// Gets the name of the algorithm used for maze generation\n /// \n string AlgorithmName { get; }\n }\n}"
}
The result is the actual JSON response from the MCP server:
\n
\"
result
property as a JSON stringThis is how an agent receives the interface definition from the MCP server. The agent then parses and displays it in a readable format for the user.
A user might ask:
> "I need a library for working with JSON in my .NET application. Can you help me find the most popular packages for JSON handling?"
The agent would use the MCP server to search for packages:
Request:
{
"name": "SearchPackages",
"parameters": {
"query": "JSON serialization library",
"maxResults": 5,
"fuzzySearch": false
}
}
For better results with descriptive queries, enable fuzzy search:
Request:
{
"name": "SearchPackages",
"parameters": {
"query": "I need a library for generating mazes",
"maxResults": 10,
"fuzzySearch": true
}
}
The AI can work with queries in Russian as well:
Request:
{
"name": "SearchPackages",
"parameters": {
"query": "Пользователю надо генерировать лабиринт",
"maxResults": 10,
"fuzzySearch": true
}
}
Response (formatted result shows combined results):
/* NUGET PACKAGE SEARCH RESULTS FOR: Пользователю надо генерировать лабиринт */
/* AI-GENERATED PACKAGE NAMES: MazeGenerator MazeBuilder MazeCreator */
/* FOUND 8 PACKAGES (SHOWING TOP 8) */
## DimonSmart.MazeGenerator v1.0.0
**Downloads**: 12,543
**Description**: Advanced maze generation library with multiple algorithms
**Project URL**: https://github.com/DimonSmart/MazeGenerator
## MazeBuilder v2.1.0
**Downloads**: 8,234
**Description**: Simple maze construction toolkit
The search algorithm works as follows:
The application uses the ModelContextProtocol library (version 0.2.0-preview.1), which helps create MCP-compatible servers. The server uses standard input/output to talk to clients.
Project namespaces:
NugetMcpServer
- Main namespace (used in TimeTool.cs)NuGetMcpServer.Tools
- Tool components (interface and enum tools)NuGetMcpServer.Services
- Service components (package and formatting services)NuGetMcpServer.Common
- Shared componentsNuGetMcpServer.Extensions
- Extension methodsYou can use this MCP server with different development tools and AI assistants:
By using this server, developers and AI systems get real-time, accurate information about NuGet package interfaces and enums. This reduces the chance of outdated or wrong API suggestions.
This MCP server helps solve a big problem in AI-assisted development: LLM hallucinations about package APIs. Common issues are:
Model Context Protocol (MCP) is a protocol that standardizes communication between language models and external tools. It lets models call functions, get information, and interact with external systems through one interface.
Unlicense - This is free and unencumbered software released into the public domain.
All tools that analyze package content (class definitions, interface definitions, enum definitions, and listing tools) now automatically detect meta-packages and show clear warnings. Meta-packages are NuGet packages that group other packages together without containing actual implementation code. When a meta-package is detected, the tools will: