mcpField
N
NuGet Context MCP Server

NuGet Context MCP Server

Local
github.com/pluckedDeveloper Tools3Updated 79w ago

About NuGet Context MCP Server

NuGet Context MCP Server analyzes .NET solutions and projects and queries NuGet feeds for package versions and metadata. It is for AI agents and development tools that need dependency context, with local SQLite caching for results.

Key features

  1. 01Analyze .sln and .csproj dependencies
  2. 02Search configured NuGet feeds
  3. 03List package versions
  4. 04Retrieve package metadata
  5. 05Cache results in SQLite

Use cases

  1. 01Find newer versions of project dependencies
  2. 02Search NuGet packages by term
  3. 03Inspect package versions and metadata
  4. 04Reduce repeated feed lookups with cached results

MCP support

The server exposes dependency analysis and NuGet package queries as MCP tools. MCP clients typically launch it as a process and communicate over stdio.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

NuGet Context MCP Server

License: MIT smithery badge .NET Test

A C# application that functions as a Model Context Protocol (MCP) server, providing context about .NET project dependencies (NuGet packages) to Large Language Models (LLMs) or other development tools.

Overview

This server analyzes .NET solutions (.sln) and projects (.csproj) to extract NuGet package information. It interacts with NuGet feeds to fetch package details, versions, and metadata, caching results locally using SQLite for improved performance. These capabilities are exposed as tools via the Model Context Protocol (MCP), allowing AI agents or other tools to query NuGet information programmatically.

Features

The server exposes the following tools via MCP:

  • AnalyzeProjectDependencies: Analyzes a .sln or .csproj file to find NuGet dependencies and their latest available versions.
  • SearchNuGetPackages: Searches the configured NuGet feed for packages matching a search term, with options for pagination and including pre-release versions.
  • GetNuGetPackageVersions: Lists all available versions (stable or pre-release) for a specific package ID.
  • GetLatestNuGetPackageVersion: Gets the latest stable or pre-release version string for a specific package ID.
  • GetNuGetPackageDetails: Retrieves detailed metadata (description, authors, URLs, etc.) for a specific package ID and optional version.

Prerequisites

  • .NET 9 SDK (or later compatible version)

Installation & Build

  1. Clone the repository:
    git clone https://github.com/plucked/nuget-context-server
    cd nuget-context-server
    
  2. Build the server:
    dotnet build --configuration Release
    
    The main executable will be within the src/NuGetContextMcpServer.Host/bin/Release/net9.0/ directory (adjust path based on actual build output).

Testing

This project uses NUnit for unit and integration testing and Moq for mocking dependencies in unit tests.

To run all tests, navigate to the repository root and execute:

dotnet test

Note: Running the integration tests (NuGetContextMcpServer.Integration.Tests) requires Docker to be installed and running, as they may utilize test containers. You can download Docker Desktop from here.

The test projects are located in the tests/ directory:

  • NuGetContextMcpServer.Application.Tests: Unit tests for the application layer services.
  • NuGetContextMcpServer.Infrastructure.Tests: Unit tests for the infrastructure layer components (e.g., caching, parsing).
  • NuGetContextMcpServer.Integration.Tests: Integration tests that may interact with actual file systems or potentially external resources (though typically mocked or using local test assets).

Usage & Configuration

This server is designed to be run by an MCP client application (like an IDE extension). The client is responsible for starting the server process and communicating with it, typically via standard input/output (stdio).

Configuration:

The server uses appsettings.json (and environment-specific overrides like appsettings.Development.json) located in the src/NuGetContextMcpServer.Host directory for configuration:

  • NuGetSettings:
    • QueryFeedUrl: The URL of the NuGet v3 feed index (defaults to https://api.nuget.org/v3/index.json).
    • Username (optional): Username for authenticated feeds.
    • PasswordOrPat (optional): Password or Personal Access Token (PAT) for authenticated feeds.
  • CacheSettings:
    • DatabasePath: Path to the SQLite cache file (defaults to nuget_cache.db in the working directory).
    • DefaultExpirationMinutes: Default cache duration in minutes (defaults to 60).
  • Logging: Configured via Serilog settings in appsettings.json. Logs are written to a file by default.

Example MCP Client Configuration (using stdio):

An MCP client would typically need configuration similar to this (syntax may vary based on the client):

{
  "mcpServers": {
    "nuget-context": {
      "command": "dotnet",
      "args": [
        "watch",
        "run",
        "--non-interactive",
        "--project",
        "src/NuGetContextMcpServer.Host/NuGetContextMcpServer.Host.csproj",
        "--",
        "--transport", "stdio"
      ],
      "cwd": ".",
      "disabled": false
    }
  }
}
  • command: The executable to run (dotnet).
  • args: Arguments passed to the command. Uses dotnet watch run for development to automatically restart the server on file changes. The --transport stdio argument tells the server to use standard I/O for MCP communication. For production or non-watch scenarios, replace "watch" with "run" and remove "--non-interactive".
  • cwd: The working directory from which the command should be run (usually the repository root).

Architecture

The server uses a layered architecture built on the .NET Generic Host:

  • Host: Manages application lifetime, Dependency Injection (DI), configuration, logging, and MCP communication setup.
  • Application: Defines service interfaces and contains core application logic and MCP tool definitions.
  • Infrastructure: Provides concrete implementations for:
    • NuGet feed interaction (NuGet.Protocol).
    • Project/Solution parsing (Microsoft.Build).
    • Caching (Microsoft.Data.Sqlite).

Contributing

Contributions are welcome! Please refer to the contribution guidelines for more details.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.