# `HexpmMcp.CLI`
[🔗](https://github.com/joshrotenberg/hexpm-mcp/blob/main/lib/hexpm_mcp/cli.ex#L1)

Command-line interface for the server.

The OTP application callback is the real entry point in every mode. Burrito
boots the BEAM and hands control to the OTP application callback; it never
calls a `main/1`, and the `main_module` release key is metadata only. So this
module turns argv into configuration and lets `start/2` build the supervision
tree from it.

`Cheer.parse/3` is what makes that shape work. Unlike `Cheer.run/3` it
resolves and validates argv without invoking a command handler, which is the
right fit when arguments configure a long-running process rather than driving
a unit of work.

# `config`

```elixir
@spec config(map()) :: keyword()
```

Turn parsed arguments into server configuration.

A `nil` transport resolves to the runtime's default, and a `nil` port defers
to app config, which `runtime.exs` populates from `HEXPM_MCP_PORT` in prod.

# `parse`

```elixir
@spec parse() :: {:serve, keyword()} | :handled | :usage_error
```

Resolve argv into the server configuration.

Returns `{:serve, opts}` to start, `:handled` when Cheer already printed help
or version, and `:usage_error` when it already printed a usage error.

argv comes from `Cheer.argv/0` because a Burrito-wrapped binary does not
populate `System.argv/0`; its arguments arrive through
`Burrito.Util.Args.argv/0` instead. Reading the wrong one fails silently:
every option falls through to its default and the server looks like it
started fine while speaking the wrong protocol.

---

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