MCP Server with .Net — DeepSeek Blog | Neura Market
    Neura MarketNeura Market/DeepSeek
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityDeepSeekDeepSeek
    CoPilotCoPilotStable DiffusionStable DiffusionMidjourneyMidjourney
    View All Directories
    OverviewRulesPromptsMCPsAgentsBlogVideosGuidesCoursesCommunityTrendingGenerate
    DeepSeekBlogMCP Server with .Net
    Back to Blog
    MCP Server with .Net
    dotnet

    MCP Server with .Net

    Antonio Di Motta March 12, 2026
    0 views

    Building a MCP Server with C#

    --- title: MCP Server with .Net published: true description: Building a MCP Server with C# tags: dotnet,mcp,ai cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0kngrc72v2awjxz6qm6w.jpg # Use a ratio of 100:42 for best results. # published_at: 2026-03-12 21:50 +0000 --- With the [release 1.0 of the official ModelContextProtocol .Net SDK] (https://csharp.sdk.modelcontextprotocol.io), we are ready to make a MCP Server fully compliant with MCP specs and entirely in C#. As usually when I need to learn new stuffs I develop a simple demo around a real scenario. For the MCP Server I thought to build one for managing some data like customers, products and orders stored into a Postgres database. The MCP server provides the data on behalf of user prompt like: ```shell give me the customer list tell me the most expensive order how many USB-C Hub has been ordered ? give me the customer list without orders suggest a new product for the customer Jane Smith add new order ..... ``` The most important feature of MCP Server is the tool as function able to do something. Below an example of tool: ```cs [McpServerTool(Name = "GetCustomer"), Description("Retrieve a single customer from the database.")] public static async Task<object> GetCustomer(AppDbContext db, CancellationToken ct, ILogger<MCPTool> logger, [Description("Full name of the customer to retrieve.")] string fullName ){ logger.LogDebug( $"Executing GetCustomer tool with full name : {fullName }" ); var query = db.Customers.AsNoTracking(); var result = await query.Where(c => (c.FirstName + " " + c.LastName) == fullName) .FirstOrDefaultAsync(ct); if (result == null) return $"Customer with full name {fullName} not found."; return result; } ``` The example shows how to help llm to recognize the right tool by using specific custom attributes [McpServerTool]. Another interesting feature is the prompt. I implemented one to create a model capable of handling requests that require more complex and detailed context for responses. Here an example: ```cs [McpServerPrompt, Description("Generate product suggestion for new order prompt")] public static IEnumerable<ChatMessage> SuggestProductByCustomer( [Description("Full name of the customer")] string fullName ) { return [ new(ChatRole.System, "You are an assistant for an e-commerce platform. You help customers find products based on their preferences and past purchases."), new(ChatRole.User, $"Please suggest products for the customer with full name: {fullName}"), new(ChatRole.Assistant, "To suggest products for the customer, I will need to look up their past purchases and preferences in the database. I will use the GetCustomer and GetOrders tools to retrieve this information and then analyze it to find suitable product suggestions.") ]; } ``` The entire demo is available [here](https://github.com/antdimot/aiworkshop/tree/main/session3/mcpserver). It contains a dev setup environment which able to spin up quickly the Postgres database with already some test data. happy coding!

    Tags

    dotnetmcpai

    Comments

    More Blog

    View all
    How I'm using ASTs and Gemini to solve the "Codebase Onboarding" problem 🧠ai

    How I'm using ASTs and Gemini to solve the "Codebase Onboarding" problem 🧠

    Hi everyone! 👋 I’m Tara, a Senior Software Engineer and Consultant. Over the years, I've jumped...

    T
    tworrell
    Local AI Will Save Us All (The Math Says So, Trust Me)ai

    Local AI Will Save Us All (The Math Says So, Trust Me)

    Every few weeks a take goes viral in tech circles making the case for ditching cloud AI and running...

    S
    Sebastian Schürmann
    Lost in the AI Hype, I Started Smallai

    Lost in the AI Hype, I Started Small

    And it helped me get back into tech without drowning TL;DR at the end Coming back to...

    R
    Rohini Gaonkar
    Building a Replay-Tested Interactive Brokers Client in Gogo

    Building a Replay-Tested Interactive Brokers Client in Go

    I wanted an IBKR library that felt like Go and had testing I could trust. So I wrote one.

    T
    Thomas Marcelis
    Playwright in Pictures: Fully Parallel Modeplaywright

    Playwright in Pictures: Fully Parallel Mode

    Playwright’s fullyParallel mode is often treated as a simple performance switch. In practice, it...

    V
    Vitaliy Potapov
    Designing a CLI for Both Humans and Agentscli

    Designing a CLI for Both Humans and Agents

    Learn how Alpic designed its CLI for both human developers and AI agents — covering tradeoffs like polling, context windows, interactivity, and statelessness.

    J
    Julien Vallini

    Stay up to date

    Get the latest DeepSeek prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for DeepSeek and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Guides

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.