Skip to content

Commit 39695e5

Browse files
authored
Add instructions on configuring the NuGet MCP server for GitHub Copilot agent (#3497)
1 parent d7b9943 commit 39695e5

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

docs/concepts/NuGet-MCP-Server.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,84 @@ To verify that the MCP server is working correctly, open the GitHub Copilot Chat
7373
Then click the Tools icon in the bottom toolbar to bring up the Tools menu.
7474
You should see the MCP server named "nuget" in the list of available servers.
7575

76+
## Getting started in GitHub Copilot Agent
77+
78+
You can also configure the MCP Server to work with GitHub Copilot as a Coding Agent in your repositories.
79+
Ensure that you configured your repository to use [GitHub Copilot Coding Agents](https://github.com/settings/copilot/coding_agent).
80+
81+
Browse to your repository and click the Settings tab.
82+
Expand the Copilot section and click on Coding Agents.
83+
84+
![GitHub Copilot coding agent settings](./media/github-copilot-agent-settings.png)
85+
86+
Scroll down to the **Model Context Protocol (MCP)** section and add the following JSON snippet to your `mcpServers` configuration:
87+
88+
```json
89+
{
90+
"mcpServers": {
91+
"NuGet": {
92+
"type": "local",
93+
"command": "dnx",
94+
"args": ["NuGet.Mcp.Server", "--yes"],
95+
"tools": ["*"],
96+
"env": {}
97+
}
98+
}
99+
}
100+
```
101+
102+
This will make all of NuGet's MCP server tools available. If you want specific tools, you can list them in the `"tools"` parameter array.
103+
104+
Finally, click the **Save MCP configuration** button to save your changes.
105+
106+
Now that the NuGet MCP is configured, you will also need to create a GitHub Actions workflow to install .NET 10 Preview 6 or higher so that the `dnx` command is available to run the MCP server.
107+
You can do this by creating the following workflow file in your repository at
108+
109+
`.github/workflows/copilot-setup-steps.yml`
110+
111+
The contents of this workflow file should be as follows:
112+
113+
```yml
114+
name: "Copilot Setup Steps"
115+
116+
# Automatically run the setup steps when they are changed to allow for easy validation, and
117+
# allow manual testing through the repository's "Actions" tab
118+
on:
119+
workflow_dispatch:
120+
push:
121+
paths:
122+
- .github/workflows/copilot-setup-steps.yml
123+
pull_request:
124+
paths:
125+
- .github/workflows/copilot-setup-steps.yml
126+
127+
jobs:
128+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
129+
copilot-setup-steps:
130+
runs-on: ubuntu-latest
131+
132+
# Set the permissions to the lowest permissions possible needed for your steps.
133+
# Copilot will be given its own token for its operations.
134+
permissions:
135+
# 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.
136+
contents: read
137+
138+
# You can define any steps you want, and they will run before the agent starts.
139+
# If you do not check out your code, Copilot will do this for you.
140+
steps:
141+
- name: Install .NET 10.x
142+
uses: actions/setup-dotnet@v5
143+
with:
144+
dotnet-version: |
145+
10.x
146+
dotnet-quality: preview
147+
148+
- name: dotnet --info
149+
run: dotnet --info
150+
```
151+
152+
This will ensure that the `dnx` command is available to run the NuGet MCP server when GitHub Copilot runs as a coding agent in your repository.
153+
76154
## Fixing package vulnerabilities
77155

78156
The NuGet MCP server can help you identify and fix package vulnerabilities in your project.
3.68 KB
Loading

0 commit comments

Comments
 (0)