nat.plugins.mcp.client_config#

Classes#

MCPToolOverrideConfig

Configuration for overriding tool properties when exposing from MCP server.

MCPServerConfig

Server connection details for MCP client.

MCPClientConfig

Configuration for connecting to an MCP server as a client and exposing selected tools.

Module Contents#

class MCPToolOverrideConfig(/, **data: Any)#

Bases: pydantic.BaseModel

Configuration for overriding tool properties when exposing from MCP server.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

alias: str | None = None#
description: str | None = None#
class MCPServerConfig(/, **data: Any)#

Bases: pydantic.BaseModel

Server connection details for MCP client. Supports stdio, sse, and streamable-http transports. streamable-http is the recommended default for HTTP-based connections.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

transport: Literal['stdio', 'sse', 'streamable-http'] = None#
url: pydantic.HttpUrl | None = None#
command: str | None = None#
args: list[str] | None = None#
env: dict[str, str] | None = None#
auth_provider: str | nat.data_models.component_ref.AuthenticationRef | None = None#
validate_model()#

Validate that stdio and SSE/Streamable HTTP properties are mutually exclusive.

class MCPClientConfig(/, **data: Any)#

Bases: nat.data_models.function.FunctionGroupBaseConfig

Configuration for connecting to an MCP server as a client and exposing selected tools.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

server: MCPServerConfig = None#
tool_call_timeout: datetime.timedelta = None#
auth_flow_timeout: datetime.timedelta = None#
reconnect_enabled: bool = None#
reconnect_max_attempts: int = None#
reconnect_initial_backoff: float = None#
reconnect_max_backoff: float = None#
tool_overrides: dict[str, MCPToolOverrideConfig] | None = None#
session_aware_tools: bool = None#
max_sessions: int = None#
session_idle_timeout: datetime.timedelta = None#
_validate_reconnect_backoff() MCPClientConfig#

Validate reconnect backoff values.