McpClientServerDemo
A simple MCP Server & Client example with mcp.json config
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:
- Clone the repository or download the MCP Client Server Demo package.
- Restore and build the server project: dotnet restore McpClientServerDemo.Server/McpClientServerDemo.Server.csproj dotnet build McpClientServerDemo.Server/McpClientServerDemo.Server.csproj
- 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)
- Start the server (using the command defined in mcp_config): dotnet run --project McpClientServerDemo.Server/McpClientServerDemo.Server.csproj
- Prepare your client configuration (mcp.json) to reference the YoutubeSubtitlesExtractor server by name and point at the server endpoint.
- 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
mssql
MSSQL Server MCP implementation written in C#
McpDotNet.Extensions.SemanticKernel
Microsoft SemanticKernel integration for the Model Context Protocol (MCP). Enables seamless use of MCP tools as AI functions.
DatabaseMcpServer
MCP server from ttcc666/DatabaseMcpServer
mcp-dataverse
MCP Server for querying Dataverse using SQL
xperience-community
ASP.NET Core MCP server for Xperience by Kentico projects
console-to-http
Example of converting a stdio MCP server to HTTP using ModelContextProtocol.AspNetCore