The previous example shows how to use a local .NET project with the stdio type. And how to run the server locally in a container. This is a good solution in many situations. However, it can be useful to have the server running remotely, like in a cloud environment. This is where the http type comes in.
Looking at the solution in the 04-PracticalImplementation folder, it may look much more complex than the previous one. But in reality, it is not. If you look closely to the project src/Calculator, you will see that it is mostly the same code as the previous example. The only difference is that we are using a different library ModelContextProtocol.AspNetCore to handle the HTTP requests. And we change the method IsPrime to make it private, just to show that you can have private methods in your code. The rest of the code is the same as before.
The other projects are from .NET Aspire. Having .NET Aspire in the solution will improve the experience of the developer while developing and testing and help with observability. It is not required to run the server, but it is a good practice to have it in your solution.
-
From VS Code (with the C# DevKit extension), navigate down to the
04-PracticalImplementation/samples/csharpdirectory. -
Execute the following command to start the server:
dotnet watch run --project ./src/AppHost
-
When a web browser opens the .NET Aspire dashboard, note the
httpURL. It should be something likehttp://localhost:5058/.
If you have Node.js 22.7.5 and higher, you can use the MCP Inspector to test your server.
Start the server and run the following command in a terminal:
npx @modelcontextprotocol/inspector http://localhost:5058- Select the
Streamable HTTPas the Transport type. - In the Url field, enter the URL of the server noted earlier, and append
/mcp. It should behttp(nothttps) something likehttp://localhost:5058/mcp. - select the Connect button.
A nice thing about the Inspector is that it provide a nice visibility on what is happening.
- Try listing the available tools
- Try some of them, it should works just like before.
To use the Streamable HTTP transport with GitHub Copilot Chat, change the configuration of the calc-mcp server created previously to look like this:
Do some tests:
- Ask for "3 prime numbers after 6780". Note how Copilot will use the new tools
NextFivePrimeNumbersand only return the first 3 prime numbers. - Ask for "7 prime numbers after 111", to see what happens.
- Ask for "John has 24 lollies and wants to distribute them all to his 3 kids. How many lollies does each kid have?", to see what happens.
Let's deploy the server to Azure so more people can use it.
From a terminal, navigate to the folder 04-PracticalImplementation/samples/csharp and run the following command:
azd upOnce the deployment is over, you should see a message like this:
Grab the URL and use it in the MCP Inspector and in the GitHub Copilot Chat.
// .vscode/mcp.json
{
"servers": {
"calc-mcp": {
"type": "http",
"url": "https://calc-mcp.gentleriver-3977fbcf.australiaeast.azurecontainerapps.io/mcp"
}
}
}We try different transport types and testing tools. We also deploy your MCP server to Azure. But what if our server needs to access to private resources? For example, a database or a private API? In the next chapter, we will see how we can improve the security of our server.


