Packages

Model Context Protocol (MCP) implementation in Elixir with Phoenix integration

Retired package: Release invalid - Accidental version. Use 0.3.0 instead.

Current section

Files

Jump to
backplane_mcp_protocol lib backplane mcp_protocol transport behaviour.ex
Raw

lib/backplane/mcp_protocol/transport/behaviour.ex

defmodule Backplane.McpProtocol.Transport.Behaviour do
@moduledoc """
Defines the behavior that all transport implementations must follow.
"""
alias Backplane.McpProtocol.MCP.Error
@type t :: GenServer.server()
@typedoc "The JSON-RPC message encoded"
@type message :: String.t()
@type reason :: term() | Error.t()
@callback start_link(keyword()) :: GenServer.on_start()
@callback send_message(t(), message(), list(opt)) :: :ok | {:error, reason()}
when opt: {:timeout, pos_integer()}
@callback shutdown(t()) :: :ok | {:error, reason()}
@doc """
Returns the list of MCP protocol versions supported by this transport.
## Examples
iex> MyTransport.supported_protocol_versions()
["2024-11-05", "2025-03-26"]
"""
@callback supported_protocol_versions() :: [String.t()] | :all
end