Get the FREE Ultimate OpenClaw Setup Guide →

McpClientServerDemo

A simple MCP Server & Client example with mcp.json config

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio egorbo-mcpclientserverdemo dotnet run --project McpClientServerDemo.Server/McpClientServerDemo.Server.csproj \
  --env MCP_LOG_LEVEL="Information" \
  --env ASPNETCORE_URLS="http://0.0.0.0:5000"

How to use

McpClientServerDemo provides a simple MCP server and client example focused on a YouTube subtitles extractor. The server runs as a minimal ASP.NET API using Server-Sent Events to stream results to clients, and the client (a console app) can request the extractor functionality via the MCP protocol defined in mcp.json. To use it, start the server with the provided mcp_config mapping, then configure your mcp.json to include the YoutubeSubtitlesExtractor entry so clients can call the extractor by name. The server exposes a function that accepts a YouTube video reference and returns the extracted subtitles, suitable for downstream tasks like transcript generation or sentiment analysis. The demo also illustrates how a client can compose prompts that request subtitles data alongside other capabilities.

How to install

Prerequisites:

  • .NET SDK (recommended version compatible with the server project)
  • Basic familiarity with MCP and mcp.json configuration

Steps:

  1. Clone the repository or download the MCP Client Server Demo package.
  2. Restore and build the server project: dotnet restore McpClientServerDemo.Server/McpClientServerDemo.Server.csproj dotnet build McpClientServerDemo.Server/McpClientServerDemo.Server.csproj
  3. Ensure required environment variables are set (see mcp_config for examples). Common variables include:
    • ASPNETCORE_URLS (e.g., http://0.0.0.0:5000)
    • MCP_LOG_LEVEL (optional, e.g., Information or Debug)
  4. Start the server (using the command defined in mcp_config): dotnet run --project McpClientServerDemo.Server/McpClientServerDemo.Server.csproj
  5. Prepare your client configuration (mcp.json) to reference the YoutubeSubtitlesExtractor server by name and point at the server endpoint.
  6. Run the client application and invoke the extractor via the MCP protocol.

Note: The demo is self-contained for quick experiments but may require adapting paths and endpoints to your environment.

Additional notes

Tips and caveats:

  • The server uses Server-Sent Events (SSE); ensure clients support streaming responses if you rely on progressive results.
  • If you customize the server port, update ASPNETCORE_URLS in either the environment or launch settings accordingly.
  • The mcp.json should align with the server name defined in mcp_config (here, YoutubeSubtitlesExtractor).
  • When testing, you can send a prompt that asks for subtitles for a specific YouTube video, verify that the extractor returns textual subtitles in a consumable format, and then pipe or post-process as needed.
  • If you encounter connection issues, check firewall rules and that the server process has permission to listen on the configured port.
  • Logs can be elevated by setting MCP_LOG_LEVEL to Debug during troubleshooting.

Related MCP Servers

Sponsor this space

Reach thousands of developers