Skip to main content

Crate rust_mcp_sdk

Crate rust_mcp_sdk 

Source

Modules§

auth
error
id_generator
macros
mcp_client
Includes the runtimes and traits required to create a type-safe MCP client.
mcp_http
mcp_server
Includes the runtimes and traits required to create a type-safe MCP server.
schema
tool_param_headers
SEP-2243 client support — x-mcp-header tool parameter annotations.

Macros§

mcp_icon
Convenience macro to construct an Icon with shorthand syntax.
tool_box
Generates an enum representing a toolbox with mcp tool variants and associated functionality.
with_middlewares
A helper macro to wrap an async handler method into a RequestHandler and compose it with middlewares.

Structs§

ClientDetails
Client identity and capabilities for an MCP client.
ClientSseTransport
Client-side Server-Sent Events (SSE) transport implementation
ClientSseTransportOptions
Configuration options for the Client SSE Transport
ClientStreamableTransport
GenericSendError
A wrapper around a broadcast send error. This structure allows for generic error handling by boxing the underlying error into a type-erased form.
GenericWatchSendError
A wrapper around a broadcast send error. This structure allows for generic error handling by boxing the underlying error into a type-erased form.
MessageDispatcher
Provides a dispatcher for sending MCP messages and handling responses.
RequestContext
Per-request context extracted from RequestMetaObject and carried to every handler.
RequestIdGenNumeric
RequestOptions
ServerDetails
Server identity, capabilities and instructions for an MCP server.
SseEvent
Represents a single Server-Sent Event (SSE) as defined in the SSE protocol.
SseTransport
StdioTransport
Implements a standard I/O transport for MCP communication.
StreamableTransportOptions
TransportOptions
Configuration for the transport layer

Enums§

IoStream
Enum representing a stream that can either be readable or writable. This allows the reuse of the same traits for both MCP Server and MCP Client, where the data direction is reversed.
RequiredClientCapability
A client capability that a server handler may require.
TransportError

Constants§

DEFAULT_MAX_LINE_LENGTH
Maximum size (in bytes) of a single newline-delimited incoming message for all transports (stdio, SSE, streamable HTTP). Messages exceeding this limit are dropped silently; increase this value if you expect large tool results or responses.
MCP_LAST_EVENT_ID_HEADER
MCP_METHOD_HEADER
SEP-2243 standard request header naming the JSON-RPC method of the request body (e.g. tools/call). Required on the 2026-07-28 stateless wire.
MCP_NAME_HEADER
SEP-2243 standard request header naming the tool/prompt/resource the request targets (params.name or params.uri), when the method has one.
MCP_PROTOCOL_VERSION_HEADER
MCP_SESSION_ID_HEADER

Traits§

IdGenerator
Trait for generating unique identifiers.
McpClient
McpClientHandler
McpDispatch
A trait for dispatching MCP (Message Communication Protocol) messages.
McpHttpServer
Common interface for running MCP servers over HTTP transports.
McpObserver
Observer hook for incoming/outgoing messages. Implementations should be fast and preferably non-blocking.
McpServer
McpServerHandler
RequestIdGen
A trait for generating and managing request IDs in a thread-safe manner.
ToMcpClientHandler
ToMcpClientHandlerCore
ToMcpServerHandler
ToMcpServerHandlerCore
Transport
A trait representing the transport layer for the MCP (Message Communication Protocol).
TransportDispatcher
A composite trait that combines both transport and dispatch capabilities for the MCP protocol.

Type Aliases§

EventId
RequestHeaderProvider
Hook computing extra HTTP headers for a given outgoing POST payload (e.g. SEP-2243 Mcp-Param-* mirroring, rotating bearer tokens).
SessionId
StreamId
TransportResult