Table of Contents

Interface IMcpClient

Namespace
ModelContextProtocol.Client
Assembly
ModelContextProtocol.dll

Represents an instance of a Model Context Protocol (MCP) client that connects to and communicates with an MCP server.

public interface IMcpClient : IMcpEndpoint, IAsyncDisposable
Inherited Members
Extension Methods

Properties

ServerCapabilities

Gets the capabilities supported by the connected server.

ServerCapabilities ServerCapabilities { get; }

Property Value

ServerCapabilities

Exceptions

InvalidOperationException

The client is not connected.

ServerInfo

Gets the implementation information of the connected server.

Implementation ServerInfo { get; }

Property Value

Implementation

Remarks

This property provides identification details about the connected server, including its name and version. It is populated during the initialization handshake and is available after a successful connection.

This information can be useful for logging, debugging, compatibility checks, and displaying server information to users.

Exceptions

InvalidOperationException

The client is not connected.

ServerInstructions

Gets any instructions describing how to use the connected server and its features.

string? ServerInstructions { get; }

Property Value

string

Remarks

This property contains instructions provided by the server during initialization that explain how to effectively use its capabilities. These instructions can include details about available tools, expected input formats, limitations, or any other helpful information.

This can be used by clients to improve an LLM's understanding of available tools, prompts, and resources. It can be thought of like a "hint" to the model and may be added to a system prompt.