AI models like Claude are powerful — but out of the box, they only know what they were trained on. They cannot access your database, call your APIs, or run your business logic.
Model Context Protocol (MCP) changes that. It is an open protocol by Anthropic that gives AI models a standard way to connect to external tools and services. Think of it as a universal plug — your .NET code becomes a tool that Claude can actually call in real time.
What We Build
In this tutorial, we build a Business Advisor MCP Server in C# .NET — a server that Claude Desktop connects to and uses to suggest real business ideas based on a user’s budget and interests.
The project covers:
• What MCP is and how it works (stdio transport, JSON-RPC under the hood)
• How Claude decides when to call your tool vs answer from its own knowledge
• Clean project structure — Models, Services, Tools, all separated properly
• The [McpServerTool] and [Description] attributes — and why Description is the most important thing you will write
• A critical gotcha with stdout vs stderr that breaks most first attempts
• Registering your server in Claude Desktop via claude_desktop_config.json
• Live demo — Claude calling your C# code in real time
Tech Stack
• .NET 9 Console App
• ModelContextProtocol NuGet SDK (official)
• Microsoft.Extensions.Hosting for DI and app lifetime
• Claude Desktop for local testing
No database, no HTTP server, no complex setup — just a clean console app that Claude talks to directly through stdio pipes.
Watch the Full Tutorial
Everything above is walked through step by step, with full code and a live demo at the end.
Build an MCP Server in C# .NET (Model Context Protocol) | Complete Beginner
Top comments (0)