# csharp-sdk

> MCP Server

This repository contains the official C# SDK for the Model Context Protocol, enabling .NET applications to implement and interact with MCP clients and servers. It facilitates secure integration between LLMs

## Overview

- **Category:** Developer Tools
- **Language:** C#
- **Stars:** 4476
- **Forks:** 101
- **Owner:** modelcontextprotocol
- **GitHub:** https://github.com/modelcontextprotocol/csharp-sdk
- **Homepage:** https://www.nuget.org/packages/ModelContextProtocol
- **Created:** 2025-03-10T18:17:41+00:00
- **Updated:** 2025-03-28T23:55:09+00:00
- **Source:** https://model-context-protocol.com/servers/csharp-sdk-model-context-protocol-integration

## Setup

## Setup
To get started, install the package from NuGet:

```
dotnet add package ModelContextProtocol --prerelease
```

## Tools

## Available Tools

1.  `McpClientFactory.CreateAsync` (Used to instantiate and connect an `IMcpClient` to a server).
2.  `IMcpClient` (Interact with the server, such as to enumerate all available tools and invoke tools).
3.  `ListToolsAsync` (Enumerate all available tools from the server).
4.  `CallToolAsync` (Execute a tool).
5.  `AddMcpServer` (Creates an MCP server).
6.  `WithStdioServerTransport` (Configures the server to use standard input/output for communication).
7.  `WithToolsFromAssembly` (Registers all tools from the current application).
8.  `AsSamplingChatClient` (Allows the server to make sampling requests back to the client).

