Skip to content

Commit dfd77b9

Browse files
Copilottimheuerjeffhandleyjoelverhagen
authored
Update MCP server template readme to show both VS Code and Visual Studio notes (#6591)
* Initial plan * Add VS IDE-specific README and update template configuration Co-authored-by: timheuer <[email protected]> * Update to single README with both VS Code and Visual Studio sections Co-authored-by: jeffhandley <[email protected]> * Fix Visual Studio MCP documentation URL Co-authored-by: timheuer <[email protected]> * Fix Visual Studio MCP JSON configuration format Co-authored-by: timheuer <[email protected]> * Restructure README to reduce repetition between VS Code and Visual Studio sections Co-authored-by: jeffhandley <[email protected]> * Eliminate repetitive JSON configuration in README by consolidating server definitions Co-authored-by: jeffhandley <[email protected]> * Revise the mcp server template README * Update MCP template README paths and sync snapshot with source template Co-authored-by: joelverhagen <[email protected]> * Update mcpserver project template baseline * Bump MEAI.Templates package to preview.3. * Add feedback survey to mcpserver project template README --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: timheuer <[email protected]> Co-authored-by: jeffhandley <[email protected]> Co-authored-by: Jeff Handley <[email protected]> Co-authored-by: joelverhagen <[email protected]>
1 parent fcd0c18 commit dfd77b9

File tree

3 files changed

+91
-81
lines changed

3 files changed

+91
-81
lines changed

src/ProjectTemplates/Microsoft.Extensions.AI.Templates/Microsoft.Extensions.AI.Templates.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<PackageTags>dotnet-new;templates;ai</PackageTags>
88

99
<Stage>preview</Stage>
10-
<PreReleaseVersionIteration>2</PreReleaseVersionIteration>
10+
<PreReleaseVersionIteration>3</PreReleaseVersionIteration>
1111
<Workstream>AI</Workstream>
1212
<MinCodeCoverage>0</MinCodeCoverage>
1313
<MinMutationScore>0</MinMutationScore>
Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# MCP Server
22

3-
This README was created using the C# MCP server template project. It demonstrates how you can easily create an MCP server using C# and then package it in a NuGet package.
3+
This README was created using the C# MCP server project template. It demonstrates how you can easily create an MCP server using C# and publish it as a NuGet package.
44

55
See [aka.ms/nuget/mcp/guide](https://aka.ms/nuget/mcp/guide) for the full guide.
66

7+
Please note that this template is currently in an early preview stage. If you have feedback, please take a [brief survey](http://aka.ms/dotnet-mcp-template-survey).
8+
79
## Checklist before publishing to NuGet.org
810

911
- Test the MCP server locally using the steps below.
@@ -14,67 +16,70 @@ See [aka.ms/nuget/mcp/guide](https://aka.ms/nuget/mcp/guide) for the full guide.
1416

1517
The `bin/Release` directory will contain the package file (.nupkg), which can be [published to NuGet.org](https://learn.microsoft.com/nuget/nuget-org/publish-a-package).
1618

17-
## Using the MCP Server in VS Code
19+
## Developing locally
1820

19-
Once the MCP server package is published to NuGet.org, you can use the following VS Code user configuration to download and install the MCP server package. See [Use MCP servers in VS Code (Preview)](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for more information about using MCP servers in VS Code.
21+
To test this MCP server from source code (locally) without using a built MCP server package, you can configure your IDE to run the project directly using `dotnet run`.
2022

2123
```json
2224
{
23-
"mcp": {
24-
"servers": {
25-
"McpServer-CSharp": {
26-
"type": "stdio",
27-
"command": "dnx",
28-
"args": [
29-
"<your package ID here>",
30-
"--version",
31-
"<your package version here>",
32-
"--yes"
33-
]
34-
}
25+
"servers": {
26+
"McpServer-CSharp": {
27+
"type": "stdio",
28+
"command": "dotnet",
29+
"args": [
30+
"run",
31+
"--project",
32+
"<PATH TO PROJECT DIRECTORY>"
33+
]
3534
}
3635
}
3736
}
3837
```
3938

40-
Now you can ask Copilot Chat for a random number, for example, `Give me 3 random numbers`. It should prompt you to use the `get_random_number` tool on the `McpServer-CSharp` MCP server and show you the results.
39+
## Testing the MCP Server
40+
41+
Once configured, you can ask Copilot Chat for a random number, for example, `Give me 3 random numbers`. It should prompt you to use the `get_random_number` tool on the `McpServer-CSharp` MCP server and show you the results.
42+
43+
## Publishing to NuGet.org
44+
45+
1. Run `dotnet pack -c Release` to create the NuGet package
46+
2. Publish to NuGet.org with `dotnet nuget push bin/Release/*.nupkg --api-key <your-api-key> --source https://api.nuget.org/v3/index.json`
47+
48+
## Using the MCP Server from NuGet.org
4149

42-
## Developing locally in VS Code
50+
Once the MCP server package is published to NuGet.org, you can configure it in your preferred IDE. Both VS Code and Visual Studio use the `dnx` command to download and install the MCP server package from NuGet.org.
4351

44-
To test this MCP server from source code (locally) without using a built MCP server package, create a `.vscode/mcp.json` file (a VS Code workspace settings file) in your project directory and add the following configuration:
52+
- **VS Code**: Create a `<WORKSPACE DIRECTORY>/.vscode/mcp.json` file
53+
- **Visual Studio**: Create a `<SOLUTION DIRECTORY>\.mcp.json` file
54+
55+
For both VS Code and Visual Studio, the configuration file uses the following server definition:
4556

4657
```json
4758
{
4859
"servers": {
4960
"McpServer-CSharp": {
5061
"type": "stdio",
51-
"command": "dotnet",
62+
"command": "dnx",
5263
"args": [
53-
"run",
54-
"--project",
55-
"<RELATIVE PATH TO PROJECT DIRECTORY>"
64+
"<your package ID here>",
65+
"--version",
66+
"<your package version here>",
67+
"--yes"
5668
]
5769
}
5870
}
5971
}
6072
```
6173

62-
Alternatively, you can configure your VS Code user settings to use your local project:
74+
## More information
6375

64-
```json
65-
{
66-
"mcp": {
67-
"servers": {
68-
"McpServer-CSharp": {
69-
"type": "stdio",
70-
"command": "dotnet",
71-
"args": [
72-
"run",
73-
"--project",
74-
"<FULL PATH TO PROJECT DIRECTORY>"
75-
]
76-
}
77-
}
78-
}
79-
}
80-
```
76+
.NET MCP servers use the [ModelContextProtocol](https://www.nuget.org/packages/ModelContextProtocol) C# SDK. For more information about MCP:
77+
78+
- [Official Documentation](https://modelcontextprotocol.io/)
79+
- [Protocol Specification](https://spec.modelcontextprotocol.io/)
80+
- [GitHub Organization](https://github.com/modelcontextprotocol)
81+
82+
Refer to the VS Code or Visual Studio documentation for more information on configuring and using MCP servers:
83+
84+
- [Use MCP servers in VS Code (Preview)](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)
85+
- [Use MCP servers in Visual Studio (Preview)](https://learn.microsoft.com/visualstudio/ide/mcp-servers)
Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# MCP Server
22

3-
This README was created using the C# MCP server template project. It demonstrates how you can easily create an MCP server using C# and then package it in a NuGet package.
3+
This README was created using the C# MCP server project template. It demonstrates how you can easily create an MCP server using C# and publish it as a NuGet package.
44

55
See [aka.ms/nuget/mcp/guide](https://aka.ms/nuget/mcp/guide) for the full guide.
66

7+
Please note that this template is currently in an early preview stage. If you have feedback, please take a [brief survey](http://aka.ms/dotnet-mcp-template-survey).
8+
79
## Checklist before publishing to NuGet.org
810

911
- Test the MCP server locally using the steps below.
@@ -14,67 +16,70 @@ See [aka.ms/nuget/mcp/guide](https://aka.ms/nuget/mcp/guide) for the full guide.
1416

1517
The `bin/Release` directory will contain the package file (.nupkg), which can be [published to NuGet.org](https://learn.microsoft.com/nuget/nuget-org/publish-a-package).
1618

17-
## Using the MCP Server in VS Code
19+
## Developing locally
1820

19-
Once the MCP server package is published to NuGet.org, you can use the following VS Code user configuration to download and install the MCP server package. See [Use MCP servers in VS Code (Preview)](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for more information about using MCP servers in VS Code.
21+
To test this MCP server from source code (locally) without using a built MCP server package, you can configure your IDE to run the project directly using `dotnet run`.
2022

2123
```json
2224
{
23-
"mcp": {
24-
"servers": {
25-
"mcpserver": {
26-
"type": "stdio",
27-
"command": "dnx",
28-
"args": [
29-
"<your package ID here>",
30-
"--version",
31-
"<your package version here>",
32-
"--yes"
33-
]
34-
}
25+
"servers": {
26+
"mcpserver": {
27+
"type": "stdio",
28+
"command": "dotnet",
29+
"args": [
30+
"run",
31+
"--project",
32+
"<PATH TO PROJECT DIRECTORY>"
33+
]
3534
}
3635
}
3736
}
3837
```
3938

40-
Now you can ask Copilot Chat for a random number, for example, `Give me 3 random numbers`. It should prompt you to use the `get_random_number` tool on the `mcpserver` MCP server and show you the results.
39+
## Testing the MCP Server
40+
41+
Once configured, you can ask Copilot Chat for a random number, for example, `Give me 3 random numbers`. It should prompt you to use the `get_random_number` tool on the `mcpserver` MCP server and show you the results.
42+
43+
## Publishing to NuGet.org
44+
45+
1. Run `dotnet pack -c Release` to create the NuGet package
46+
2. Publish to NuGet.org with `dotnet nuget push bin/Release/*.nupkg --api-key <your-api-key> --source https://api.nuget.org/v3/index.json`
47+
48+
## Using the MCP Server from NuGet.org
4149

42-
## Developing locally in VS Code
50+
Once the MCP server package is published to NuGet.org, you can configure it in your preferred IDE. Both VS Code and Visual Studio use the `dnx` command to download and install the MCP server package from NuGet.org.
4351

44-
To test this MCP server from source code (locally) without using a built MCP server package, create a `.vscode/mcp.json` file (a VS Code workspace settings file) in your project directory and add the following configuration:
52+
- **VS Code**: Create a `<WORKSPACE DIRECTORY>/.vscode/mcp.json` file
53+
- **Visual Studio**: Create a `<SOLUTION DIRECTORY>\.mcp.json` file
54+
55+
For both VS Code and Visual Studio, the configuration file uses the following server definition:
4556

4657
```json
4758
{
4859
"servers": {
4960
"mcpserver": {
5061
"type": "stdio",
51-
"command": "dotnet",
62+
"command": "dnx",
5263
"args": [
53-
"run",
54-
"--project",
55-
"<RELATIVE PATH TO PROJECT DIRECTORY>"
64+
"<your package ID here>",
65+
"--version",
66+
"<your package version here>",
67+
"--yes"
5668
]
5769
}
5870
}
5971
}
6072
```
6173

62-
Alternatively, you can configure your VS Code user settings to use your local project:
74+
## More information
6375

64-
```json
65-
{
66-
"mcp": {
67-
"servers": {
68-
"mcpserver": {
69-
"type": "stdio",
70-
"command": "dotnet",
71-
"args": [
72-
"run",
73-
"--project",
74-
"<FULL PATH TO PROJECT DIRECTORY>"
75-
]
76-
}
77-
}
78-
}
79-
}
80-
```
76+
.NET MCP servers use the [ModelContextProtocol](https://www.nuget.org/packages/ModelContextProtocol) C# SDK. For more information about MCP:
77+
78+
- [Official Documentation](https://modelcontextprotocol.io/)
79+
- [Protocol Specification](https://spec.modelcontextprotocol.io/)
80+
- [GitHub Organization](https://github.com/modelcontextprotocol)
81+
82+
Refer to the VS Code or Visual Studio documentation for more information on configuring and using MCP servers:
83+
84+
- [Use MCP servers in VS Code (Preview)](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)
85+
- [Use MCP servers in Visual Studio (Preview)](https://learn.microsoft.com/visualstudio/ide/mcp-servers)

0 commit comments

Comments
 (0)