Skip to content

Commit 349136f

Browse files
authored
Add docs for NuGet MCP server (#3495)
1 parent 4a9e01f commit 349136f

File tree

6 files changed

+109
-0
lines changed

6 files changed

+109
-0
lines changed

docs/TOC.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
## [MSBuild .props and .targets](concepts/MSBuild-props-and-targets.md)
8080
## [Troubleshooting Installed Packages](concepts/troubleshooting-installed-packages.md)
8181
## [MCP servers in NuGet packages](concepts/nuget-mcp.md)
82+
## [Configuring the NuGet MCP Server](concepts/NuGet-MCP-Server.md)
8283
# Reference
8384
## [.nuspec](reference/nuspec.md)
8485
## [nuget.config file](reference/nuget-config-file.md)

docs/concepts/Auditing-Packages.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ If a known vulnerability exists in a top-level package's transitive dependencies
202202
- [Suppress the advisory](#excluding-advisories) until it can be addressed.
203203
- File an issue in the top-level package's tracker to request an update.
204204

205+
### Use Copilot to update packages
206+
NuGet has released a Model Context Protocol (MCP) server that has the ability to update packages in your project to versions that resolve known vulnerabilities.
207+
See [Fixing package vulnerabilities](NuGet-MCP-Server.md#fixing-package-vulnerabilities) for more information.
208+
205209
### Security vulnerabilities found with no updates
206210

207211
In the case that a known vulnerability exists in a package without a security fix, you can do the following.

docs/concepts/NuGet-MCP-Server.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
title: Using the NuGet Model Context Protocol (MCP) Server
3+
description: How to configure and use the NuGet Model Context Protocol (MCP) server.
4+
author: jeffkl
5+
ms.author: jeffkl
6+
ms.topic: conceptual
7+
ms.date: 10/01/2025
8+
---
9+
10+
# Using the NuGet Model Context Protocol (MCP) Server
11+
12+
## Requirements
13+
14+
To run the MCP server, you must have **[.NET 10 SDK or later](https://dotnet.microsoft.com/en-us/download/dotnet/10.0)** installed.
15+
This version of .NET adds a command, `dnx`, which is used to download, install, and run the MCP server from [nuget.org](https://nuget.org).
16+
17+
To verify your .NET version, run the following command in your terminal:
18+
```bash
19+
dotnet --info
20+
```
21+
22+
## Getting started in Visual Studio 2026
23+
24+
In Visual Studio 2026, the NuGet MCP server is built-in but must be enabled once in order to use its functionality.
25+
26+
To enable the NuGet MCP server, follow these steps:
27+
1. Open Visual Studio 2026.
28+
1. Open the GitHub Copilot Chat window and make sure you are signed in.
29+
1. Click the tools icon in the bottom toolbar to bring up the Tools menu.
30+
1. Find the MCP server named "nuget" and check the box to enable it.
31+
32+
![GitHub Copilot Chat Tools window in Visual Studio 2026](./media/copilot-tools-menu.png)
33+
34+
## Getting started in Visual Studio 2022
35+
36+
> [!NOTE]
37+
> You must have Visual Studio 2022 17.14 or later in order to configure an MCP server.
38+
39+
In Visual Studio 2022, you must manually add the NuGet MCP server to your configuration.
40+
There are several configuration files that Visual Studio 2022 uses to define MCP servers.
41+
See [Use MCP Servers](/visualstudio/ide/mcp-servers) for more information on which file to configure.
42+
43+
Once you have identified the correct configuration file, add the following JSON snippet to your `mcp.json`:
44+
```json
45+
{
46+
"servers": {
47+
"nuget": {
48+
"type": "stdio",
49+
"command": "dnx",
50+
"args": [ "NuGet.Mcp.Server", "--source", "https://api.nuget.org/v3/index.json", "--yes" ]
51+
}
52+
}
53+
}
54+
```
55+
56+
This will configure Visual Studio 2022 to use the latest version of the NuGet MCP server from nuget.org.
57+
To verify that the MCP server is working correctly, open the GitHub Copilot Chat window and make sure you are signed in.
58+
Then click the Tools icon in the bottom toolbar to bring up the Tools menu.
59+
You should see the MCP server named "nuget" in the list of available servers.
60+
61+
![GitHub Copilot Chat Tools window in Visual Studio 2022](./media/copilot-tools-menu-2022.png)
62+
63+
## Getting started in VS Code
64+
65+
To configure the NuGet MCP server in VS Code click the appropriate button below and it will be set up.
66+
67+
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](
68+
https://vscode.dev/redirect/mcp/install?name=NuGet&config=%7B%22name%22%3A%22NuGet.Mcp.Server%22%2C%22command%22%3A%22dnx%22%2C%22args%22%3A%5B%22NuGet.Mcp.Server%22%2C%22https%3A%2F%2Fapi.nuget.org%2Fv3%2Findex.json%22%2Cnull%2Cnull%5D%7D) [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect/mcp/install?name=NuGet&config=%7B%22name%22%3A%22NuGet.Mcp.Server%22%2C%22command%22%3A%22dnx%22%2C%22args%22%3A%5B%22NuGet.Mcp.Server%22%2C%22https%3A%2F%2Fapi.nuget.org%2Fv3%2Findex.json%22%2Cnull%2Cnull%5D%7D&quality=insiders)
69+
70+
> ![GitHub Copilot Chat Tools window in VS Code](./media/copilot-tools-menu-vs-code.png)
71+
72+
To verify that the MCP server is working correctly, open the GitHub Copilot Chat window and make sure you are signed in.
73+
Then click the Tools icon in the bottom toolbar to bring up the Tools menu.
74+
You should see the MCP server named "nuget" in the list of available servers.
75+
76+
## Fixing package vulnerabilities
77+
78+
The NuGet MCP server can help you identify and fix package vulnerabilities in your project.
79+
To use the MCP server to fix vulnerabilities, enter the following prompt in the GitHub Copilot Chat window:
80+
81+
> Fix my package vulnerabilities
82+
83+
The MCP server will analyze your project's dependencies and suggest updates to packages that have known vulnerabilities.
84+
85+
## Updating all packages
86+
87+
The NuGet MCP server can also update your packages to the latest compatible versions.
88+
To use the MCP server to update all packages, enter the following prompt in the GitHub Copilot Chat window:
89+
90+
> Update all my packages to the latest compatible versions
91+
92+
The MCP server will analyze your project's target framework(s) and suggest updates to the latest version of packages that are compatible with your project.
93+
94+
## Update a package to a specific version
95+
96+
The NuGet MCP server can update a specific package to a version you specify.
97+
To do so, enter the following prompt in the GitHub Copilot Chat window:
98+
99+
> Update the package [PackageName] to version [VersionNumber]
100+
101+
## Support
102+
103+
If you experience an issue with the NuGet MCP server or have any other feedback, please open an issue on the [NuGet GitHub repository](https://github.com/NuGet/Home/issues/new?template=MCPSERVER.yml).
104+
Please provide the requested information in the issue template so that we can better understand and address your issue or suggestion.
6.04 KB
Loading
42.9 KB
Loading
7.25 KB
Loading

0 commit comments

Comments
 (0)