To Solve this use case, we will utilize .Net project library with MCP standards included.
For example purpose, i will create below endpoints
8. Go to /start-server to trigger the MCP server to initiate locally
9. Now call the tool as /call-tool to trigger the endpoint and pass the payload as
10. Now your MCP server tool setup is ready to consume by other agents as hello world example.
For example purpose, i will create below endpoints
Endpoints
1) GET /hello
Description: Returns default greeting.
Body (JSON): { "message": "Hello, World!" }
2) GET /hello/{name}
Description: Returns greeting for provided name.
Path param: name (string)
Body (JSON): { "message": "Hello, {name}!" }
3) POST /hello
Description: Returns greeting using provided JSON payload.
Request body (JSON): { "name": "<string>" }
Body (JSON): { "message": "Hello, <string>!" }
Example validation: if name missing or empty return 400 Bad Request with { "error": "name is required" }
Steps to Create Project:
1. Go to Visual Studio Developer command and Type below command to add .Net core project template
dotnet new install Microsoft.McpServer.ProjectTemplates
dotnet new install Microsoft.McpServer.ProjectTemplates
2. Go to Visual Studio IDE and add new project then select "MCP server App" as template then complete project creation
3. Open Github Copilot using your credentials, type the prompt as below "Convert this project as MCP Server and MCP Tool based for the Hello World Sample usage for below endpoints
Additionally add new web project as MCP client to consume these endpoints"
4. Wait for some time the project would have been ready with Github. If there are any build errors or correction, you can keep continue with Github copilot in chat. Note: choose options as Agent and your preferred model to get code generated automatically.
5. Go to Project solution and add existing project, you should see in same folder other projects would have been added. Include those into solution, so now you can see API project for MCP server, Web Project for MCP Client
Endpoints
1) GET /hello
Description: Returns default greeting.
Body (JSON): { "message": "Hello, World!" }
2) GET /hello/{name}
Description: Returns greeting for provided name.
Path param: name (string)
Body (JSON): { "message": "Hello, {name}!" }
3) POST /hello
Description: Returns greeting using provided JSON payload.
Request body (JSON): { "name": "<string>" }
Body (JSON): { "message": "Hello, <string>!" }.Additionally add new web project as MCP client to consume these endpoints"
4. Wait for some time the project would have been ready with Github. If there are any build errors or correction, you can keep continue with Github copilot in chat. Note: choose options as Agent and your preferred model to get code generated automatically.
5. Go to Project solution and add existing project, you should see in same folder other projects would have been added. Include those into solution, so now you can see API project for MCP server, Web Project for MCP Client
7. Now we can call the /tools to see existing endpoint, hello_world is the one we created
9. Now call the tool as /call-tool to trigger the endpoint and pass the payload as
{
"toolName": "hello_world",
"parameters": "balaji"
}
you will see the output as
{
"result": "Hello, balaji!"
}