MCPServerTest

aarthiem/MCPServerTest

3.2

If you are the rightful owner of MCPServerTest and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This guide provides a comprehensive overview of building a Model Context Protocol (MCP) server using the C# SDK, aimed at educational purposes.

Tools
3
Resources
0
Prompts
0

Build your MCP Server using C# SDK

This repo is for educational purposes to explore how to create your own MCP server using C# SDK.

image

Official MSFT blog

Steps to build

This is a simple .NET console application that builds a MCP server with 3 simple methods namely to return echo, reverse, length of the input string. This project is based on the sample explained in Introduction to the C# SDK for Model Context Protocol (MCP)

To build MCP server using c# SDK, follow the below steps

  • Create a .NET console application
  • Add Nuget packages Microsoft.Extensions.Hosting and ModelContextProtocol
  • To expose your method as MCP tool decorate it with attribute [McpServerToolType] and provide clear description so the LLM can decide which tool to invoke
  • Build the project
  • Add mcp.json under .vscode folder to add new server. Add the server with the project location to run the dotnet command
  • Run your server now
  • Open GH Copilot Chat window and run it under Agent mode
  • Once the app is running, you can click on the Tools icon on the GH Copilot chat window.
  • Now you will see the three tools available

image

  • Use the GH copilot chat as the client and ask it to reverse a given string as below. This will invoke the reverse tool from the MCP server and return the result