Microsoft NuGet

com.microsoft由 microsoft.com 发布v1.4.23更新于 Oct 31, 2026

A Model Context Protocol (MCP) server for NuGet.

发布方自己的服务:Microsoft Learn MCP

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

微软的 NuGet MCP 服务器让助手查询包信息、规划升级、修复有漏洞的依赖,并审查仓库的 NuGet 供应链配置。

可以做什么
  • 从已配置的 NuGet 源查询包的最新版本与包上下文(AGENTS.md 或 README)
  • 规划并执行包变更:升级到最新兼容版本,或设定精确的目标版本
  • 以最小的安全版本改动修复直接与传递依赖中的已知漏洞
  • 审查仓库的供应链设置,如集中包管理、NuGet 审计、包源映射及 NuGet.Config 有效性
适用场景
适合希望让助手分析项目包依赖图、保持依赖更新、修复存在漏洞的包,或审查 NuGet 供应链配置的 .NET 开发者,无需离开对话即可完成。
运行要求
通过 dnx 命令以 stdio 在本地运行,需要 .NET 10 Preview 6 或更高版本;在 Visual Studio 2022(17.14 及以上)、Visual Studio 2026、VS Code 或 GitHub Copilot 的 mcp.json 中配置。使用你已配置的 NuGet 源,默认是公共 nuget.org 源。未声明任何 API 密钥或环境变量。
安装前请注意
多个工具会修改项目文件:fix_vulnerable_packages、upgrade_packages_to_latest、update_package_version 以及按审查建议进行的加固会改动包版本和依赖图,接受前请先核对变更。遥测默认开启并发送给微软,可通过 DOTNET_CLI_TELEMETRY_OPTOUT 关闭。包元数据会从你配置的源获取。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Microsoft NuGet,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

NuGet MCP Server

Contains a Model Context Protocol (MCP) server for NuGet, enabling advanced tooling and automation scenarios for NuGet package management. See the official NuGet MCP documentation for the latest information.

Capabilities

  • Uses your configured NuGet feeds to get real-time information about packages.
  • Provides conservative remediation planning for packages with known vulnerabilities, including transitive dependencies.
  • Provides package upgrade planning based on a project's package graph and target frameworks.
  • Reviews your repository's NuGet supply-chain posture (Central Package Management, NuGet Audit, Package Source Mapping, and NuGet.Config validity) and recommends hardening steps.

Requirements

To run the MCP server, you must have .NET 10 Preview 6 or later installed. This version of .NET adds a command, dnx, which is used to download, install, and run the MCP server from nuget.org.

To verify your .NET version, run the following command in your terminal:

bash
dotnet --info

Getting Started

To configure the NuGet MCP server, you will need to modify an mcp.json file or other configuration. The following table provides links to documentation for configuring MCP servers in different environments:

Visual Studio 2026

The NuGet MCP server ships in-box with Visual Studio 2026. You must enable it the first time in the GitHub Copilot chat tools menu.

If you'd like to use a newer version of the NuGet MCP server than the one included with Visual Studio, you can configure it with the following snippet and include it in your mcp.json:

jsonc
{  "servers": {    "nuget": {      "type": "stdio",      "command": "dnx",      "args": [ "NuGet.Mcp.Server", "--source", "https://api.nuget.org/v3/index.json", "--yes" ]    }  }}

If you'd like to use a specific version of the MCP server, you can specify it with package name like [email protected]:

jsonc
{  "servers": {    "nuget": {      "type": "stdio",      "command": "dnx",      "args": [ "[email protected]", "--source", "https://api.nuget.org/v3/index.json", "--yes" ]    }  }}

When configured this way, you will need to update the version as new releases become available.

See File locations for automatic discovery of MCP configuration for more information on the location of the appropriate mcp.json for you.

Visual Studio 2022

To configure the MCP server for use with Visual Studio 2022, make sure you have update 17.14 or later installed. Then use the following snippet and include it in your mcp.json:

jsonc
{  "servers": {    "nuget": {      "type": "stdio",      "command": "dnx",      "args": [ "NuGet.Mcp.Server", "--source", "https://api.nuget.org/v3/index.json", "--yes" ]    }  }}

If you'd like to use a specific version of the MCP server, you can specify it with package name like [email protected]:

jsonc
{  "servers": {    "nuget": {      "type": "stdio",      "command": "dnx",      "args": [ "[email protected]", "--source", "https://api.nuget.org/v3/index.json", "--yes" ]    }  }}

