# `Condukt.MCP.Server`
[🔗](https://github.com/tuist/condukt/blob/1.4.1/lib/condukt/mcp/server.ex#L1)

Declarative configuration for a connected MCP server.

See `Condukt.MCP` for the supported transports, authentication shapes,
and how the struct fits into agents and workflows.

## Fields

  * `:name` (required, string) - identifier used to prefix tools
    discovered on this server (`<name>.<tool>` unless overridden by
    `:prefix`). Must match `~r/^[A-Za-z][A-Za-z0-9_-]*$/`.

  * `:transport` (required) - one of:
    - `{:stdio, command: binary, args: [binary], env: %{string => string}}` -
      spawns a subprocess and exchanges newline-delimited JSON-RPC over
      its stdio.
    - `{:http_sse, url: binary, headers: %{string => string}}` - the
      legacy 2024-11 transport with separate POST and SSE endpoints.
    - `{:streamable_http, url: binary, headers: %{string => string}}` -
      the 2025-03-26 single-URL streamable HTTP transport. Default for
      new HTTP-based MCP servers.

  * `:auth` - HTTP authentication. See `Condukt.MCP` for the supported
    shapes. Ignored by the stdio transport.

  * `:env` - extra environment variables to inject into the spawned
    subprocess (stdio only). May be a list of variable names to
    passthrough from the parent process (`["GITHUB_TOKEN"]`) or a map
    of names to secret refs (`%{"GH_TOKEN" => {:env, "GITHUB_TOKEN"}}`).

  * `:prefix` - overrides the default `<name>.` tool name prefix. Pass
    `""` to expose tools without any prefix (use with care, server
    names then become irrelevant for collision avoidance).

  * `:init_timeout` - max milliseconds to wait for the `initialize`
    handshake and `tools/list` exchange (default `10_000`).

  * `:request_timeout` - max milliseconds for a single tool call
    (default `60_000`).

# `normalize`

Validates a server spec and normalizes shorthand fields.

Returns `{:ok, server}` or `{:error, reason}`.

# `prefix`

Returns the tool name prefix used for tools discovered on this server.

---

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