.NET MCP Tutorial
This is a very basic example of how to create MCP servers in .NET
What is .NET MCP Tutorial?
.NET MCP Tutorial is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to this is a very basic example of how to create mcp servers in .net
This is a very basic example of how to create MCP servers in .NET
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- This is a very basic example of how to create MCP servers in
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx tutorial-mcp-server-dotnetConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use .NET MCP Tutorial
This repository is a minimal, educational MCP server built in .NET 9 / C# that demonstrates the complete pattern for exposing tools to AI clients like Claude or Cursor. It implements a single TimeTool that returns the current time, using the official ModelContextProtocol NuGet package and Microsoft.Extensions.Hosting for a production-grade server lifecycle.
Prerequisites
- .NET 9 SDK installed (dotnet --version shows 9.x)
- Node.js 18+ if using npx-based MCP clients
- Claude Desktop or Cursor IDE for testing
- Git to clone the repository
Clone the repository
Fetch the tutorial project from GitHub.
git clone https://github.com/mehrandvd/tutorial-mcp-server-dotnet.git
cd tutorial-mcp-server-dotnet/srcRestore NuGet packages
Restore the two dependencies: ModelContextProtocol (0.1.0-preview.6) and Microsoft.Extensions.Hosting (9.0.3).
dotnet restore Tutorial.McpTimeServer.slnBuild the project
Compile the C# source to verify everything is set up correctly before wiring it into an AI client.
dotnet build Tutorial.McpTimeServer.csproj -c ReleaseRun the server locally to test stdio transport
MCP servers communicate over stdio. Run the server directly to confirm it starts without errors. The server will block waiting for MCP input — press Ctrl+C to exit.
dotnet run --project Tutorial.McpTimeServer.csprojRegister with Claude Desktop
Add the server to your Claude Desktop config so it launches automatically. Use dotnet run as the command or point to the published binary.
{
"mcpServers": {
"dotnet-time-server": {
"command": "dotnet",
"args": ["run", "--project", "/absolute/path/to/src/Tutorial.McpTimeServer.csproj"]
}
}
}Study the TimeTool pattern to build your own tool
The entire tool is defined by decorating a class with [McpServerToolType] and methods with [McpServerTool]. This is the pattern to replicate for any new capability you want to expose.
[McpServerToolType]
public class TimeTool
{
[McpServerTool, Description("Gets the current time.")]
public static string GetCurrentTime() => DateTimeOffset.Now.ToString();
}.NET MCP Tutorial Examples
Client configuration
Claude Desktop configuration for the .NET MCP tutorial time server using dotnet run.
{
"mcpServers": {
"dotnet-time-server": {
"command": "dotnet",
"args": [
"run",
"--project",
"/Users/you/tutorial-mcp-server-dotnet/src/Tutorial.McpTimeServer.csproj"
]
}
}
}Prompts to try
After connecting the server, test the exposed tool with these prompts in Claude.
- "What is the current time?"
- "Use the GetCurrentTime tool and tell me what time it is"
- "What time zone does the server return times in?"Troubleshooting .NET MCP Tutorial
dotnet: command not found when Claude Desktop tries to start the server
Claude Desktop may not inherit your shell PATH. Provide the full path to dotnet (e.g., /usr/local/share/dotnet/dotnet) in the command field of claude_desktop_config.json.
Build fails with 'The type or namespace ModelContextProtocol could not be found'
Run 'dotnet restore' to download the ModelContextProtocol NuGet package. Confirm your global NuGet source includes nuget.org.
Server starts but Claude shows no tools available
Verify the server uses WithStdioServerTransport() and that the MCP config command/args launch the same binary. Check that no build errors silently prevented the WithTools<TimeTool>() registration.
Frequently Asked Questions about .NET MCP Tutorial
What is .NET MCP Tutorial?
.NET MCP Tutorial is a Model Context Protocol (MCP) server that this is a very basic example of how to create mcp servers in .net It connects AI assistants to external tools and data sources through a standardized interface.
How do I install .NET MCP Tutorial?
Follow the installation instructions on the .NET MCP Tutorial GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with .NET MCP Tutorial?
.NET MCP Tutorial works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is .NET MCP Tutorial free to use?
Yes, .NET MCP Tutorial is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
.NET MCP Tutorial Alternatives — Similar Developer Tools Servers
Looking for alternatives to .NET MCP Tutorial? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up .NET MCP Tutorial in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use .NET MCP Tutorial?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.