Backplane. McpProtocol. Transport. Behaviour behaviour
(backplane_mcp_protocol v0.6.0)
Copy Markdown
Defines the behavior that all transport implementations must follow.
Summary
Callbacks
Returns the list of MCP protocol versions supported by this transport.
Types
@type message() :: String.t()
The JSON-RPC message encoded
@type reason() :: term() | Backplane.McpProtocol.MCP.Error.t()
@type t() :: GenServer.server()
Callbacks
@callback open_stream(t(), message(), [stream_opt]) :: {:ok, term()} | {:error, reason()} when stream_opt: {:timeout, pos_integer()} | {:request_context, Backplane.McpProtocol.Transport.RequestContext.t()} | {:owner, pid()} | {:subscription_id, String.t() | integer()}
@callback send_message(t(), message(), [opt]) :: :ok | {:error, reason()} when opt: {:timeout, pos_integer()} | {:request_context, Backplane.McpProtocol.Transport.RequestContext.t()}
@callback start_link(keyword()) :: GenServer.on_start()
@callback supported_protocol_versions() :: [String.t()] | :all
Returns the list of MCP protocol versions supported by this transport.
Examples
iex> MyTransport.supported_protocol_versions()
["2024-11-05", "2025-03-26"]