# `AttestoMCP.Anubis.Session`
[🔗](https://github.com/XukuLLC/attesto_mcp/blob/v1.0.5/lib/attesto_mcp/anubis/session.ex#L2)

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.

# `t`

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

# `changeset`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