When configured this way, you will need to update the version as new releases become available.

See File locations for automatic discovery of MCP configuration for more information on the location of the appropriate mcp.json for you.

VS Code

To configure the NuGet MCP server in VS code, you can use the following badges to quickly install the MCP server:

[Install in VS Code] [Install in VS Code Insiders]

To manually configure the MCP server for use with Visual Studio or VS Code, use the following snippet and include it in your mcp.json:

jsonc
{  "servers": {    "nuget": {      "type": "stdio",      "command": "dnx",      "args": [ "NuGet.Mcp.Server", "--source", "https://api.nuget.org/v3/index.json", "--yes" ]    }  }}

If you'd like to use a specific version of the MCP server, you can specify it with package name like [email protected]:

jsonc
{  "servers": {    "nuget": {      "type": "stdio",      "command": "dnx",      "args": [ "[email protected]", "--source", "https://api.nuget.org/v3/index.json", "--yes" ]    }  }}

When configured this way, you will need to update the version as new releases become available.

See MCP configuration in VS Code for more information on the location of the appropriate mcp.json for you.

GitHub Copilot

You can also configure the MCP Server to work with GitHub Copilot as a Coding Agent in your repositories.

First, you need to add the MCP Server configuration in your Copilot Coding Agent:

json
{   "mcpServers": {    "NuGet": {      "type": "local",      "command": "dnx",      "args": ["NuGet.Mcp.Server", "--yes"],      "tools": ["*"],      "env": {}    }  } }

This will make all the MCP Server tools available, if you want specific tools you can list them in the "tools" parameter array.

You will also need to make sure Copilot installs .NET 10 Preview 6 or higher in order to have the command dnx and install the MCP Server.

.github/workflows/copilot-setup-steps.yml

yml
name: "Copilot Setup Steps"
# Automatically run the setup steps when they are changed to allow for easy validation, and# allow manual testing through the repository's "Actions" tabon:  workflow_dispatch:  push:    paths:      - .github/workflows/copilot-setup-steps.yml  pull_request:    paths:      - .github/workflows/copilot-setup-steps.yml
jobs:  # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.  copilot-setup-steps:    runs-on: ubuntu-latest
    # Set the permissions to the lowest permissions possible needed for your steps.    # Copilot will be given its own token for its operations.    permissions:      # If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.      contents: read
    # You can define any steps you want, and they will run before the agent starts.    # If you do not check out your code, Copilot will do this for you.    steps:      - name: Install .NET 10.x        uses: actions/setup-dotnet@v5        with:          dotnet-version: |            10.x          dotnet-quality: preview
      - name: dotnet --info        run: dotnet --info

Currently Supported Tools

  • fix_vulnerable_packages: Fixes known security vulnerabilities in NuGet dependencies by computing the smallest safe version changes.
  • upgrade_packages_to_latest: Upgrades NuGet packages to the latest compatible versions available from configured package sources.
  • get_latest_package_version: Returns the latest version of a NuGet package.
  • get_package_context: Returns the AGENTS.md context for a NuGet package when available; otherwise returns the package README.
  • update_package_version: Updates one or more NuGet packages to exact target versions while keeping the dependency graph compatible.
  • review_supply_chain_security: Reviews and recommends hardening steps for your repository's NuGet supply‑chain posture (eg, Central Package Management, NuGet Audit, Package Source Mapping, and NuGet.Config validation).

Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

Telemetry Configuration

Telemetry collection is on by default to help improve the product. This can be disabled, see Disabling All Telemetry section below for more details.

Disabling Telemetry Only

To disable Microsoft telemetry collection, set the environment variable DOTNET_CLI_TELEMETRY_OPTOUT to true or 1:

bash
export DOTNET_CLI_TELEMETRY_OPTOUT=true

Support

If you experience an issue with the NuGet MCP server or have any other feedback, please open an issue on the NuGet GitHub repository. Please provide the requested information in the issue template so that we can better understand and address your issue or suggestion.

No Warranty / Limitation of Liability

This software is provided "as is" without warranties or conditions of any kind, either express or implied. Microsoft shall not be liable for any damages arising from use, misuse, or misconfiguration of this software.

来源:mcp/README.md,提交 cc3c847

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:该软件包类型无法在沙箱中运行。

版本历史

2
  1. v1.4.23最新Oct 31, 2026
  2. v1.4.16Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。

其他 Microsoft 集成