# `AttestoMCP.Server`
[🔗](https://github.com/XukuLLC/attesto_mcp_server/blob/v2.8.0/lib/attesto_mcp_server/server.ex#L1)

Attesto-native MCP server core.

The core is transport-neutral. `AttestoMCP.Server.Plug` and
`AttestoMCP.Server.Stdio` both call `dispatch/4`; handlers run under a
separately supervised task and receive only an explicit authorization
context.

# `context`

```elixir
@type context() :: map()
```

# `definition`

```elixir
@type definition() :: map() | keyword()
```

Registered primitive definition accepted by the registry.

# `handler_return`

```elixir
@type handler_return() :: {:ok, term()} | {:error, term()} | {:input_required, map()}
```

A normal, failed, or modern interactive handler return.

# `server_opts`

```elixir
@type server_opts() :: AttestoMCP.Server.API.server_opts()
```

Options for startup, limits, timeouts, cursor policy, and disabled task flags.

# `ack_legacy_stream`

# `ack_subscription`

# `ack_subscription`

# `active_session_ids`

```elixir
@spec active_session_ids(
  pid() | atom(),
  keyword()
) ::
  {:ok, %{session_ids: [String.t()], next_cursor: String.t() | nil}}
  | {:error, :invalid_options | :session_store_unavailable | :unsupported}
```

Returns one bounded page of active legacy session IDs for operator tooling.

# `allow_rate`

```elixir
@spec allow_rate(pid() | atom(), term(), atom()) :: :ok | {:error, :rate_limited}
```

Consumes one bounded rate-limit token for a principal/category key.

# `await_initialized`

# `cancel_request`

# `cancel_subscription`

# `cancel_subscription`

# `child_spec`

```elixir
@spec child_spec(server_opts()) :: Supervisor.child_spec()
```

Returns a child spec whose id follows the optional registered server name.

# `close_legacy_stream`

# `close_subscription`

# `close_subscription`

# `delete_session`

# `deliver_client_response`

# `dispatch`

```elixir
@spec dispatch(pid() | atom(), map(), context(), keyword()) :: term()
```

Dispatch one decoded request and return a correlated response/result.

# `get_session`

# `mark_initialized`

# `negotiate_session`

```elixir
@spec negotiate_session(pid() | atom(), binary(), term(), term(), String.t(), map()) ::
  :ok
  | {:error,
     :invalid_negotiation
     | :already_negotiated
     | :not_found
     | :session_store_unavailable}
```

Negotiates one enabled legacy revision and capability map exactly once.

# `new_session`

# `open_legacy_stream`

# `options`

```elixir
@spec options(pid() | atom()) :: keyword()
```

Returns normalized options used by the protocol adapters.

# `publish`

```elixir
@spec publish(pid() | atom(), map(), keyword()) :: :ok | {:error, atom()}
```

# `register`

```elixir
@spec register(pid() | atom(), atom(), String.t(), definition()) ::
  :ok | {:error, term()}
```

Registers one supported primitive type.

# `register_all`

```elixir
@spec register_all(pid() | atom(), [AttestoMCP.Server.Registry.registration()]) ::
  :ok | {:error, term()}
```

Registers a bounded primitive batch atomically and coalesces catalog invalidations.

# `register_completion`

```elixir
@spec register_completion(pid() | atom(), String.t(), definition()) ::
  :ok | {:error, term()}
```

Registers a completion handler for an explicit prompt/template reference.

# `register_prompt`

```elixir
@spec register_prompt(pid() | atom(), String.t(), definition()) ::
  :ok | {:error, term()}
```

Registers a prompt and publishes a modern prompts-list invalidation.

# `register_resource`

```elixir
@spec register_resource(pid() | atom(), String.t(), definition()) ::
  :ok | {:error, term()}
```

Registers a static resource and publishes a modern resources-list invalidation.

# `register_resource_template`

```elixir
@spec register_resource_template(pid() | atom(), String.t(), definition()) ::
  :ok | {:error, term()}
```

Registers a URI-template resource and publishes a modern resources-list invalidation.

# `register_tool`

```elixir
@spec register_tool(pid() | atom(), String.t(), definition()) ::
  :ok | {:error, term()}
```

Registers a tool and publishes a modern tools-list invalidation.

# `replace_catalog`

```elixir
@spec replace_catalog(pid() | atom(), [AttestoMCP.Server.Registry.registration()]) ::
  :ok | {:error, term()}
```

Atomically replaces the complete primitive catalog from one bounded batch.

# `request_client`

# `session_capabilities`

```elixir
@spec session_capabilities(pid() | atom(), binary(), term(), term()) ::
  map() | {:error, :session_store_unavailable}
```

Returns the negotiated client capabilities for an owned session.

Returns an empty map when the session does not exist or the principal or
tenant does not own it. A session-store failure remains distinguishable from
a missing session.

# `session_logging_level`

```elixir
@spec session_logging_level(pid() | atom(), binary(), term(), term()) ::
  String.t() | nil | {:error, :session_store_unavailable}
```

Returns the negotiated minimum legacy log level for an owned session.

# `set_session_logging_level`

```elixir
@spec set_session_logging_level(pid() | atom(), binary(), term(), term(), String.t()) ::
  :ok | {:error, :not_found | :session_store_unavailable}
```

Sets the negotiated minimum legacy log level for an owned session.

# `set_session_version`

```elixir
@spec set_session_version(pid() | atom(), binary(), String.t()) ::
  :ok | {:error, :invalid_version | :session_store_unavailable}
```

Binds an unnegotiated session to one enabled legacy protocol revision.

# `snapshot`

```elixir
@spec snapshot(pid() | atom()) :: map()
```

Returns a deterministic registry snapshot.

# `start_link`

```elixir
@spec start_link(server_opts()) :: GenServer.on_start()
```

Starts the supervised protocol core and its registry/subscription children.

# `stats`

```elixir
@spec stats(pid() | atom()) :: map()
```

Returns bounded public counters for sessions, streams, subscriptions, and requests.

# `subscribe_resource`

# `touch_session`

# `unsubscribe_resource`

---

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