mcp-tutorial

Shiroman1990/mcp-tutorial

3.2

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.

Tools
1
Resources
0
Prompts
0

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 implementation
    • Program.cs - Contains the server setup and tool implementations

Features

  • GreetingTools - A simple tool that provides greeting functionality
    • SayHello - A method that takes a name and returns a greeting message

Getting Started

  1. Make sure you have .NET 9.0 installed

  2. Clone this repository

  3. Build the project:

    dotnet build
    
  4. Run the server:

    dotnet run --project MCPServer/MCPServer.csproj
    
  5. 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)