You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ai/quickstarts/build-mcp-server.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Quickstart - Create a minimal MCP server and publish to NuGet
3
3
description: Learn to create and connect to a minimal MCP server using C# and publish it to NuGet.
4
-
ms.date: 07/02/2025
4
+
ms.date: 10/20/2025
5
5
ms.topic: quickstart
6
6
author: alexwolfmsft
7
7
ms.author: alexwolf
@@ -23,7 +23,7 @@ In this quickstart, you create a minimal Model Context Protocol (MCP) server usi
23
23
24
24
## Create the project
25
25
26
-
1. In a terminal window, install the MCP Server template (version 9.7.0-preview.2.25356.2 or newer):
26
+
1. In a terminal window, install the MCP Server template (version 9.10.0-preview.3.25513.3 or newer):
27
27
28
28
```bash
29
29
dotnet new install Microsoft.Extensions.AI.Templates
@@ -35,6 +35,8 @@ In this quickstart, you create a minimal Model Context Protocol (MCP) server usi
35
35
dotnet new mcpserver -n SampleMcpServer
36
36
```
37
37
38
+
By default, this command creates a self-contained tool package targeting all of the most common platforms that .NET is supported on. To see more options, use `dotnet new mcpserver --help`.
39
+
38
40
1. Navigate to the `SampleMcpServer` directory:
39
41
40
42
```bash
@@ -125,7 +127,7 @@ In this example, you enhance the MCP server to use a configuration value set in
125
127
"args": [
126
128
"run",
127
129
"--project",
128
-
"<RELATIVE PATH TO PROJECT DIRECTORY>"
130
+
"<relative-path-to-project-file>"
129
131
],
130
132
"env": {
131
133
"WEATHER_CHOICES": "sunny,humid,freezing"
@@ -145,13 +147,13 @@ In this example, you enhance the MCP server to use a configuration value set in
145
147
146
148
1. Update the `.mcp/server.json` to declare your environment variable input. The `server.json` file schema is defined by the [MCP Registry project](https://github.com/modelcontextprotocol/registry/blob/main/docs/reference/server-json/generic-server-json.md) and is used by NuGet.org to generate VS Code MCP configuration.
147
149
148
-
- Use the `environment_variables` property to declare environment variables used by your app that will be set by the client using the MCP server (for example, VS Code).
150
+
- Use the `environmentVariables` property to declare environment variables used by your app that will be set by the client using the MCP server (for example, VS Code).
149
151
150
-
- Use the `package_arguments` property to define CLI arguments that will be passed to your app. For more examples, see the [MCP Registry project](https://github.com/modelcontextprotocol/registry/blob/main/docs/reference/server-json/generic-server-json.md#examples).
152
+
- Use the `packageArguments` property to define CLI arguments that will be passed to your app. For more examples, see the [MCP Registry project](https://github.com/modelcontextprotocol/registry/blob/main/docs/reference/server-json/generic-server-json.md#examples).
The only information used by NuGet.org in the `server.json` is the first `packages` array item with the `registry_name` value matching `nuget`. The other top-level properties aside from the `packages` property are currently unused and are intended for the upcoming central MCP Registry. You can leave the placeholder values until the MCP Registry is live and ready to accept MCP server entries.
156
+
The only information used by NuGet.org in the `server.json` is the first `packages` array item with the `registryType` value matching `nuget`. The other top-level properties aside from the `packages` property are currently unused and are intended for the upcoming central MCP Registry. You can leave the placeholder values until the MCP Registry is live and ready to accept MCP server entries.
155
157
156
158
You can [test your MCP server again](#test-the-mcp-server) before moving forward.
157
159
@@ -163,12 +165,16 @@ You can [test your MCP server again](#test-the-mcp-server) before moving forward
163
165
dotnet pack -c Release
164
166
```
165
167
166
-
1. Publish the package to NuGet:
168
+
This command produces one tool package and several platform-specific packages based on the `<RuntimeIdentifiers>` list in `SampleMcpServer.csproj`.
Be sure to publish all `.nupkg` files to ensure every supported platform can run the MCP server.
177
+
172
178
If you want to test the publishing flow before publishing to NuGet.org, you can register an account on the NuGet Gallery integration environment: [https://int.nugettest.org](https://int.nugettest.org). The `push` command would be modified to:
0 commit comments