# `ADK.MCP.Client`
[🔗](https://github.com/zeroasterisk/adk-elixir/blob/main/lib/adk/mcp/client.ex#L1)

MCP (Model Context Protocol) client over stdio transport.

Launches an MCP server as a subprocess, performs JSON-RPC initialization,
and exposes `list_tools/1` and `call_tool/3` for protocol interaction.

## Examples

    {:ok, client} = ADK.MCP.Client.start_link(command: "npx", args: ["-y", "@modelcontextprotocol/server-everything"])
    {:ok, tools} = ADK.MCP.Client.list_tools(client)
    {:ok, result} = ADK.MCP.Client.call_tool(client, "echo", %{"message" => "hello"})

# `start_opt`

```elixir
@type start_opt() ::
  {:command, String.t()}
  | {:args, [String.t()]}
  | {:env, [{String.t(), String.t()}]}
  | {:name, GenServer.name()}
  | {:timeout, pos_integer()}
```

# `call_tool`

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

Call a tool on the MCP server.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `close`

```elixir
@spec close(GenServer.server()) :: :ok
```

Stop the client and terminate the subprocess.

# `list_tools`

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

List tools available on the MCP server.

# `server_info`

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

Get server info from the initialization response.

# `start_link`

```elixir
@spec start_link([start_opt()]) :: GenServer.on_start()
```

---

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