AttestoMCP.Server.Plug (attesto_mcp_server v0.8.0)

Copy Markdown View Source

Plug-compatible Streamable HTTP boundary for modern and legacy MCP.

Every protected MCP leg authenticates through AttestoMCP.Plug.Authenticate before request decoding or registry dispatch. Metadata discovery is the one intentionally public route defined by RFC 9728. Hosts may select request-scoped tool streams with stream_tools or stream_all_tools; both options are validated during init/1.

Summary

Types

Supported Plug boundary options.

Functions

Authenticates and serves one HTTP request through the MCP boundary.

Initializes a Plug state for an already-supervised server and pinned auth boundary.

Types

plug_option()

@type plug_option() ::
  {:server, pid() | atom()}
  | {:path, String.t()}
  | {:auth, keyword()}
  | {:scope_map, map()}
  | {:subscription_scopes, [String.t()]}
  | {:max_body_bytes, pos_integer()}
  | {:max_message_bytes, pos_integer()}
  | {:allow_dynamic_origin, boolean()}
  | {:origin, String.t()}
  | {:base_url, String.t()}
  | {:resource, String.t()}
  | {:resource_audience, String.t()}
  | {:stream_keepalive_ms, pos_integer()}
  | {:legacy_keepalive_ms, pos_integer()}
  | {:subscription_timeout, pos_integer()}
  | {:stream_queue_size, pos_integer()}
  | {:subscription_queue_size, pos_integer()}
  | {:max_queue, pos_integer()}
  | {:stream_all_tools, boolean()}
  | {:stream_tools, [String.t()]}

Supported Plug boundary options.

Functions

call(conn, state)

@spec call(Plug.Conn.t(), map()) :: Plug.Conn.t()

Authenticates and serves one HTTP request through the MCP boundary.

init(opts)

@spec init([plug_option()]) :: map()

Initializes a Plug state for an already-supervised server and pinned auth boundary.