# `ExAthena.Mcp.Server`
[🔗](https://github.com/udin-io/ex_athena/blob/v0.7.1/lib/ex_athena/mcp/server.ex#L1)

Per-MCP-server GenServer. Owns one `Client` and the cached tool catalog.

Lifecycle:
  1. `init/1` registers in the Registry and sends itself `:boot`.
  2. `handle_info(:boot, ...)` starts the `Client`, runs `tools/list`, caches tools.
  3. Status transitions: `:starting` → `:ready` (success) or `:degraded` (failure).

Linked to its `Client`: if the Client crashes, this process also crashes so the
Supervisor can restart both.

# `call_tool`

```elixir
@spec call_tool(GenServer.server(), String.t(), map(), non_neg_integer()) ::
  {:ok, map()} | {:error, term()}
```

Forward a tool call to the underlying client. Returns `{:ok, result_map}` or `{:error, reason}`.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `get_client`

```elixir
@spec get_client(GenServer.server()) :: {:ok, pid()} | {:error, term()}
```

Return `{:ok, client_pid}` when ready, `{:error, reason}` otherwise.

# `info`

```elixir
@spec info(GenServer.server()) :: {:ok, map()}
```

Return metadata map for `list_servers/0`.

# `list_tools`

```elixir
@spec list_tools(GenServer.server()) :: {:ok, [map()]} | {:error, term()}
```

Return cached tools. `{:ok, [tool_map]}` when ready, `{:error, reason}` otherwise.

# `start_link`

```elixir
@spec start_link(ExAthena.Mcp.Config.Server.t()) :: GenServer.on_start()
```

Start and link a server process registered under `cfg.name`.

---

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