AttestoMCP.Anubis.Session (AttestoMCP v1.0.1)

Copy Markdown View Source

Persisted Anubis MCP session state, backing AttestoMCP.Anubis.SessionStore.Ecto.

One row per MCP session, keyed by the client's Mcp-Session-Id. state is the JSON-serializable session map Anubis produces (client_info, capabilities, frame, ...), stored as jsonb so it round-trips with string keys. expires_at bounds how long a disconnected session may be restored; expired rows are reaped lazily on load and by the store's cleanup_expired/1.

Compile-guarded on Ecto.Schema: a consumer that does not persist MCP sessions never compiles it.

Summary

Functions

Build the upsert changeset for a session row. Fail-closed: the session_id and expires_at are required.

Types

t()

@type t() :: %AttestoMCP.Anubis.Session{
  __meta__: term(),
  expires_at: term(),
  inserted_at: term(),
  session_id: term(),
  state: term(),
  updated_at: term()
}

Functions

changeset(session, attrs)

@spec changeset(t() | Ecto.Changeset.t(), map()) :: Ecto.Changeset.t()

Build the upsert changeset for a session row. Fail-closed: the session_id and expires_at are required.