shlogg · Early preview
Mehran Davoudi @mehrandvd

Create A Simple MCP Server With C# And Test It In Cursor

Create a simple MCP Server with C# using official csharp-sdk. Install packages, write code, and run project. Test on Cursor by configuring MCP Server settings and calling tool.

In this post, I'll show you how to create a simple MCP Server and test it in Cursor.
For this tutorial, I'm using the official csharp-sdk, which is still in its early stages:

https://github.com/modelcontextprotocol/csharp-sdk

  
  
  1. Create a simple project

First, create an empty console project:

dotnet new console -n Tutorial.McpTimeServer

    
    

    
    




  
  
  2. Install packages

Install these 2 packages:

dotnet add package Microsoft.Extensions.Hosting
dotnet add package ModelContextProtocol --prerelease

    
    

    
    




  
  
  3. Write the code

Replace the Pr...