-
Notifications
You must be signed in to change notification settings - Fork 6k
Add quickstart for minimal MCP Server using .NET and publish to NuGet #47007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
1. In a terminal window, install the `dotnet new mcpserver` template: | ||
|
||
```bash | ||
dotnet new install Microsoft.Extensions.AI.Templates::9.6.0-preview.2.25310.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: update to the correct package version
(we don't know it yet)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, the draft template is here: dotnet/extensions#6547
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to duplicate a lot of what's in the other MCP server quickstart. Can we combine them, or perhaps require the other one as a prerequisite of a quickstart that only deals with publishing the MCP server to NuGet?
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Joel Verhagen <[email protected]>
i'm not sure what the best approach is! either works. |
|
||
## Discover MCP servers on NuGet.org | ||
|
||
1. Search for your MCP Server package on [NuGet.org](https://www.nuget.org/packages?packagetype=mcpserver). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: add screenshots from NuGet.org
@alexwolfmsft, @timheuer, and I met and we decide to try merging the two documents. I have updated the PR accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for combining them, I like this better!
|
||
1. Update the tool code to use an environment variable. Add another tool method after the `GetRandomNumber` method in `Tools/RandomNumberTools.cs`: | ||
|
||
```csharp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put the code in a separate file and reference it like this?
:::code language="csharp" source="snippets/mcp-server/program.cs" ::: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gewarren will do! I will put just the method (as I have here) not the whole file and see how it looks. LMK if that's wrong.
|
||
:::image type="content" source="../media/mcp/available-tools.png" alt-text="A screenshot showing the available MCP tools."::: | ||
1. Select the **Select tools** icon to verify your **SampleMcpServer** is available with the sample tool listed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the get random number tool installed with the template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Summary
Adds a quickstart of creating a minimal MCP server with a predefined
mcpserver
template, consuming it locally, and publishing it to NuGet and consuming it from the package ID as well usingdotnet tool exec
.Internal previews