Sandbox
@microsoft/mcp-dotnet-samples

.NET MCP server and client sample repo

This repository collects working examples of Model Context Protocol in .NET. The samples show how to build MCP servers and clients, and how to package them for use in editors like VS Code and Visual Studio.

196 starsβ€’63 forksβ€’C#β€’Updated 10d ago
Who it's for

Builders who want to learn MCP by reading and running .NET sample projects.

What it delivers

You can copy real MCP patterns into your own agent or tool setup instead of starting from scratch.

What it does

MCP server samples

Shows servers for markdown to HTML, Outlook email, to-do list actions, and Copilot customization retrieval.

Client and server examples

Includes samples for both creating MCP servers and using them from clients.

Azure-ready sample setup

Each sample includes Azure deployment files such as `azure.yaml` and `infra` folders where applicable.

Shared sample code

Common code is kept in `shared/McpSamples.Shared` for reuse across projects.

Editor install examples

The README includes install links for VS Code, VS Code Insiders, and Visual Studio for the packaged server samples.

README

Model Context Protocol .NET Samples

Microsoft Foundry Community Discord Microsoft Foundry Developer Forum

πŸš€ Introduction

Welcome to the Model Context Protocol (MCP) .NET Samples repository! This collection of samples demonstrates how to leverage the Model Context Protocol in .NET applications.

MCP is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). Think of MCP like a USB-C port for AI applications - it provides a standardized way to connect AI models to different data sources and tools.

With MCP, you can:

  • Utilize pre-built integrations that your LLM can directly plug into
  • Flexibly switch between LLM providers and vendors
  • Follow best practices for securing your data within your infrastructure
  • Build agents and complex workflows on top of LLMs

This repository contains .NET samples ranging from building your own MCP implementation to integrating with Azure services.

πŸ“‹ Sample Projects

Sample NameInstallDescription
Awesome CopilotInstall in VS Code
Install in VS Code Insiders
Install in Visual Studio
MCP server that retrieves GitHub Copilot customization files from awesome-copilot.
Markdown to HTMLInstall in VS Code
Install in VS Code Insiders
Install in Visual Studio
MCP server that converts markdown text to HTML.
Outlook EmailInstall in VS Code
Install in VS Code Insiders
Install in Visual Studio
MCP server that sends emails through Outlook.
To-do ListInstall in VS Code
Install in VS Code Insiders
Install in Visual Studio
MCP server that manages to-do list items.

πŸ› οΈ Getting Started

Details on how to set up and run the samples will be provided in each sample's directory.

πŸ“š Learning Resources

πŸšΆβ€β™€οΈ Next Steps

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Files in the repo

Repository payloadβ€’27 top-level entries
  • .devcontainer
  • .github
  • .vscode
  • awesome-copilot
  • markdown-to-html
  • outlook-email
  • shared
  • todo-list
  • .editorconfig
  • .gitattributes
  • .gitignore
  • AGENTS.md
  • CODE_OF_CONDUCT.md
  • Directory.Build.props
  • Dockerfile.awesome-copilot
  • Dockerfile.awesome-copilot-azure
  • Dockerfile.markdown-to-html
  • Dockerfile.markdown-to-html-azure
  • Dockerfile.outlook-email
  • Dockerfile.outlook-email-azure
  • Dockerfile.todo-list
  • Dockerfile.todo-list-azure
  • global.json
  • LICENSE
  • README.md
  • SECURITY.md
  • SUPPORT.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tutorials & guides

shareAI-lab/
learn-claude-code

Bash is all you need - A nano claude code–like γ€Œagent harness」, built from 0 to 1

77k
luongnv89/
claude-howto
luongnv89/claude-howtoTutorials & Guides

A visual, example-driven guide to Claude Code β€” from basic concepts to advanced agents, with copy-paste templates that bring immediate value.

41k
agentskills/
agentskills
agentskills/agentskillsTutorials & Guides

Specification and documentation for Agent Skills

25k
datawhalechina/easy-vibeTutorials & Guides

πŸ’» vibe coding 101|The first course for AI-native product builders.

19k