Table of Contents

Constructor McpClient

Namespace
LMKit.Mcp.Client
Assembly
LM-Kit.NET.dll

McpClient(string, TimeSpan?)

Initializes a new instance of McpClient with an internally owned HttpClient.

public McpClient(string baseUrl, TimeSpan? timeout = null)

Parameters

baseUrl string

MCP server base URL (e.g., https://example.com/mcp).

timeout TimeSpan?

Optional HTTP timeout; if null, defaults to 60 seconds.

Exceptions

ArgumentException

Thrown when baseUrl is null or whitespace.

McpClient(string, HttpClient)

Initializes a new instance of McpClient using a caller-provided HttpClient. The caller retains ownership and is responsible for the lifecycle of the provided client.

public McpClient(string baseUrl, HttpClient externalHttpClient)

Parameters

baseUrl string

MCP server base URL (e.g., https://example.com/mcp).

externalHttpClient HttpClient

An existing HttpClient instance to use.

Exceptions

ArgumentException

Thrown when baseUrl is null or whitespace.

ArgumentNullException

Thrown when externalHttpClient is null.