Shiroman1990/mcp-tutorial
If you are the rightful owner of mcp-tutorial 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 document provides a comprehensive overview of a Model Context Protocol (MCP) server implementation, detailing its structure, features, and usage.
MCP Server Tutorial
This is a Model Context Protocol (MCP) server implementation that demonstrates how to create and expose tools through the MCP protocol.
Project Structure
MCPServer/
- The main server implementationProgram.cs
- Contains the server setup and tool implementations
Features
GreetingTools
- A simple tool that provides greeting functionalitySayHello
- A method that takes a name and returns a greeting message
Getting Started
-
Make sure you have .NET 9.0 installed
-
Clone this repository
-
Build the project:
dotnet build
-
Run the server:
dotnet run --project MCPServer/MCPServer.csproj
-
Test and explore the MCP server using the inspector:
npx @modelcontextprotocol/inspector dotnet run
This will start both the MCP server and the inspector interface, allowing you to:
- Browse available tools
- Test tool functions interactively
- View request and response data
- Debug tool interactions
Usage
The server exposes tools through the Model Context Protocol. You can interact with it using any MCP client that supports the protocol version 0.3.0-preview.4.
Available Tools
Greeting Tool
- Description: A tool for generating personalized greetings
- Methods:
SayHello(string name)
: Returns a greeting message for the given name
Dependencies
- Microsoft.Extensions.Hosting (9.0.8)
- ModelContextProtocol (0.3.0-preview.4)
- ModelContextProtocol.Server (0.3.0-preview.4)