|
| 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 | + |
| 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 | + |
| 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 | +[]( |
| 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) [](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 | +>  |
| 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. |
0 commit comments