Loading repository data…
Loading repository data…
srijanighosh87 / repository
This is a C#/.NET 9 demo showcasing the Model Context Protocol (MCP) with a client-server architecture using the MCPSharp library, where the client discovers and invokes tools exposed by the server.
This repository demonstrates a simple Model Context Protocol (MCP) server and client console implementation in .NET.
From the root directory:
dotnet build
cd Demo.McpServer
dotnet run
In a new terminal:
cd Demo.McpClient
dotnet run
MCP-Server-Client-Demo.sln
|
|-- Demo.McpServer/
| |-- Program.cs
| |-- ...
|
|-- Demo.McpClient/
|-- Program.cs
|-- ...
Both the server and client use the following NuGet package:
This package provides the core MCP protocol implementation for .NET.
+-------------------+ MCP Protocol +-------------------+
| | <-----------------------------> | |
| MCP Client | requests / responses / tools | MCP Server |
| (Demo.McpClient) | ==============================> | (Demo.McpServer) |
| | <============================== | |
+-------------------+ +-------------------+
Welcome to the MCP Client demo!
Available tool count: 1
First Available tool:
- Name: AddNumbers
- Description: Adds two numbers and returns the sum.
Tool call result: 30