Skip to content

Add first MCP server sample in C# and .NET - #29

Merged
balajibashyam merged 3 commits into
mainfrom
feature/mcp-server-csharp-dotnet
Oct 6, 2026
Merged

balajibashyam merged 3 commits into
mainfrom
feature/mcp-server-csharp-dotnet

Conversation

@balajibashyam

Copy link
Copy Markdown
Contributor

Summary

Adds a verified .NET 10 companion sample for the
Build Your First MCP Server in C# and .NET tutorial.

What's included

  • New sample: dotnet-ai/mcp-server-csharp-dotnet/

    • ModelContextProtocol 2.2.0
    • stdio MCP server/client
    • exactly three read-only tools
    • dependency-injected deterministic JSON-backed stores
    • real MCP tool discovery and invocation
    • protocol-level unknown-tool rejection
    • McpClientTool -> AIFunction compatibility check
    • architecture and verification documentation
    • 13 deterministic tests
  • Root README

    • new sample row
    • run commands
    • corrected .NET AI repository-tree subsection with the MCP sample added
  • GitHub Actions

    • new test-mcp-server-csharp-dotnet job
    • sample path added to push and pull-request filters
    • deterministic restore/build/test/MCP stdio E2E only
    • no LLM or provider secret

Versions

  • Target framework: net10.0
  • SDK baseline: 10.0.401
  • ModelContextProtocol: 2.2.0
  • Microsoft.Extensions.Hosting: 10.0.12
  • xunit.v3.mtp-v2: 4.0.1

Local validation

  • Release build — PASS, 0 warnings / 0 errors
  • deterministic tests — PASS, 13/13
  • MCP stdio E2E — PASS
  • tool discovery — PASS, exactly 3
  • all three tool calls — PASS
  • unknown-tool rejection — PASS
  • targeted credential/private-path scan — clean
  • generated artifacts excluded from staging

Deliberately omitted

  • Agent Framework
  • LLM-driven tool selection
  • Streamable HTTP / remote MCP hosting
  • OAuth/authentication/authorization
  • MCP resources, prompts, sampling, elicitation, and tasks
  • write-capable/destructive tools
  • databases
  • RAG/vector search
  • multi-agent workflows
  • Docker/Kubernetes/cloud deployment
  • production-readiness claims

@balajibashyam
balajibashyam force-pushed the feature/mcp-server-csharp-dotnet branch from 31e2b68 to ffc681a Compare October 6, 2026 06:51
@balajibashyam
balajibashyam merged commit 7e4b75e into main Oct 6, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant