mcpField
B
Build your MCP Server using C# SDK

Build your MCP Server using C# SDK

Local
github.com/aarthiemDeveloper Tools0Updated 73w ago

About Build your MCP Server using C# SDK

An educational .NET console project showing how to create an MCP server with the C# SDK. Its three tools echo, reverse, and measure the length of an input string, and the README describes trying them through GitHub Copilot Chat.

Key features

  1. 01C# SDK server example
  2. 02Echo, reverse, and length tools
  3. 03.NET console application
  4. 04Tool exposure with attributes
  5. 05VS Code server configuration

Use cases

  1. 01Learning MCP server creation in C#
  2. 02Testing string tools through GitHub Copilot Chat

MCP support

The project exposes three string-processing methods as MCP tools. GitHub Copilot Chat in Agent mode can invoke them through the configured server.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

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
image

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.