An MCP server that lets AI agents browse the actual API surface of NuGet packages referenced by .NET projects. Instead of hallucinating APIs, agents can inspect real type definitions, method signatures, and XML documentation.
Uses MetadataLoadContext for safe, inspection-only assembly loading (no code execution) and parses project.assets.json for accurate dependency resolution.
Requires the .NET 10 SDK or later.
dotnet tool install -g NugetPackageServerdotnet new tool-manifest # if you don't have one yet
dotnet tool install NugetPackageServerAdd the MCP server to your agent's configuration.
Add to ~/.claude.json:
{
"mcpServers": {
"nuget-package-server": {
"command": "nuget-package-server"
}
}
}Add to .mcp.json in your project root:
{
"mcpServers": {
"nuget-package-server": {
"command": "dotnet",
"args": ["nuget-package-server"]
}
}
}Use "command": "dotnet" with "args": ["nuget-package-server"] for local tool installs, or "command": "nuget-package-server" for global installs.
Load a .NET project's NuGet package information. Call this first before using other tools.
load_project(projectPath: "path/to/MyProject.csproj")
The server parses project.assets.json to discover all packages. Run dotnet restore first if the project hasn't been restored. Multiple projects can be loaded simultaneously.
Load a NuGet package by name into an isolated context for exploration. Useful for evaluating packages before adding them to a project.
load_package(name: "Humanizer.Core", version: "2.14.1", workingDirectory: "/path/to/repo")
Creates a temporary project under {workingDirectory}/tmp/, runs dotnet restore, and indexes the package. Respects nuget.config and Central Package Management (Directory.Packages.props) from the working directory. The tfm parameter is optional if a project is already loaded.
Free memory by unloading a previously loaded project or package.
List all NuGet packages (direct and transitive) referenced by the loaded project.
List all namespaces across loaded packages, grouped by package. Useful for discovering the structure of an unfamiliar package before drilling into types. Supports an optional packageName filter.
Search for types across all loaded package assemblies. Supports optional filters:
query-- case-insensitive substring match against full type namepackageName-- filter to a specific NuGet packagenamespace-- prefix match on namespacetypeKind-- filter byclass,abstract class,sealed class,static class,interface,struct,enum, ordelegate
Returns up to 50 matches.
Search for methods, properties, events, and fields across all loaded package types. Supports optional filters:
query-- case-insensitive substring match against member namepackageName-- filter to a specific NuGet packagetypeName-- substring match on declaring type namememberKind-- filter bymethod,property,constructor,event,field, orenum value
Returns up to 50 lightweight matches. Use get_type_definition for full signatures.
Get the full API surface of a type: constructors, methods, properties, events, and fields. Includes inline XML doc summaries where available.
Get detailed XML documentation for a specific member using the standard member ID format (e.g. T:Namespace.Type, M:Namespace.Type.Method).
Reload a project's context after dependencies have changed.
git clone https://github.com/roboz0r/nuget-package-server.git
cd nuget-package-server
dotnet builddotnet test# From the repo root
dotnet pack src/NugetPackageServer/NugetPackageServer.fsproj -o ./artifacts
# In another repo, install as a local tool
dotnet tool install NugetPackageServer --add-source /absolute/path/to/nuget-package-server/artifacts
# Or as a global tool
dotnet tool install -g NugetPackageServer --add-source /absolute/path/to/nuget-package-server/artifactsThen add the MCP config file described above.
MIT