Last month, we announced support for building custom MCP servers with .NET and publishing them to NuGet. Building on that foundation, today we’re announcing the official NuGet MCP Server, which enables you to integrate real-time NuGet package information and management tools directly into your AI-powered development workflow.
What is an MCP Server?
The Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect to external data sources and tools. MCP servers act as bridges between AI assistants and various services, allowing for seamless integration and enhanced functionality.
Since the NuGet package ecosystem is always evolving, large language models (LLMs) get out-of-date over time and there is a need for something that assists them in getting information in realtime. The NuGet MCP server provides LLMs with information about new and updated packages that have been published after the models as well as tools to complete package management tasks. It also can connect to the feeds you have configured including private feeds, allowing for a more complete view of your packages. The NuGet MCP server utilizes an algorithm called NuGetSolver which was developed in collaboration with Microsoft Research which simplifies the process by automatically resolving NuGet dependency conflicts in your projects.
Getting Started
The NuGet MCP server is available as a NuGet package with the new functionality in the .NET ecosystem for implementing and releasing MCP servers.
Prerequisites
Before you can use the NuGet MCP server, you will need to have .NET 10 Preview 6 installed on your system. You can download it from the official .NET download page.
Configuration
To configure the NuGet MCP server, add the following configuration to your MCP client:
{
"servers": {
"nuget": {
"type": "stdio",
"command": "dnx",
"args": [
"NuGet.Mcp.Server",
"--prerelease",
"--yes"
]
}
}
}
Note: The MCP server on NuGet.org is in preview, so you’ll need to use the –prerelease flag to install it. This ensures you automatically get the latest preview versions as they’re released.
Using a Specific Version
If you prefer to use a specific version of the MCP server instead of automatically updating to the latest preview, you can specify the version exact version:
{
"servers": {
"nuget": {
"type": "stdio",
"command": "dnx",
"args": [
"NuGet.Mcp.Server@0.2.0-preview",
"--yes"
]
}
}
}
Current Capabilities
The NuGet MCP server currently supports the following functionality:
- Package Version Discovery: Determine the latest version of a package available on your configured feeds
- Security Updates: Update package vulnerabilities to the lowest compatible version that resolves security issues. This functionality will only update you to the lowest version that resolves the security issues, increasing the likelihood that the update will not break your project.
- Version Updates: Update package versions to the highest compatible version with your project’s target framework. Most tooling today that updates NuGet packages does not take into account a project’s target framework, which can causes updates to fail.
Integration with Development Tools
Visual Studio
To add the NuGet MCP server to Visual Studio, add the following to your .mcp.json
file next to a solution or at %UserProfile%\.mcp.json
:
{
"servers": {
"nuget": {
"type": "stdio",
"command": "dnx",
"args": [
"NuGet.Mcp.Server",
"--prerelease",
"--yes"
]
}
}
}
There are several places that Visual Studio looks for MCP server configurations, see File locations for automatic discovery of MCP configuration for more information.
When configured properly, the NuGet MCP server will automatically start and should look like this:
VS Code
The easiest way to add MCP servers to VS Code is to click one of the links below for your particular installation:
Altneratively, you can manually add the NuGet MCP server to your VS Code by adding the the following snippet to your .vscode/mcp.json
file:
{
"servers": {
"nuget": {
"type": "stdio",
"command": "dnx",
"args": [
"NuGet.Mcp.Server",
"--prerelease",
"--yes"
]
}
}
}
When configured properly, the NuGet MCP server will automatically start and should look like this:
GitHub Coding Agent
The GitHub Coding Agent can utilize the NuGet MCP server to assist with dependency management in your repositories, making it easier to maintain and update your projects’ package references. Since the NuGet MCP server requires .NET 10 SDK Preview 6 or greater, you’ll need to add the following file to your repository:
.github/workflows/copilot-setup-steps.yml
name: "Copilot Setup Steps"
on:
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
permissions:
contents: read
steps:
- name: Install .NET 10.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
10.x
dotnet-quality: preview
See Customizing the development environment for Copilot coding agent for more information.
To configure the NuGet MCP server, visit Settings -> Copilot -> Coding agent
in your repository and add this to your “MCP Configuration”
{
"mcpServers": {
"nuget": {
"command": "dnx",
"args": [
"NuGet.Mcp.Server",
"--prerelease",
"--yes"
],
"tools": ["*"],
"type": "local"
}
}
}
The configuration page should look like this:
Preview Status and Feedback
Note: This is a preview release of the NuGet MCP server. We’re actively building new features and improvements, and we’d love your feedback on how to make it more valuable to you. Your input will ensure the tool evolves to better meet the needs of the .NET development community.
Please file an issue on NuGet/Home with your thoughts, suggestions, or any issues you encounter.
0 comments
Be the first to start the discussion.