Anubis.Transport.Behaviour behaviour (anubis_mcp v0.17.0)

Defines the behavior that all transport implementations must follow.

Summary

Types

The JSON-RPC message encoded

t()

Callbacks

Returns the list of MCP protocol versions supported by this transport.

Types

message()

@type message() :: String.t()

The JSON-RPC message encoded

reason()

@type reason() :: term() | Anubis.MCP.Error.t()

t()

@type t() :: GenServer.server()

Callbacks

send_message(t, message, list)

@callback send_message(t(), message(), [opt]) :: :ok | {:error, reason()}
when opt: {:timeout, pos_integer()}

shutdown(t)

@callback shutdown(t()) :: :ok | {:error, reason()}

start_link(keyword)

@callback start_link(keyword()) :: GenServer.on_start()

supported_protocol_versions()

@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"]