mcp_client library

Classes

AuthenticatedEventSource
Authenticated EventSource implementation
AuthServerMetadata
Authorization server metadata (RFC8414)
BatchingClientTransport
Batch-aware client transport wrapper
BatchManager
Batch request builder and manager
BatchRequest
JSON-RPC batch request
BatchResponse
JSON-RPC batch response
BatchUtils
Utility functions for JSON-RPC batching
CachedResource
Cached resource item for performance optimization
CallToolRequest
Call tool request
CallToolResult
Tool call result
CancelRequestNotification
Cancel request notification
Client
Main MCP Client class that handles all client-side protocol operations
ClientCapabilities
Client capabilities configuration
ClientInfo
Client information (2025-03-26 compliant)
ClientTransport
Abstract base class for client transport implementations
CompletionRequest
Completion request
CompletionResult
Completion result
CompressedEventSource
Compressed EventSource implementation
Connected
The connection is established and ready
Connecting
The connection is in the process of connecting
ConnectionError
The connection has failed with an error
ConnectionState
Represents the various states of an MCP connection
Content
Base class for all MCP content types (2025-03-26 compliant)
CreateMessageRequest
Create message request for sampling
CreateMessageResult
Create message result from sampling
Disconnected
The connection is disconnected
Disconnecting
The connection is in the process of disconnecting
Failure<T, E extends Object>
Represents a failed result
GetPromptRequest
Get prompt request
GetPromptResult
Get prompt result
HeartbeatConfig
Heartbeat configuration
HeartbeatEventSource
Heartbeat-enabled EventSource implementation
HeartbeatStats
Heartbeat statistics
HttpOAuthClient
HTTP-based OAuth 2.1 client implementation
ImageContent
Image content representation
InitializeRequest
Initialize request
InitializeResult
Initialize result
JsonRpcMessage
JSON-RPC message
Level
Levels to control logging output. Logging can be enabled to include all levels above certain Level. Levels are ordered using an integer value Level.value. The predefined Level constants below are sorted as follows (in descending order): Level.SHOUT, Level.SEVERE, Level.WARNING, Level.INFO, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, and Level.ALL.
ListPromptsResult
List prompts result
ListResourcesResult
List resources result
ListToolsResult
List tools result
Logger
Use a Logger to log debug messages.
LogMessageNotification
Log message notification
LogRecord
A log entry representation used to propagate information from Logger to individual handlers.
McpClient
Modern MCP Client factory with enhanced error handling and configuration
McpClientConfig
Configuration for creating MCP clients
McpProtocol
MCP protocol versions and constants
Message
Message model for prompt system
ModelHint
Model hint for sampling
ModelPreferences
Model preferences for sampling
OAuthClient
OAuth client interface
OAuthConfig
OAuth 2.1 authentication configuration
OAuthError
OAuth error response
OAuthToken
OAuth 2.1 token response
OAuthTokenManager
OAuth token manager with automatic refresh
PendingOperation
Pending operation for cancellation support
ProgressNotification
Progress notification
ProgressUpdate
Progress update for long-running operations
Prompt
Prompt definition
PromptArgument
Prompt argument definition
PromptsListChangedNotification
Prompts list changed notification
ProtocolCapabilities
Protocol capabilities
ReadResourceRequest
Read resource request
ReadResourceResult
Resource read result
Resource
Resource definition
ResourceContent
Resource content representation
ResourceContentInfo
Resource content
ResourcesListChangedNotification
Resources list changed notification
ResourceTemplate
Resource template definition
ResourceUpdatedNotification
Resource updated notification
Result<T, E extends Object>
A sealed class representing the result of an operation that can succeed or fail
Results
Utility functions for working with Results
Root
Root definition for filesystem access
Semaphore
Semaphore for controlling concurrent requests
ServerCapabilities
Server capabilities
ServerHealth
Server health information
ServerInfo
Server information (2025-03-26 compliant)
SseAuthClientTransport
SSE Transport with Bearer Token Authentication
SseClientTransport
Transport implementation using Server-Sent Events (SSE) over HTTP
SseCompressedClientTransport
SSE Transport with automatic compression support
SseHeartbeatClientTransport
SSE Transport with heartbeat monitoring
SseTransportConfig
StdioClientTransport
Transport implementation using standard input/output streams
StdioTransportConfig
StreamableHttpClientTransport
Streamable HTTP client transport for MCP
StreamableHttpTransportConfig
Success<T, E extends Object>
Represents a successful result
TextContent
Text content representation
TokenLifecycleEvent
토큰 생명주기 이벤트
Tool
Tool definition (2025-03-26 compliant)
ToolCallTracking
Class to hold result of a tracked tool call
ToolMetadata
Lightweight tool metadata (name + description only) Used for token-efficient LLM context in deferred loading mode
ToolRegistry
Cache layer for tool definitions Provides metadata extraction and full schema lookup LLM-agnostic: can be used without mcp_llm
ToolsListChangedNotification
Tools list changed notification
TransportConfig
Configuration for transport connections

Enums

CompressionType
Compression types supported
ConnectionHealth
Connection health status
DisconnectReason
Reason for disconnection
MCPContentType
McpLogLevel
Log levels for MCP protocol
MessageRole
Base content type enum for MCP
OAuthGrantType
OAuth 2.1 grant types supported by MCP
TokenEventType
토큰 생명주기 이벤트 타입

Extensions

ClientToolMetadataExtension on Client
Extension on Client for easy metadata access in deferred loading mode
FutureResultExtensions on Future<Result<T, E>>
Extension methods for Future<Result>
LoggerExtensions on Logger

Constants

defaultLevel → const Level
The default Level.

Properties

hierarchicalLoggingEnabled bool
Whether to allow fine-grain logging and configuration of loggers in a hierarchy.
getter/setter pair
recordStackTraceAtLevel Level
Automatically record stack traces for any message of this level or above.
getter/setter pair

Typedefs

MCPClient = McpClient

Exceptions / Errors

McpError
Error class for MCP-related errors